gdb/windows: remove disable_breakpoints_in_shlibs call

I noticed that the disable_breakpoints_in_shlibs function disables
breakpoints without calling notify_breakpoint_modified.  This commit
is one step towards fixing this issue.

There are currently only two uses of disable_breakpoints_in_shlibs,
one in clear_solib (in solib.c), and the other in
windows_nat_target::do_initial_windows_stuff (in windows-nat.c).

I believe that the call in windows-nat.c can be shown to be redundant,
and therefore can be removed.

windows_nat_target::do_initial_windows_stuff is called from two
places: windows_nat_target::attach and
windows_nat_target::create_inferior, these are the target_ops
functions used to attach to a running process, or for creating a new
process, and are only called from attach_command or run_command_1,
both in infcmd.c.

Both attach_command and run_command_1 call target_pre_inferior before
calling the relevant target_ops function.

In target_pre_inferior, so long as the target doesn't have a global
solist (and windows doesn't), we always call no_shared_libraries (from
solib.c), which calls clear_solib (also in solib.c), which in turn
calls disable_breakpoints_in_shlibs.

My claim then, is that, any time we reach the
disable_breakpoints_in_shlibs call in
windows_nat_target::do_initial_windows_stuff, we will have always have
called disable_breakpoints_in_shlibs already via clear_solib.

I think it should be safe to remove the disable_breakpoints_in_shlibs
call from windows_nat_target::do_initial_windows_stuff.  There should
be no user visible changes.

My ultimate goal, which I'll address in follow on commits, is to
delete disable_breakpoints_in_shlibs completely.  Removing this call
means that we only have one disable_breakpoints_in_shlibs call
remaining in GDB.

Testing for this change has been minimal.  My only Windows build
machine is not great, and I've never managed to get DejaGNU running in
that environment.  This commit builds, and a few basic, manual tests
seem fine, but beyond that, this change is untested.

Approved-By: Tom Tromey <tom@tromey.com>
This commit is contained in:
Andrew Burgess 2025-02-24 13:51:29 +00:00
parent 1e9bd86ccd
commit a6bc00ff35

View File

@ -1789,7 +1789,6 @@ windows_nat_target::do_initial_windows_stuff (DWORD pid, bool attaching)
inf = current_inferior ();
if (!inf->target_is_pushed (this))
inf->push_target (this);
disable_breakpoints_in_shlibs (current_program_space);
windows_clear_solib ();
clear_proceed_status (0);
init_wait_for_inferior ();