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:
@@ -1840,6 +1840,7 @@ install_team_debugger(team_id teamID, port_id debuggerPort, bool useDefault,
|
|||||||
bool done = false;
|
bool done = false;
|
||||||
port_id result = B_ERROR;
|
port_id result = B_ERROR;
|
||||||
bool handOver = false;
|
bool handOver = false;
|
||||||
|
bool releaseDebugInfoLock = true;
|
||||||
port_id oldDebuggerPort = -1;
|
port_id oldDebuggerPort = -1;
|
||||||
port_id nubPort = -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,
|
debuggerPort, nubPort, team->debug_info.nub_thread,
|
||||||
team->debug_info.debugger_write_lock);
|
team->debug_info.debugger_write_lock);
|
||||||
|
|
||||||
|
releaseDebugInfoLock = false;
|
||||||
handOver = true;
|
handOver = true;
|
||||||
done = 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 {
|
} else {
|
||||||
// there's already a debugger installed
|
// there's already a debugger installed
|
||||||
error = (dontFail ? B_OK : B_BAD_VALUE);
|
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
|
// in case of a handover the lock has already been released
|
||||||
if (!handOver)
|
if (releaseDebugInfoLock)
|
||||||
RELEASE_TEAM_DEBUG_INFO_LOCK(team->debug_info);
|
RELEASE_TEAM_DEBUG_INFO_LOCK(team->debug_info);
|
||||||
} else
|
} else
|
||||||
error = B_BAD_TEAM_ID;
|
error = B_BAD_TEAM_ID;
|
||||||
|
|||||||
Reference in New Issue
Block a user