From ebac278f8f8562dec5674370618ea415fe5e0667 Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Sat, 12 Mar 2005 21:55:03 +0000 Subject: [PATCH] Some simplifications. Also tried to get rid of the ostensible error condition when the traced team exits, but this seems to be a inherent problem. The thread that calls _kern_exit_team() apparently still manages to send the post-syscall message, but when the debugger tries to continue it, it is already gone. Not really harmful. We'll probably find a remedy later. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@11706 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/bin/strace/strace.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/apps/bin/strace/strace.cpp b/src/apps/bin/strace/strace.cpp index fc803cf017..5ee0e22fce 100644 --- a/src/apps/bin/strace/strace.cpp +++ b/src/apps/bin/strace/strace.cpp @@ -508,11 +508,9 @@ main(int argc, const char *const *argv) exit(1); } - thread_id concernedThread = -1; switch (code) { case B_DEBUGGER_MESSAGE_POST_SYSCALL: { - concernedThread = message.origin.thread; print_syscall(message.post_syscall, memoryReader, printArguments, !fastMode, printReturnValues, colorize); @@ -522,11 +520,11 @@ main(int argc, const char *const *argv) case B_DEBUGGER_MESSAGE_THREAD_STOPPED: case B_DEBUGGER_MESSAGE_PRE_SYSCALL: case B_DEBUGGER_MESSAGE_SIGNAL_RECEIVED: + case B_DEBUGGER_MESSAGE_EXCEPTION_OCCURRED: case B_DEBUGGER_MESSAGE_TEAM_CREATED: case B_DEBUGGER_MESSAGE_THREAD_CREATED: case B_DEBUGGER_MESSAGE_IMAGE_CREATED: case B_DEBUGGER_MESSAGE_IMAGE_DELETED: - concernedThread = message.origin.thread; break; case B_DEBUGGER_MESSAGE_THREAD_DELETED: @@ -538,10 +536,10 @@ main(int argc, const char *const *argv) exit(0); } - // tell the thread to continue - if (concernedThread >= 0) { - run_thread(nubPort, concernedThread); - } + // tell the thread to continue (only when there is a thread and the + // message was synchronous) + if (message.origin.thread >= 0 && message.origin.nub_port >= 0) + run_thread(message.origin.nub_port, message.origin.thread); } return 0;