diff options
author | Christopher Faylor <me@cgf.cx> | 2005-01-16 17:13:51 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2005-01-16 17:13:51 +0000 |
commit | 459a95619788793541553674eb5bb59888aa7f6a (patch) | |
tree | feb31a6dcdeeac9ba987b8248eb5887bced552b6 /winsup/utils/strace.cc | |
parent | 85b3fb9640eb423a640d86ccc713e91e0872fc8c (diff) | |
download | cygnal-459a95619788793541553674eb5bb59888aa7f6a.tar.gz cygnal-459a95619788793541553674eb5bb59888aa7f6a.tar.bz2 cygnal-459a95619788793541553674eb5bb59888aa7f6a.zip |
* 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.
Diffstat (limited to 'winsup/utils/strace.cc')
-rw-r--r-- | winsup/utils/strace.cc | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/winsup/utils/strace.cc b/winsup/utils/strace.cc index 40300a4a6..747880cbe 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; |