[haiku-commits] r35883 - haiku/trunk/src/system/kernel/debug

  • From: ingo_weinhold@xxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Tue, 16 Mar 2010 20:36:54 +0100 (CET)

Author: bonefish
Date: 2010-03-16 20:36:54 +0100 (Tue, 16 Mar 2010)
New Revision: 35883
Changeset: http://dev.haiku-os.org/changeset/35883/haiku

Modified:
   haiku/trunk/src/system/kernel/debug/debug.cpp
Log:
* Write kernel debugger output to the syslog as well. This should make life
  for people who cannot capture serial output easier.
* The syslog sender thread waits with timeout now, so output added to the
  syslog buffer without explicit notification is still written after a few
  seconds at the latest.


Modified: haiku/trunk/src/system/kernel/debug/debug.cpp
===================================================================
--- haiku/trunk/src/system/kernel/debug/debug.cpp       2010-03-16 17:29:58 UTC 
(rev 35882)
+++ haiku/trunk/src/system/kernel/debug/debug.cpp       2010-03-16 19:36:54 UTC 
(rev 35883)
@@ -71,7 +71,9 @@
 
 void call_modules_hook(bool enter);
 
+static void syslog_write(const char* text, int32 length, bool notify);
 
+
 int dbg_register_file[B_MAX_CPU_COUNT][14];
        /* XXXmpetit -- must be made generic */
 
@@ -165,14 +167,18 @@
 void
 DefaultDebugOutputFilter::PrintString(const char* string)
 {
+       size_t length = strlen(string);
+
        if (sSerialDebugEnabled)
                arch_debug_serial_puts(string);
+       if (sSyslogOutputEnabled)
+               syslog_write(string, length, false);
        if (sBlueScreenEnabled || sDebugScreenEnabled)
                blue_screen_puts(string);
 
        for (uint32 i = 0; sSerialDebugEnabled && i < kMaxDebuggerModules; i++) 
{
                if (sDebuggerModules[i] && sDebuggerModules[i]->debugger_puts)
-                       sDebuggerModules[i]->debugger_puts(string, 
strlen(string));
+                       sDebuggerModules[i]->debugger_puts(string, length);
        }
 }
 
@@ -1051,7 +1057,10 @@
 
        while (true) {
                // wait for syslog data to become available
-               acquire_sem(sSyslogNotify);
+               acquire_sem_etc(sSyslogNotify, 1, B_RELATIVE_TIMEOUT, 5000000);
+                       // Note: We time out since in some situations output is 
added to
+                       // the syslog buffer without being allowed to notify us 
(e.g. in
+                       // the kernel debugger).
 
                sSyslogMessage->when = real_time_clock();
 


Other related posts:

  • » [haiku-commits] r35883 - haiku/trunk/src/system/kernel/debug - ingo_weinhold