mirror of
https://gitlab.com/sortix/sortix.git
synced 2023-02-13 20:55:38 -05:00
Let kernel debugger know how it was invoked.
This commit is contained in:
parent
6b4dbe0358
commit
12eaf46873
4 changed files with 10 additions and 10 deletions
|
@ -51,7 +51,7 @@ namespace Debugger {
|
|||
|
||||
uint16_t* const VIDEO_MEMORY = (uint16_t*) 0xB8000;
|
||||
|
||||
bool first_f10;
|
||||
bool ignore_next_f10;
|
||||
static int column;
|
||||
static int row;
|
||||
static Thread* current_thread;
|
||||
|
@ -258,12 +258,12 @@ void ReadCommand(char* buffer, size_t buffer_length)
|
|||
|
||||
if ( !written && kbkey == -KBKEY_F10 )
|
||||
{
|
||||
if ( !first_f10 )
|
||||
if ( !ignore_next_f10 )
|
||||
{
|
||||
strncpy(buffer, "exit", buffer_length);
|
||||
break;
|
||||
}
|
||||
first_f10 = false;
|
||||
ignore_next_f10 = false;
|
||||
}
|
||||
|
||||
// Translate the keystroke into unicode.
|
||||
|
@ -604,7 +604,7 @@ bool RunCommand()
|
|||
return true;
|
||||
}
|
||||
|
||||
void Run()
|
||||
void Run(bool entered_through_keyboard)
|
||||
{
|
||||
static uint16_t saved_video_memory[80*25];
|
||||
|
||||
|
@ -612,7 +612,7 @@ void Run()
|
|||
|
||||
bool was_enabled = Interrupt::SetEnabled(false);
|
||||
|
||||
first_f10 = true;
|
||||
ignore_next_f10 = entered_through_keyboard;
|
||||
|
||||
addr_t saved_addrspace = current_thread->registers.cr3;
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*******************************************************************************
|
||||
|
||||
Copyright(C) Jonas 'Sortie' Termansen 2013.
|
||||
Copyright(C) Jonas 'Sortie' Termansen 2013, 2014.
|
||||
|
||||
This file is part of Sortix.
|
||||
|
||||
|
@ -28,7 +28,7 @@
|
|||
namespace Sortix {
|
||||
namespace Debugger {
|
||||
|
||||
void Run();
|
||||
void Run(bool entered_through_keyboard);
|
||||
|
||||
} // namespace Debugger
|
||||
} // namespace Sortix
|
||||
|
|
|
@ -107,7 +107,7 @@ void PS2Keyboard::OnInterrupt(struct interrupt_context* intctx)
|
|||
if ( scancode == KBKEY_F10 )
|
||||
{
|
||||
Scheduler::SaveInterruptedContext(intctx, &CurrentThread()->registers);
|
||||
Debugger::Run();
|
||||
Debugger::Run(true);
|
||||
}
|
||||
PS2KeyboardWork work;
|
||||
work.scancode = scancode;
|
||||
|
|
|
@ -282,7 +282,7 @@ void KernelCrashHandler(struct interrupt_context* intctx)
|
|||
|
||||
// Possibly switch to the kernel debugger in event of a crash.
|
||||
if ( RUN_DEBUGGER_ON_KERNEL_CRASH )
|
||||
Debugger::Run();
|
||||
Debugger::Run(false);
|
||||
|
||||
// Panic the kernel with a diagnostic message.
|
||||
PanicF("Unhandled CPU Exception id %zu `%s' at ip=0x%zx (cr2=0x%zx, "
|
||||
|
@ -316,7 +316,7 @@ void UserCrashHandler(struct interrupt_context* intctx)
|
|||
|
||||
// Possibly switch to the kernel debugger in event of a crash.
|
||||
if ( RUN_DEBUGGER_ON_USER_CRASH )
|
||||
Debugger::Run();
|
||||
Debugger::Run(false);
|
||||
|
||||
// Issue a diagnostic message to the kernel log concerning the crash.
|
||||
Log::PrintF("The current process (pid %ji `%s') crashed and was terminated:\n",
|
||||
|
|
Loading…
Reference in a new issue