The debug nub port of a debugged team is owned by the debugger. Hence we

need to transfer the ownership, when handing over the team to another
debugger.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13696 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold
2005-07-16 21:04:22 +00:00
parent e8a110090c
commit d3bdf71ea6
+15 -2
View File
@@ -1840,6 +1840,7 @@ install_team_debugger(team_id teamID, port_id debuggerPort, bool useDefault,
bool done = false;
port_id result = B_ERROR;
bool handOver = false;
bool releaseDebugInfoLock = true;
port_id oldDebuggerPort = -1;
port_id nubPort = -1;
@@ -1877,8 +1878,20 @@ install_team_debugger(team_id teamID, port_id debuggerPort, bool useDefault,
debuggerPort, nubPort, team->debug_info.nub_thread,
team->debug_info.debugger_write_lock);
releaseDebugInfoLock = false;
handOver = true;
done = true;
// finally set the new port owner
if (set_port_owner(nubPort, debuggerTeam) != B_OK) {
// The old debugger must just have died. Just proceed as
// if there was no debugger installed. We may still be too
// early, in which case we'll fail, but this race condition
// should be unbelievably rare and relatively harmless.
handOver = false;
done = false;
}
} else {
// there's already a debugger installed
error = (dontFail ? B_OK : B_BAD_VALUE);
@@ -1887,8 +1900,8 @@ install_team_debugger(team_id teamID, port_id debuggerPort, bool useDefault,
}
}
// in case of a handover the lock is already released
if (!handOver)
// in case of a handover the lock has already been released
if (releaseDebugInfoLock)
RELEASE_TEAM_DEBUG_INFO_LOCK(team->debug_info);
} else
error = B_BAD_TEAM_ID;