Introduced a separate flag for indicating that disable_debugger() had
been called for a team, and fail installing the default debugger if it is set. This makes disable_debugger() actually work. Fixes bug #2763. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27713 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -122,6 +122,7 @@ struct thread_debug_info {
|
|||||||
enum {
|
enum {
|
||||||
B_TEAM_DEBUG_DEBUGGER_INSTALLED = 0x0001,
|
B_TEAM_DEBUG_DEBUGGER_INSTALLED = 0x0001,
|
||||||
B_TEAM_DEBUG_DEBUGGER_HANDOVER = 0x0002,
|
B_TEAM_DEBUG_DEBUGGER_HANDOVER = 0x0002,
|
||||||
|
B_TEAM_DEBUG_DEBUGGER_DISABLED = 0x0004,
|
||||||
|
|
||||||
B_TEAM_DEBUG_KERNEL_FLAG_MASK = 0xffff,
|
B_TEAM_DEBUG_KERNEL_FLAG_MASK = 0xffff,
|
||||||
|
|
||||||
|
|||||||
@@ -2555,6 +2555,11 @@ install_team_debugger(team_id teamID, port_id debuggerPort, bool useDefault,
|
|||||||
done = true;
|
done = true;
|
||||||
result = team->debug_info.nub_port;
|
result = team->debug_info.nub_port;
|
||||||
}
|
}
|
||||||
|
} else if ((teamDebugFlags & B_TEAM_DEBUG_DEBUGGER_DISABLED) != 0
|
||||||
|
&& useDefault) {
|
||||||
|
// No debugger yet, disable_debugger() had been invoked, and we
|
||||||
|
// would install the default debugger. Just fail.
|
||||||
|
error = B_BAD_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// in case of a handover the lock has already been released
|
// in case of a handover the lock has already been released
|
||||||
@@ -2732,20 +2737,25 @@ _user_disable_debugger(int state)
|
|||||||
{
|
{
|
||||||
struct team *team = thread_get_current_thread()->team;
|
struct team *team = thread_get_current_thread()->team;
|
||||||
|
|
||||||
|
TRACE(("_user_disable_debugger(%d): team: %ld\n", state, team->id));
|
||||||
|
|
||||||
cpu_status cpuState = disable_interrupts();
|
cpu_status cpuState = disable_interrupts();
|
||||||
GRAB_TEAM_DEBUG_INFO_LOCK(team->debug_info);
|
GRAB_TEAM_DEBUG_INFO_LOCK(team->debug_info);
|
||||||
|
|
||||||
int32 oldFlags;
|
int32 oldFlags;
|
||||||
if (state)
|
if (state) {
|
||||||
oldFlags = atomic_and(&team->debug_info.flags, ~B_TEAM_DEBUG_SIGNALS);
|
oldFlags = atomic_or(&team->debug_info.flags,
|
||||||
else
|
B_TEAM_DEBUG_DEBUGGER_DISABLED);
|
||||||
oldFlags = atomic_or(&team->debug_info.flags, B_TEAM_DEBUG_SIGNALS);
|
} else {
|
||||||
|
oldFlags = atomic_and(&team->debug_info.flags,
|
||||||
|
~B_TEAM_DEBUG_DEBUGGER_DISABLED);
|
||||||
|
}
|
||||||
|
|
||||||
RELEASE_TEAM_DEBUG_INFO_LOCK(team->debug_info);
|
RELEASE_TEAM_DEBUG_INFO_LOCK(team->debug_info);
|
||||||
restore_interrupts(cpuState);
|
restore_interrupts(cpuState);
|
||||||
|
|
||||||
// TODO: Check, if the return value is really the old state.
|
// TODO: Check, if the return value is really the old state.
|
||||||
return !(oldFlags & B_TEAM_DEBUG_SIGNALS);
|
return !(oldFlags & B_TEAM_DEBUG_DEBUGGER_DISABLED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user