[gdb/testsuite] Fix gdb.base/consecutive.exp with gcc-8
authorTom de Vries <tdevries@suse.de>
Wed, 6 May 2020 05:07:47 +0000 (07:07 +0200)
committerTom de Vries <tdevries@suse.de>
Wed, 6 May 2020 05:07:47 +0000 (07:07 +0200)
commit7c99e7e2b08cf439198a79435fbee48af8dd1043
treee884e65e507b7e28fbb6eb8c3cb5c47c89aedc05
parent6173d6a696349bd934166b4694c24f4eda7362c0
[gdb/testsuite] Fix gdb.base/consecutive.exp with gcc-8

When running test-case gdb.base/consecutive.exp with gcc-8 instead of gcc-7,
we get:
...
 (gdb) step^M
 ^M
-Breakpoint 3, 0x00000000004004b1 in foo () at consecutive.c:10^M
+Breakpoint 3, foo () at consecutive.c:10^M
 10        return a[0] + a[1] + a[2] + a[3] + a[4] + a[5] + a[6];^M
-(gdb) PASS: gdb.base/consecutive.exp: stopped at bp, 2nd instr
+(gdb) FAIL: gdb.base/consecutive.exp: stopped at bp, 2nd instr
...

This is due to the fact that gcc-8 generates more precise line info, making
the breakpoint address a "recommended breakpoint location", and consequently
gdb doesn't print the address prefix anymore.

Fix the FAIL by checking in the test-case whether the breakpoint address is at
"recommended breakpoint location" or not.

gdb/testsuite/ChangeLog:

2020-05-06  Tom de Vries  <tdevries@suse.de>

* lib/gdb.exp (is_stmt_addresses, hex_in_list): New proc, factored out
of ...
* gdb.base/async.exp: ... here.
* gdb.base/consecutive.exp: Handle if 2nd breakpoint is at a
"recommended breakpoint location".
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.base/async.exp
gdb/testsuite/gdb.base/consecutive.exp
gdb/testsuite/lib/gdb.exp