* Add a serial_input command to the kernel debugger, allows using serial input even when on-screen kdebug is enabled. Usefull for remote debugging. Please review/adjust.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35650 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Alexandre Deckner 2010-02-28 00:50:01 +00:00
parent a4b571a031
commit cd4e946773

View File

@ -82,6 +82,7 @@ static bool sSyslogOutputEnabled = true;
static bool sBlueScreenEnabled = false; static bool sBlueScreenEnabled = false;
// must always be false on startup // must always be false on startup
static bool sDebugScreenEnabled = false; static bool sDebugScreenEnabled = false;
static bool sSerialInputEnabled = false;
static bool sBlueScreenOutput = true; static bool sBlueScreenOutput = true;
static bool sEmergencyKeysEnabled = true; static bool sEmergencyKeysEnabled = true;
static spinlock sSpinlock = B_SPINLOCK_INITIALIZER; static spinlock sSpinlock = B_SPINLOCK_INITIALIZER;
@ -662,6 +663,9 @@ read_line(char* buffer, int32 maxLength,
char char
kgetc(void) kgetc(void)
{ {
if (sSerialInputEnabled)
return arch_debug_serial_getchar();
// give the kernel debugger modules a chance first // give the kernel debugger modules a chance first
for (uint32 i = 0; i < kMaxDebuggerModules; i++) { for (uint32 i = 0; i < kMaxDebuggerModules; i++) {
if (sDebuggerModules[i] && sDebuggerModules[i]->debugger_getchar) { if (sDebuggerModules[i] && sDebuggerModules[i]->debugger_getchar) {
@ -996,6 +1000,16 @@ cmd_dump_syslog(int argc, char** argv)
} }
static int
cmd_serial_input(int argc, char** argv)
{
sSerialInputEnabled = !sSerialInputEnabled;
kprintf("Serial input is turned %s now.\n",
sSerialInputEnabled ? "on" : "off");
return 0;
}
static int static int
cmd_switch_cpu(int argc, char** argv) cmd_switch_cpu(int argc, char** argv)
{ {
@ -1209,6 +1223,9 @@ syslog_init(struct kernel_args* args)
"[-n]\nDumps the whole syslog buffer, or, if -n is specified, only " "[-n]\nDumps the whole syslog buffer, or, if -n is specified, only "
"the part that hasn't been sent yet.\n", 0); "the part that hasn't been sent yet.\n", 0);
add_debugger_command("serial_input", &cmd_serial_input,
"Enable or disable serial input");
return B_OK; return B_OK;
err2: err2: