This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Make gdb.python/python.exp more robust
- From: Pedro Alves <palves at redhat dot com>
- To: Luis Machado <lgustavo at codesourcery dot com>, gdb-patches at sourceware dot org
- Date: Fri, 20 Jan 2017 16:59:43 +0000
- Subject: Re: [PATCH] Make gdb.python/python.exp more robust
- Authentication-results: sourceware.org; auth=none
- References: <1484923030-16656-1-git-send-email-lgustavo@codesourcery.com>
On 01/20/2017 02:37 PM, Luis Machado wrote:
> }
> gdb_test "python print (symtab\[1\]\[0\].symtab)" ".*${python_1_c}" "test decode_line func1 filename"
> -gdb_test "python print (symtab\[1\]\[0\].line)" "19" "test decode_line func1 line number"
> +
> +# Fetch the line GDB thinks func1 starts at. This may change depending
> +# on the architecture and on how GDB handles the prologue of the function.
> +gdb_test_multiple "info line func1" "info line func1" {
> + -re "Line ($decimal) of .* starts at address $hex <func1> and ends at $hex <func1\\+$decimal>\.\[\r\n\]+$gdb_prompt $" {
> + # Fetch the line number.
> + set func1_lineno $expect_out(1,string)
> + }
> +}
Do:
set func1_lineno "noline"
before gdb_test_multiple, so that in case the above FAILs, this:
> +
> +gdb_test "python print (symtab\[1\]\[0\].line)" "$func1_lineno" "test decode_line func1 line number"
FAILs too, instead of ERRORing out with a TCL error, due to
undefined $func1_lineno.
OK with that change.
Thanks,
Pedro Alves