kernel/debug: Set sDebuggerOnCPU as soon as possible.
This variable is what debug_debugger_running() checks to determine if the debugger is in fact running. Before this commit, it was not set until *after* calling debugger module hooks; now it is called before them. This fixes #17302. The problem there was that the USB stack gained an ASSERT(debug_debugger_running()) in code that is called in the USB keyboard debug module initialization, which before this commit would trip, and then enter an infinite loop as panic() does not work during debugger startup. Now the assert is true and everything works as it did before.
This commit is contained in:
parent
69880fc7cb
commit
ea7b7a5408
@ -941,7 +941,7 @@ kernel_debugger_loop(const char* messagePrefix, const char* message,
|
||||
|
||||
|
||||
static void
|
||||
enter_kernel_debugger(int32 cpu)
|
||||
enter_kernel_debugger(int32 cpu, int32& previousCPU)
|
||||
{
|
||||
while (atomic_add(&sInDebugger, 1) > 0) {
|
||||
atomic_add(&sInDebugger, -1);
|
||||
@ -970,6 +970,9 @@ enter_kernel_debugger(int32 cpu)
|
||||
0, NULL, SMP_MSG_FLAG_SYNC);
|
||||
}
|
||||
|
||||
previousCPU = sDebuggerOnCPU;
|
||||
sDebuggerOnCPU = cpu;
|
||||
|
||||
if (sBlueScreenOutput) {
|
||||
if (blue_screen_enter(false) == B_OK)
|
||||
sBlueScreenEnabled = true;
|
||||
@ -1021,15 +1024,17 @@ kernel_debugger_internal(const char* messagePrefix, const char* message,
|
||||
va_list args, int32 cpu)
|
||||
{
|
||||
while (true) {
|
||||
// If we're called recursively sDebuggerOnCPU will be != -1.
|
||||
int32 previousCPU = -1;
|
||||
|
||||
if (sHandOverKDLToCPU == cpu) {
|
||||
sHandOverKDLToCPU = -1;
|
||||
sHandOverKDL = false;
|
||||
} else
|
||||
enter_kernel_debugger(cpu);
|
||||
|
||||
// If we're called recursively sDebuggerOnCPU will be != -1.
|
||||
int32 previousCPU = sDebuggerOnCPU;
|
||||
sDebuggerOnCPU = cpu;
|
||||
previousCPU = sDebuggerOnCPU;
|
||||
sDebuggerOnCPU = cpu;
|
||||
} else
|
||||
enter_kernel_debugger(cpu, previousCPU);
|
||||
|
||||
kernel_debugger_loop(messagePrefix, message, args, cpu);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user