Added function dprintf_no_syslog(). It is basically equivalent to
dprintf() with the exception that it doesn't write anything to the syslog. The reason is that syslog_write() releases a semaphore and can therefore not be invoked when the thread spinlock is held. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22428 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -9,7 +9,7 @@
|
|||||||
#define _KERNEL_DEBUG_H
|
#define _KERNEL_DEBUG_H
|
||||||
|
|
||||||
|
|
||||||
#include <OS.h>
|
#include <KernelExport.h>
|
||||||
|
|
||||||
#define KDEBUG 1
|
#define KDEBUG 1
|
||||||
|
|
||||||
@@ -27,7 +27,7 @@
|
|||||||
#define ASSERT_ALWAYS_PRINT(x, format...) \
|
#define ASSERT_ALWAYS_PRINT(x, format...) \
|
||||||
do { \
|
do { \
|
||||||
if (!(x)) { \
|
if (!(x)) { \
|
||||||
dprintf(format); \
|
dprintf_no_syslog(format); \
|
||||||
panic("ASSERT FAILED (%s:%d): %s\n", __FILE__, __LINE__, #x); \
|
panic("ASSERT FAILED (%s:%d): %s\n", __FILE__, __LINE__, #x); \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
@@ -56,6 +56,9 @@ extern void debug_puts(const char *s, int32 length);
|
|||||||
extern bool debug_debugger_running(void);
|
extern bool debug_debugger_running(void);
|
||||||
extern void debug_stop_screen_debug_output(void);
|
extern void debug_stop_screen_debug_output(void);
|
||||||
|
|
||||||
|
extern void dprintf_no_syslog(const char *format, ...)
|
||||||
|
__attribute__ ((format (__printf__, 1, 2)));
|
||||||
|
|
||||||
extern void _user_debug_output(const char *userString);
|
extern void _user_debug_output(const char *userString);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|||||||
@@ -972,16 +972,12 @@ check_pending_repeats(void *data, int iter)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
static void
|
||||||
dprintf(const char *format, ...)
|
dprintf_args(const char *format, va_list args, bool syslogOutput)
|
||||||
{
|
{
|
||||||
cpu_status state;
|
cpu_status state;
|
||||||
va_list args;
|
|
||||||
int32 length;
|
int32 length;
|
||||||
|
|
||||||
if (!sSerialDebugEnabled && !sSyslogOutputEnabled && !sBlueScreenEnabled)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// ToDo: maybe add a non-interrupt buffer and path that only
|
// ToDo: maybe add a non-interrupt buffer and path that only
|
||||||
// needs to acquire a semaphore instead of needing to disable
|
// needs to acquire a semaphore instead of needing to disable
|
||||||
// interrupts?
|
// interrupts?
|
||||||
@@ -989,9 +985,7 @@ dprintf(const char *format, ...)
|
|||||||
state = disable_interrupts();
|
state = disable_interrupts();
|
||||||
acquire_spinlock(&sSpinlock);
|
acquire_spinlock(&sSpinlock);
|
||||||
|
|
||||||
va_start(args, format);
|
|
||||||
length = vsnprintf(sOutputBuffer, OUTPUT_BUFFER_SIZE, format, args);
|
length = vsnprintf(sOutputBuffer, OUTPUT_BUFFER_SIZE, format, args);
|
||||||
va_end(args);
|
|
||||||
|
|
||||||
if (length >= OUTPUT_BUFFER_SIZE)
|
if (length >= OUTPUT_BUFFER_SIZE)
|
||||||
length = OUTPUT_BUFFER_SIZE - 1;
|
length = OUTPUT_BUFFER_SIZE - 1;
|
||||||
@@ -1005,7 +999,7 @@ dprintf(const char *format, ...)
|
|||||||
|
|
||||||
if (sSerialDebugEnabled)
|
if (sSerialDebugEnabled)
|
||||||
arch_debug_serial_puts(sOutputBuffer);
|
arch_debug_serial_puts(sOutputBuffer);
|
||||||
if (sSyslogOutputEnabled)
|
if (syslogOutput)
|
||||||
syslog_write(sOutputBuffer, length);
|
syslog_write(sOutputBuffer, length);
|
||||||
if (sBlueScreenEnabled || sDebugScreenEnabled)
|
if (sBlueScreenEnabled || sDebugScreenEnabled)
|
||||||
blue_screen_puts(sOutputBuffer);
|
blue_screen_puts(sOutputBuffer);
|
||||||
@@ -1019,6 +1013,34 @@ dprintf(const char *format, ...)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
dprintf(const char *format, ...)
|
||||||
|
{
|
||||||
|
va_list args;
|
||||||
|
|
||||||
|
if (!sSerialDebugEnabled && !sSyslogOutputEnabled && !sBlueScreenEnabled)
|
||||||
|
return;
|
||||||
|
|
||||||
|
va_start(args, format);
|
||||||
|
dprintf_args(format, args, sSyslogOutputEnabled);
|
||||||
|
va_end(args);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
dprintf_no_syslog(const char *format, ...)
|
||||||
|
{
|
||||||
|
va_list args;
|
||||||
|
|
||||||
|
if (!sSerialDebugEnabled && !sBlueScreenEnabled)
|
||||||
|
return;
|
||||||
|
|
||||||
|
va_start(args, format);
|
||||||
|
dprintf_args(format, args, false);
|
||||||
|
va_end(args);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/** Similar to dprintf() but thought to be used in the kernel
|
/** Similar to dprintf() but thought to be used in the kernel
|
||||||
* debugger only (it doesn't lock).
|
* debugger only (it doesn't lock).
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user