Let kernel debugger know how it was invoked.

This commit is contained in:
Jonas 'Sortie' Termansen 2014-04-12 23:31:21 +02:00
parent 6b4dbe0358
commit 12eaf46873
4 changed files with 10 additions and 10 deletions

View File

@ -51,7 +51,7 @@ namespace Debugger {
uint16_t* const VIDEO_MEMORY = (uint16_t*) 0xB8000; uint16_t* const VIDEO_MEMORY = (uint16_t*) 0xB8000;
bool first_f10; bool ignore_next_f10;
static int column; static int column;
static int row; static int row;
static Thread* current_thread; static Thread* current_thread;
@ -258,12 +258,12 @@ void ReadCommand(char* buffer, size_t buffer_length)
if ( !written && kbkey == -KBKEY_F10 ) if ( !written && kbkey == -KBKEY_F10 )
{ {
if ( !first_f10 ) if ( !ignore_next_f10 )
{ {
strncpy(buffer, "exit", buffer_length); strncpy(buffer, "exit", buffer_length);
break; break;
} }
first_f10 = false; ignore_next_f10 = false;
} }
// Translate the keystroke into unicode. // Translate the keystroke into unicode.
@ -604,7 +604,7 @@ bool RunCommand()
return true; return true;
} }
void Run() void Run(bool entered_through_keyboard)
{ {
static uint16_t saved_video_memory[80*25]; static uint16_t saved_video_memory[80*25];
@ -612,7 +612,7 @@ void Run()
bool was_enabled = Interrupt::SetEnabled(false); bool was_enabled = Interrupt::SetEnabled(false);
first_f10 = true; ignore_next_f10 = entered_through_keyboard;
addr_t saved_addrspace = current_thread->registers.cr3; addr_t saved_addrspace = current_thread->registers.cr3;

View File

@ -1,6 +1,6 @@
/******************************************************************************* /*******************************************************************************
Copyright(C) Jonas 'Sortie' Termansen 2013. Copyright(C) Jonas 'Sortie' Termansen 2013, 2014.
This file is part of Sortix. This file is part of Sortix.
@ -28,7 +28,7 @@
namespace Sortix { namespace Sortix {
namespace Debugger { namespace Debugger {
void Run(); void Run(bool entered_through_keyboard);
} // namespace Debugger } // namespace Debugger
} // namespace Sortix } // namespace Sortix

View File

@ -107,7 +107,7 @@ void PS2Keyboard::OnInterrupt(struct interrupt_context* intctx)
if ( scancode == KBKEY_F10 ) if ( scancode == KBKEY_F10 )
{ {
Scheduler::SaveInterruptedContext(intctx, &CurrentThread()->registers); Scheduler::SaveInterruptedContext(intctx, &CurrentThread()->registers);
Debugger::Run(); Debugger::Run(true);
} }
PS2KeyboardWork work; PS2KeyboardWork work;
work.scancode = scancode; work.scancode = scancode;

View File

@ -282,7 +282,7 @@ void KernelCrashHandler(struct interrupt_context* intctx)
// Possibly switch to the kernel debugger in event of a crash. // Possibly switch to the kernel debugger in event of a crash.
if ( RUN_DEBUGGER_ON_KERNEL_CRASH ) if ( RUN_DEBUGGER_ON_KERNEL_CRASH )
Debugger::Run(); Debugger::Run(false);
// Panic the kernel with a diagnostic message. // Panic the kernel with a diagnostic message.
PanicF("Unhandled CPU Exception id %zu `%s' at ip=0x%zx (cr2=0x%zx, " 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. // Possibly switch to the kernel debugger in event of a crash.
if ( RUN_DEBUGGER_ON_USER_CRASH ) if ( RUN_DEBUGGER_ON_USER_CRASH )
Debugger::Run(); Debugger::Run(false);
// Issue a diagnostic message to the kernel log concerning the crash. // Issue a diagnostic message to the kernel log concerning the crash.
Log::PrintF("The current process (pid %ji `%s') crashed and was terminated:\n", Log::PrintF("The current process (pid %ji `%s') crashed and was terminated:\n",