diff options
author | Guinevere Larsen <guinevere@redhat.com> | 2024-10-14 10:13:13 -0300 |
---|---|---|
committer | Guinevere Larsen <guinevere@redhat.com> | 2024-10-14 11:55:38 -0300 |
commit | 2dbb779c83f4825619ef171ccaee9a3f664d5a34 (patch) | |
tree | f4950cabffbaf956ed1e43478d19c995408bb1d3 /gdb/testsuite | |
parent | 4444dac5173e2e6ecd3053d22719049a3016836d (diff) | |
download | gdb-2dbb779c83f4825619ef171ccaee9a3f664d5a34.zip gdb-2dbb779c83f4825619ef171ccaee9a3f664d5a34.tar.gz gdb-2dbb779c83f4825619ef171ccaee9a3f664d5a34.tar.bz2 |
gdb/testsuite: fix gdb.multi/inferior-specific-bp.exp
A recent commit, "16a6f7d2ee3 gdb: avoid breakpoint::clear_locations
calls in update_breakpoint_locations", started checking if GDB correctly
relocates a breakpoint from inferior 1's declaration of the function
"bar" to inferior 2's declaration.
Unfortunately, inferior 2 never calls bar in its regular execution, and
because of that, clang would optimize that whole function away, making
it so there is no location for the breakpoint to be relocated to.
This commit changes the .c file so that the function is not optimized
away and the test fully passes with clang. It is important to actually
call bar instead of using __attribute__((used)) because the latter
causes the breakpoint locations to be inverted, 3.1 belongs to inferior
2 and 3.2 belongs to inferior 1, which will cause an unrelated failure.
Approved-By: Andrew Burgess <aburgess@redhat.com>
Diffstat (limited to 'gdb/testsuite')
-rw-r--r-- | gdb/testsuite/gdb.multi/inferior-specific-bp-2.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/gdb/testsuite/gdb.multi/inferior-specific-bp-2.c b/gdb/testsuite/gdb.multi/inferior-specific-bp-2.c index bde6fbf..3a45c21 100644 --- a/gdb/testsuite/gdb.multi/inferior-specific-bp-2.c +++ b/gdb/testsuite/gdb.multi/inferior-specific-bp-2.c @@ -30,7 +30,8 @@ main (void) { int ret = baz (); stop_breakpt (); - return ret; + /* We have to call bar here, otherwise it might be optimized away. */ + return ret + bar (); } static int |