diff options
author | Christopher Faylor <me@cgf.cx> | 2006-05-24 16:50:50 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2006-05-24 16:50:50 +0000 |
commit | 6265ac10be7c0df26a1f4193de8c16e9ca00b3c4 (patch) | |
tree | 23abc781649a151965fb8d2c9bc89b0f72447bfd /winsup/utils/strace.cc | |
parent | 89af1688ef418fd52f6bfe505fc789c3fc981dba (diff) | |
download | newlib-6265ac10be7c0df26a1f4193de8c16e9ca00b3c4.zip newlib-6265ac10be7c0df26a1f4193de8c16e9ca00b3c4.tar.gz newlib-6265ac10be7c0df26a1f4193de8c16e9ca00b3c4.tar.bz2 |
* strace.cc (proc_child): Propagate return code from child process.
(dostrace): Ditto.
(main): Ditto.
Diffstat (limited to 'winsup/utils/strace.cc')
-rw-r--r-- | winsup/utils/strace.cc | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/winsup/utils/strace.cc b/winsup/utils/strace.cc index 5347b7a..d8a2ed8 100644 --- a/winsup/utils/strace.cc +++ b/winsup/utils/strace.cc @@ -588,9 +588,10 @@ handle_output_debug_string (DWORD id, LPVOID p, unsigned mask, FILE *ofile) fflush (ofile); } -static void +static DWORD proc_child (unsigned mask, FILE *ofile, pid_t pid) { + DWORD res = 0; DEBUG_EVENT ev; time_t cur_time, last_time; @@ -640,6 +641,7 @@ proc_child (unsigned mask, FILE *ofile, pid_t pid) break; case EXIT_PROCESS_DEBUG_EVENT: + res = ev.u.ExitProcess.dwExitCode >> 8; remove_child (ev.dwProcessId); break; case EXCEPTION_DEBUG_EVENT: @@ -659,6 +661,8 @@ proc_child (unsigned mask, FILE *ofile, pid_t pid) if (!processes) break; } + + return res; } static void @@ -676,16 +680,15 @@ dotoggle (pid_t pid) return; } -static void +static DWORD dostrace (unsigned mask, FILE *ofile, pid_t pid, char **argv) { if (!pid) create_child (argv); else attach_process (pid); - proc_child (mask, ofile, pid); - return; + return proc_child (mask, ofile, pid); } typedef struct tag_mask_mnemonic @@ -1035,10 +1038,12 @@ character #%d.\n", optarg, (int) (endptr - optarg), endptr); if (!ofile) ofile = stdout; + DWORD res = 0; if (toggle) dotoggle (pid); else - dostrace (mask, ofile, pid, argv + optind); + res = dostrace (mask, ofile, pid, argv + optind); + return res; } #undef CloseHandle |