]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
gdb/testsuite: fix gdb.multi/inferior-specific-bp.exp
authorGuinevere Larsen <guinevere@redhat.com>
Mon, 14 Oct 2024 13:13:13 +0000 (10:13 -0300)
committerGuinevere Larsen <guinevere@redhat.com>
Mon, 14 Oct 2024 14:55:38 +0000 (11:55 -0300)
commit2dbb779c83f4825619ef171ccaee9a3f664d5a34
treef4950cabffbaf956ed1e43478d19c995408bb1d3
parent4444dac5173e2e6ecd3053d22719049a3016836d
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>
gdb/testsuite/gdb.multi/inferior-specific-bp-2.c