Two logging fixes to win32-low.cc
Checks
Commit Message
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(-)
base-commit: 6f24afa4391bd33f1263378280b99385d2c13055
Comments
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 (¤t_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
@@ -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 (¤t_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 */