This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] [PR tdep/17379] Fix internal-error when stack pointer is invalid


On 09/12/2014 03:46 AM, Edjunior Barbosa Machado wrote:
> +# Run until SIGSEGV.
> +gdb_run_cmd
> +
> +gdb_expect {
> +    -re "Program received signal SIGSEGV.*$gdb_prompt $" {
> +	pass "run until SIGSEGV"
> +    }
> +    -re ".*$gdb_prompt $" {
> +	fail "run until SIGSEGV"
> +    }
> +    timeout {
> +	fail "run until SIGSEGV (timeout)"
> +    }
> +}

gdb_expect should only be used when gdb_test or gdb_test_multiple
really can't be used.  Please write instead:

gdb_run_cmd

set test "run until SIGSEGV"
gdb_test_multiple "" $test {
    -re "Program received signal SIGSEGV.*$gdb_prompt $" {
	pass $test
    }
}

gdb_test_multiple will already issue a FAIL if it sees the prompt
or gets a timeout, and in addition will catch other problems,
like internal errors.

Thanks,
Pedro Alves


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]