Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] Two logging fixes to win32-low.cc
@ 2026-09-01 19:24 Tom Tromey
  2026-09-01 19:34 ` Andrew Burgess
  0 siblings, 1 reply; 2+ messages in thread
From: Tom Tromey @ 2026-09-01 19:24 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

While debugging the Windows gdbserver, I found a couple of minor
problems in some logging statements in win32-low.cc.

First, one spot could call target_waitstatus::sig for the wrong kind
of object, resulting in an assertion failure.

Second, the "unknown" logging case can be made a bit nicer by printing
a string rather than an integer.
---
 gdbserver/win32-low.cc | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/gdbserver/win32-low.cc b/gdbserver/win32-low.cc
index 7629beca213..13c14a7c69f 100644
--- a/gdbserver/win32-low.cc
+++ b/gdbserver/win32-low.cc
@@ -1168,8 +1168,11 @@ win32_process_target::wait (ptid_t ptid, target_waitstatus *ourstatus,
 	case TARGET_WAITKIND_SIGNALLED:
 	case TARGET_WAITKIND_LOADED:
 	  {
-	    OUTMSG2 (("Child Stopped with signal = %d \n",
-		      ourstatus->sig ()));
+	    if (ourstatus->kind () == TARGET_WAITKIND_LOADED)
+	      OUTMSG2 (("Child stopped due to library load\n"));
+	    else
+	      OUTMSG2 (("Child stopped with signal = %d \n",
+			ourstatus->sig ()));
 	    maybe_adjust_pc (current_event);
 
 	    /* All-stop, suspend all threads until they are explicitly
@@ -1179,8 +1182,8 @@ win32_process_target::wait (ptid_t ptid, target_waitstatus *ourstatus,
 	    return debug_event_ptid (&current_event);
 	  }
 	default:
-	  OUTMSG (("Ignoring unknown internal event, %d\n",
-		  ourstatus->kind ()));
+	  OUTMSG (("Ignoring unknown internal event, %s\n",
+		   ourstatus->to_string ().c_str ()));
 	  [[fallthrough]];
 	case TARGET_WAITKIND_SPURIOUS:
 	  /* do nothing, just continue */

base-commit: 6f24afa4391bd33f1263378280b99385d2c13055
-- 
2.55.0


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

* Re: [PATCH] Two logging fixes to win32-low.cc
  2026-09-01 19:24 [PATCH] Two logging fixes to win32-low.cc Tom Tromey
@ 2026-09-01 19:34 ` Andrew Burgess
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Burgess @ 2026-09-01 19:34 UTC (permalink / raw)
  To: Tom Tromey, gdb-patches; +Cc: Tom Tromey

Tom Tromey <tromey@adacore.com> writes:

> While debugging the Windows gdbserver, I found a couple of minor
> problems in some logging statements in win32-low.cc.
>
> First, one spot could call target_waitstatus::sig for the wrong kind
> of object, resulting in an assertion failure.
>
> Second, the "unknown" logging case can be made a bit nicer by printing
> a string rather than an integer.

LGTM.

Approved-By: Andrew Burgess <aburgess@redhat.com>

Thanks,
Andrew

> ---
>  gdbserver/win32-low.cc | 11 +++++++----
>  1 file changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/gdbserver/win32-low.cc b/gdbserver/win32-low.cc
> index 7629beca213..13c14a7c69f 100644
> --- a/gdbserver/win32-low.cc
> +++ b/gdbserver/win32-low.cc
> @@ -1168,8 +1168,11 @@ win32_process_target::wait (ptid_t ptid, target_waitstatus *ourstatus,
>  	case TARGET_WAITKIND_SIGNALLED:
>  	case TARGET_WAITKIND_LOADED:
>  	  {
> -	    OUTMSG2 (("Child Stopped with signal = %d \n",
> -		      ourstatus->sig ()));
> +	    if (ourstatus->kind () == TARGET_WAITKIND_LOADED)
> +	      OUTMSG2 (("Child stopped due to library load\n"));
> +	    else
> +	      OUTMSG2 (("Child stopped with signal = %d \n",
> +			ourstatus->sig ()));
>  	    maybe_adjust_pc (current_event);
>  
>  	    /* All-stop, suspend all threads until they are explicitly
> @@ -1179,8 +1182,8 @@ win32_process_target::wait (ptid_t ptid, target_waitstatus *ourstatus,
>  	    return debug_event_ptid (&current_event);
>  	  }
>  	default:
> -	  OUTMSG (("Ignoring unknown internal event, %d\n",
> -		  ourstatus->kind ()));
> +	  OUTMSG (("Ignoring unknown internal event, %s\n",
> +		   ourstatus->to_string ().c_str ()));
>  	  [[fallthrough]];
>  	case TARGET_WAITKIND_SPURIOUS:
>  	  /* do nothing, just continue */
>
> base-commit: 6f24afa4391bd33f1263378280b99385d2c13055
> -- 
> 2.55.0


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

end of thread, other threads:[~2026-09-01 19:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-01 19:24 [PATCH] Two logging fixes to win32-low.cc Tom Tromey
2026-09-01 19:34 ` Andrew Burgess

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox