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

Pedro Alves palves@redhat.com
Fri Sep 12 09:59:00 GMT 2014


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



More information about the Gdb-patches mailing list