diff options
author | Luis Machado <lgustavo@codesourcery.com> | 2017-01-20 13:15:36 -0600 |
---|---|---|
committer | Luis Machado <lgustavo@codesourcery.com> | 2017-01-20 13:15:36 -0600 |
commit | d334ae250a3ec888f0603cf8e909d0f425aeb30f (patch) | |
tree | f96d7f1ef23d1f7a546198b798b11e9c387d44b7 /gdb/testsuite | |
parent | 78cbbba8e0bc8b0288f5ce4360b4689ab893aa13 (diff) | |
download | gdb-d334ae250a3ec888f0603cf8e909d0f425aeb30f.zip gdb-d334ae250a3ec888f0603cf8e909d0f425aeb30f.tar.gz gdb-d334ae250a3ec888f0603cf8e909d0f425aeb30f.tar.bz2 |
Make gdb.python/python.exp more robust
I noticed gdb.python/python.exp failing on aarch64-elf like so:
FAIL: gdb.python/python.exp: Test decode_line func1 line number
This particular test expects the line number for func1 to be 19, hardcoded.
In my aarch64-elf tests gdb thinks func1 is at line 20, making the test fail.
The following patch addresses this by reading the line number information from
GDB and comparing it against the python decoded symtab information.
gdb/testsuite/ChangeLog:
2017-01-20 Luis Machado <lgustavo@codesourcery.com>
* gdb.python/python.exp: Check line number against what GDB thinks
the line number is for func1.
Diffstat (limited to 'gdb/testsuite')
-rw-r--r-- | gdb/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/testsuite/gdb.python/python.exp | 16 |
2 files changed, 20 insertions, 1 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 8a03282..3af1d65 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-01-20 Luis Machado <lgustavo@codesourcery.com> + + * gdb.python/python.exp: Check line number against what GDB thinks + the line number is for func1. + 2017-01-08 Iain Buclaw <ibuclaw@gdcproject.org> * gdb.dlang/debug-expr.exp: New file. diff --git a/gdb/testsuite/gdb.python/python.exp b/gdb/testsuite/gdb.python/python.exp index 95ec74e..de8daad 100644 --- a/gdb/testsuite/gdb.python/python.exp +++ b/gdb/testsuite/gdb.python/python.exp @@ -246,7 +246,21 @@ if { [is_remote host] } { set python_1_c [string_to_regexp "gdb.python/python-1.c"] } 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" + +# Set a default value for func1_lineno in case we fail to fetch the line number +# below. +set func1_lineno "noline" + +# 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) + } +} + +gdb_test "python print (symtab\[1\]\[0\].line)" "$func1_lineno" "test decode_line func1 line number" gdb_py_test_silent_cmd {python symtab = gdb.decode_line ("func1,func2")} \ "test decode_line func1,func2" 1 gdb_test {python print (symtab[0])} ",func2" "stop at comma in linespec" |