diff options
Diffstat (limited to 'winsup')
-rw-r--r-- | winsup/utils/ChangeLog | 8 | ||||
-rw-r--r-- | winsup/utils/ps.cc | 2 | ||||
-rw-r--r-- | winsup/utils/strace.cc | 15 |
3 files changed, 22 insertions, 3 deletions
diff --git a/winsup/utils/ChangeLog b/winsup/utils/ChangeLog index e852946..24ef18a 100644 --- a/winsup/utils/ChangeLog +++ b/winsup/utils/ChangeLog @@ -1,3 +1,11 @@ +2005-01-16 Christopher Faylor <cgf@timesys.com> + + * ps.cc (main): Eliminate use of PID_ZOMBIE. + * strace.cc (main): Recognize new option for displaying hex value of + strace type. + (handle_output_debug_string): Prepend output with hex value of strace + message if -H is specified. + 2005-01-11 Pierre Humblet <pierre.humblet@ieee.org> * mkpasswd.c (print_win_error): Transform into macro. diff --git a/winsup/utils/ps.cc b/winsup/utils/ps.cc index 8436935..12b60fd 100644 --- a/winsup/utils/ps.cc +++ b/winsup/utils/ps.cc @@ -345,7 +345,7 @@ main (int argc, char *argv[]) status = 'O'; char pname[MAX_PATH]; - if (p->process_state & (PID_ZOMBIE | PID_EXITED)) + if (p->process_state & PID_EXITED || (p->exitcode & ~0xffff)) strcpy (pname, "<defunct>"); else if (p->ppid) { diff --git a/winsup/utils/strace.cc b/winsup/utils/strace.cc index 40300a4..747880c 100644 --- a/winsup/utils/strace.cc +++ b/winsup/utils/strace.cc @@ -41,6 +41,7 @@ static int hhmmss = 0; static int bufsize = 0; static int new_window = 0; static long flush_period = 0; +static int include_hex = 0; static BOOL close_handle (HANDLE h, DWORD ok); @@ -426,7 +427,7 @@ handle_output_debug_string (DWORD id, LPVOID p, unsigned mask, FILE *ofile) } char *buf; - buf = (char *) alloca (len + 65) + 10; + buf = (char *) alloca (len + 85) + 20; if (!ReadProcessMemory (hchild, ((char *) p) + INTROLEN, buf, len, &nbytes)) error (0, "couldn't get message from subprocess, windows error %d", @@ -558,6 +559,12 @@ handle_output_debug_string (DWORD id, LPVOID p, unsigned mask, FILE *ofile) memcpy ((s -= len), intbuf, len); } + if (include_hex) + { + s -= 8; + sprintf (s, "%p", n); + strchr (s, '\0')[0] = ' '; + } child->last_usecs = usecs; if (numerror || !output_winerror (ofile, s)) fputs (s, ofile); @@ -850,6 +857,7 @@ struct option longopts[] = { {"buffer-size", required_argument, NULL, 'b'}, {"help", no_argument, NULL, 'h'}, {"flush-period", required_argument, NULL, 'S'}, + {"hex", no_argument, NULL, 'H'}, {"mask", required_argument, NULL, 'm'}, {"new-window", no_argument, NULL, 'w'}, {"output", required_argument, NULL, 'o'}, @@ -864,7 +872,7 @@ struct option longopts[] = { {NULL, 0, NULL, 0} }; -static const char *const opts = "+b:dhfm:no:p:S:tTuvw"; +static const char *const opts = "+b:dhHfm:no:p:S:tTuvw"; static void print_version () @@ -919,6 +927,9 @@ main (int argc, char **argv) // Print help and exit usage (stdout); break; + case 'H': + include_hex ^= 1; + break; case 'm': { char *endptr; |