public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Fix Windows crash from stop_pc change
@ 2021-09-29 20:02 Tom Tromey
  2021-09-30 14:35 ` Simon Marchi
  0 siblings, 1 reply; 2+ messages in thread
From: Tom Tromey @ 2021-09-29 20:02 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

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 | 1 +
 1 file changed, 1 insertion(+)

diff --git a/gdb/infrun.c b/gdb/infrun.c
index 5fd1ade7c68..af552e0090b 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -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 (),
-- 
2.31.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Fix Windows crash from stop_pc change
  2021-09-29 20:02 [PATCH] Fix Windows crash from stop_pc change Tom Tromey
@ 2021-09-30 14:35 ` Simon Marchi
  0 siblings, 0 replies; 2+ messages in thread
From: Simon Marchi @ 2021-09-30 14:35 UTC (permalink / raw)
  To: Tom Tromey, gdb-patches

On 2021-09-29 16:02, Tom Tromey via Gdb-patches wrote:
> 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.


It sounds like the change caught an actual (harmless) bug.  Harmless
because breakpoint_hit_catch_solib just checks that ws->kind ==
TARGET_WAITKIND_LOADED, it doesn't care about the bp_addr.  And we were
probably passing 0 previously, which didn't cause another spurious
breakpoint match.

Regardless, I think your change makes things right.

Simon

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-09-30 14:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-29 20:02 [PATCH] Fix Windows crash from stop_pc change Tom Tromey
2021-09-30 14:35 ` Simon Marchi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).