Fix Windows crash from stop_pc change
authorTom Tromey <tromey@adacore.com>
Tue, 28 Sep 2021 19:13:06 +0000 (13:13 -0600)
committerTom Tromey <tromey@adacore.com>
Thu, 30 Sep 2021 17:17:09 +0000 (11:17 -0600)
The "make thread_suspend_state::stop_pc optional" patch caused a
regression on Windows when using shared libraries.  I tracked this
down to an unguarded use of stop_pc() in the TARGET_WAITKIND_LOADED
case of handle_inferior_event.  This patch fixes the bug by ensuring
that the stop PC is set at this point.

gdb/infrun.c

index 5fd1ade7c6844a0379aa338748bc1607e9379d11..af552e0090bce27078266a40d3512dd627146c20 100644 (file)
@@ -5283,6 +5283,7 @@ handle_inferior_event (struct execution_control_state *ecs)
 
            handle_solib_event ();
 
+           ecs->event_thread->set_stop_pc (regcache_read_pc (regcache));
            ecs->event_thread->control.stop_bpstat
              = bpstat_stop_status (regcache->aspace (),
                                    ecs->event_thread->stop_pc (),