From 5c056f9f10a01a9349678a7da4377118d3bb5c44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Thu, 22 Oct 2009 16:10:28 +0000 Subject: [PATCH] * set_port_owner() was the only usable call of the port API, and of course it was used this way in the debugger. Doing this later should be harmless, AFAICT, but Ingo will probably know better. * Beware, though, the debugger currently does not work anymore. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33730 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/system/kernel/debug/user_debugger.cpp | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/system/kernel/debug/user_debugger.cpp b/src/system/kernel/debug/user_debugger.cpp index 2de1c3221e..4f62349503 100644 --- a/src/system/kernel/debug/user_debugger.cpp +++ b/src/system/kernel/debug/user_debugger.cpp @@ -2512,6 +2512,7 @@ install_team_debugger(team_id teamID, port_id debuggerPort, bool releaseDebugInfoLock = true; port_id oldDebuggerPort = -1; port_id nubPort = -1; + bool handOverPort = false; cpu_status state = disable_interrupts(); GRAB_TEAM_DEBUG_INFO_LOCK(team->debug_info); @@ -2546,16 +2547,7 @@ install_team_debugger(team_id teamID, port_id debuggerPort, 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; - } + handOverPort = true; } } else { // there's already a debugger installed @@ -2576,6 +2568,15 @@ install_team_debugger(team_id teamID, port_id debuggerPort, restore_interrupts(state); + if (handOverPort && 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; + } + if (handOver) { // prepare the handed-over message debug_handed_over notification;