gdb: cleanup around some set_momentary_breakpoint_at_pc calls
authorAndrew Burgess <aburgess@redhat.com>
Thu, 16 Mar 2023 11:13:44 +0000 (11:13 +0000)
committerAndrew Burgess <aburgess@redhat.com>
Mon, 3 Apr 2023 14:04:03 +0000 (15:04 +0100)
commit60a13bbcdfb0ce008a77563cea0c34c830d7b170
treef779ff8c755fa7126fb483fd28a09e0d3b8fe193
parent2e411b8c68eb2b035b31d5b00d940d4be1a0928b
gdb: cleanup around some set_momentary_breakpoint_at_pc calls

I noticed a couple of places in infrun.c where we call
set_momentary_breakpoint_at_pc, and then set the newly created
breakpoint's thread field, these are in:

  insert_exception_resume_breakpoint
  insert_exception_resume_from_probe

Function set_momentary_breakpoint_at_pc calls
set_momentary_breakpoint, which always creates the breakpoint as
thread-specific for the current inferior_thread().

The two insert_* functions mentioned above take an arbitrary
thread_info* as an argument and set the breakpoint::thread to hold the
thread number of that arbitrary thread.

However, the insert_* functions store the breakpoint pointer within
the current inferior_thread(), so we know that the thread being passed
in must be the currently selected thread.

What this means is that we can:

  1. Assert that the thread being passed in is the currently selected
  thread, and

  2. No longer adjust the breakpoint::thread field, this will already
  have been set correctly be calling set_momentary_breakpoint_at_pc.

There should be no user visible changes after this commit.
gdb/infrun.c