From: Mark Kettenis <kettenis@wins.uva.nl>
To: gdb-patches@sources.redhat.com
Subject: lin-lwp.c debug messages improvement
Date: Sat, 07 Jul 2001 04:03:00 -0000 [thread overview]
Message-ID: <200107071103.f67B3hR13346@delius.kettenis.local> (raw)
Checked in.
Index: ChangeLog
from Mark Kettenis <kettenis@gnu.org>
* lin-lwp.c (status_to_str): New function.
(lin_lwp_wait): Use it to print debug messages where appropriate.
Index: lin-lwp.c
===================================================================
RCS file: /cvs/src/src/gdb/lin-lwp.c,v
retrieving revision 1.26
diff -u -p -r1.26 lin-lwp.c
--- lin-lwp.c 2001/07/06 22:31:47 1.26
+++ lin-lwp.c 2001/07/07 10:57:14
@@ -153,7 +153,27 @@ static sigset_t blocked_mask;
/* Prototypes for local functions. */
static int stop_wait_callback (struct lwp_info *lp, void *data);
\f
+/* Convert wait status STATUS to a string. Used for printing debug
+ messages only. */
+static char *
+status_to_str (int status)
+{
+ static char buf[64];
+
+ if (WIFSTOPPED (status))
+ snprintf (buf, sizeof (buf), "%s (stopped)",
+ strsignal (WSTOPSIG (status)));
+ else if (WIFSIGNALED (status))
+ snprintf (buf, sizeof (buf), "%s (terminated)",
+ strsignal (WSTOPSIG (status)));
+ else
+ snprintf (buf, sizeof (buf), "%d (exited)",
+ WEXITSTATUS (status));
+
+ return buf;
+}
+\f
/* Initialize the list of LWPs. Note that this module, contrary to
what GDB's generic threads layer does for its thread list,
re-initializes the LWP lists whenever we mourn or detach (which
@@ -901,11 +921,9 @@ lin_lwp_wait (ptid_t ptid, struct target
lp->status = 0;
if (debug_lin_lwp && status)
- fprintf_unfiltered (gdb_stdlog,
- "Using pending wait status %d for LWP %ld.\n",
- WIFSTOPPED (status) ? WSTOPSIG (status) :
- WIFSIGNALED (status) ? WTERMSIG (status) :
- WEXITSTATUS (status), GET_LWP (lp->ptid));
+ fprintf_unfiltered (gdb_stdlog,
+ "Using pending wait status %s for LWP %ld.\n",
+ status_to_str (status), GET_LWP (lp->ptid));
}
/* But if we don't fine one, we'll have to wait, and check both
@@ -927,11 +945,9 @@ lin_lwp_wait (ptid_t ptid, struct target
lp->status = 0;
if (debug_lin_lwp && status)
- fprintf_unfiltered (gdb_stdlog,
- "Using pending wait status %d for LWP %ld.\n",
- WIFSTOPPED (status) ? WSTOPSIG (status) :
- WIFSIGNALED (status) ? WTERMSIG (status) :
- WEXITSTATUS (status), GET_LWP (lp->ptid));
+ fprintf_unfiltered (gdb_stdlog,
+ "Using pending wait status %s for LWP %ld.\n",
+ status_to_str (status), GET_LWP (lp->ptid));
/* If we have to wait, take into account whether PID is a cloned
process or not. And we have to convert it to something that
@@ -1103,9 +1119,8 @@ lin_lwp_wait (ptid_t ptid, struct target
lp->stopped = 1;
if (debug_lin_lwp)
- fprintf_unfiltered (gdb_stdlog,
- "LLW: Candidate event %d in %ld\n",
- WSTOPSIG (status), GET_LWP (lp->ptid));
+ fprintf_unfiltered (gdb_stdlog, "Candidate event %s in LWP %ld.\n",
+ status_to_str (status), GET_LWP (lp->ptid));
/* Now stop all other LWP's ... */
iterate_over_lwps (stop_callback, NULL);
reply other threads:[~2001-07-07 4:03 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200107071103.f67B3hR13346@delius.kettenis.local \
--to=kettenis@wins.uva.nl \
--cc=gdb-patches@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox