* Automatic white-space cleanup.

* Handle the new B_DEBUGGER_MESSAGE_HANDED_OVER and pick the "causing thread"
  as our first victim. Fixes #2956.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29303 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold
2009-02-23 23:02:28 +00:00
parent e1975d3353
commit 1e525344d6
+24 -2
View File
@@ -1008,7 +1008,7 @@ haiku_child_resume (ptid_t ptid, int step, enum target_signal sig)
static ptid_t static ptid_t
haiku_child_wait_internal (team_debug_info *teamDebugInfo, ptid_t ptid, haiku_child_wait_internal (team_debug_info *teamDebugInfo, ptid_t ptid,
struct target_waitstatus *ourstatus, bool *ignore) struct target_waitstatus *ourstatus, bool *ignore, bool *selectThread)
{ {
team_id teamID = ptid_get_pid(ptid); team_id teamID = ptid_get_pid(ptid);
team_id threadID = ptid_get_tid(ptid); team_id threadID = ptid_get_tid(ptid);
@@ -1019,6 +1019,8 @@ haiku_child_wait_internal (team_debug_info *teamDebugInfo, ptid_t ptid,
pending_signal_status pendingSignalStatus = SIGNAL_FAKED; pending_signal_status pendingSignalStatus = SIGNAL_FAKED;
int reprocessEvent = -1; int reprocessEvent = -1;
*selectThread = false;
if (teamID < 0 || threadID == 0) if (teamID < 0 || threadID == 0)
threadID = -1; threadID = -1;
@@ -1253,6 +1255,23 @@ TRACE(("haiku_child_wait_internal(): B_APP_IMAGE created, reprocess -> exec\n"))
ourstatus->value.integer = 0; ourstatus->value.integer = 0;
break; break;
case B_DEBUGGER_MESSAGE_HANDED_OVER:
{
TRACE(("haiku_child_wait_internal(): B_DEBUGGER_MESSAGE_HANDED_OVER: causing "
"thread: %ld\n", event->data.handed_over.causing_thread));
// The debugged team has been handed over to us by another debugger
// (likely the debug server). This event also tells us, which
// thread has caused the original debugger to be installed (if any).
// So, if we're not looking for any particular thread, select that
// thread.
if (threadID < 0 && event->data.handed_over.causing_thread >= 0) {
*selectThread = true;
retval = ptid_build(event->data.origin.team, 0,
event->data.handed_over.causing_thread);
}
*ignore = true;
}
default: default:
// unknown message, ignore // unknown message, ignore
*ignore = true; *ignore = true;
@@ -1294,13 +1313,16 @@ haiku_child_wait (ptid_t ptid, struct target_waitstatus *ourstatus)
{ {
ptid_t retval; ptid_t retval;
bool ignore = true; bool ignore = true;
bool selectThread = false;
TRACE(("haiku_child_wait(`%s', %p)\n", TRACE(("haiku_child_wait(`%s', %p)\n",
haiku_pid_to_str(ptid), ourstatus)); haiku_pid_to_str(ptid), ourstatus));
do { do {
retval = haiku_child_wait_internal(&sTeamDebugInfo, ptid, ourstatus, retval = haiku_child_wait_internal(&sTeamDebugInfo, ptid, ourstatus,
&ignore); &ignore, &selectThread);
if (selectThread)
ptid = retval;
} while (ignore); } while (ignore);
TRACE(("haiku_child_wait() done: `%s'\n", haiku_pid_to_str(retval))); TRACE(("haiku_child_wait() done: `%s'\n", haiku_pid_to_str(retval)));