mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 18:50:05 +01:00
bitkeeper revision 1.1228 (421803d5d7vOI2phFwJN5YLJZi4dkg)
cleanup.
This commit is contained in:
1 parent
3aea4ed31e
commit
3bef71ecbb
3 files changed
+24
-50
No files matched your search
@@ -158,11 +158,10 @@ void do_debug_key(unsigned char key, struct xen_regs *regs)
|
||||
#ifndef NDEBUG
|
||||
void debugtrace_key(unsigned char key)
|
||||
{
|
||||
static int send_to_console = 0;
|
||||
|
||||
send_to_console = !send_to_console;
|
||||
printk("Toggling the state of debugtrace_printk\n");
|
||||
debugtrace_dump(send_to_console);
|
||||
debugtrace_send_to_console = !debugtrace_send_to_console;
|
||||
debugtrace_dump();
|
||||
printk("debugtrace_printk now writing to %s.\n",
|
||||
debugtrace_send_to_console ? "console" : "buffer");
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
+15
-39
@@ -476,40 +476,19 @@ void console_force_lock(void)
|
||||
|
||||
#ifndef NDEBUG
|
||||
|
||||
/* Send output direct to console, or buffer it? */
|
||||
int debugtrace_send_to_console;
|
||||
|
||||
static unsigned char *debugtrace_buf; /* Debug-trace buffer */
|
||||
static unsigned int debugtrace_prd; /* Producer index */
|
||||
static unsigned int debugtrace_kilobytes = 128, debugtrace_bytes;
|
||||
static int debugtrace_send_to_console = 0;
|
||||
static spinlock_t debugtrace_lock = SPIN_LOCK_UNLOCKED;
|
||||
integer_param("debugtrace", debugtrace_kilobytes);
|
||||
|
||||
|
||||
static void _debugtrace_reset(int send_to_console)
|
||||
{
|
||||
if (send_to_console)
|
||||
printk("debugtrace_printk now writting to console\n");
|
||||
else
|
||||
printk("debugtrace_printk now writting to buffer\n");
|
||||
|
||||
if ( debugtrace_bytes != 0 )
|
||||
memset(debugtrace_buf, '\0', debugtrace_bytes);
|
||||
|
||||
debugtrace_prd = 0;
|
||||
debugtrace_send_to_console = send_to_console;
|
||||
}
|
||||
|
||||
void debugtrace_reset(int send_to_console)
|
||||
{
|
||||
unsigned long flags;
|
||||
|
||||
spin_lock_irqsave(&debugtrace_lock, flags);
|
||||
_debugtrace_reset(send_to_console);
|
||||
spin_unlock_irqrestore(&debugtrace_lock, flags);
|
||||
}
|
||||
|
||||
void debugtrace_dump(int send_to_console)
|
||||
void debugtrace_dump(void)
|
||||
{
|
||||
int _watchdog_on = watchdog_on;
|
||||
unsigned long flags;
|
||||
|
||||
if ( debugtrace_bytes == 0 )
|
||||
return;
|
||||
@@ -517,7 +496,7 @@ void debugtrace_dump(int send_to_console)
|
||||
/* Watchdog can trigger if we print a really large buffer. */
|
||||
watchdog_on = 0;
|
||||
|
||||
spin_lock(&debugtrace_lock);
|
||||
spin_lock_irqsave(&debugtrace_lock, flags);
|
||||
|
||||
/* Print oldest portion of the ring. */
|
||||
serial_puts(sercon_handle, &debugtrace_buf[debugtrace_prd]);
|
||||
@@ -526,18 +505,18 @@ void debugtrace_dump(int send_to_console)
|
||||
debugtrace_buf[debugtrace_prd] = '\0';
|
||||
serial_puts(sercon_handle, &debugtrace_buf[0]);
|
||||
|
||||
_debugtrace_reset(send_to_console);
|
||||
memset(debugtrace_buf, '\0', debugtrace_bytes);
|
||||
|
||||
spin_unlock(&debugtrace_lock);
|
||||
spin_unlock_irqrestore(&debugtrace_lock, flags);
|
||||
|
||||
watchdog_on = _watchdog_on;
|
||||
}
|
||||
|
||||
void debugtrace_printk(const char *fmt, ...)
|
||||
{
|
||||
static char buf[1024];
|
||||
static char buf[1024];
|
||||
|
||||
va_list args;
|
||||
va_list args;
|
||||
unsigned char *p;
|
||||
unsigned long flags;
|
||||
|
||||
@@ -550,7 +529,7 @@ void debugtrace_printk(const char *fmt, ...)
|
||||
(void)vsnprintf(buf, sizeof(buf), fmt, args);
|
||||
va_end(args);
|
||||
|
||||
if (debugtrace_send_to_console)
|
||||
if ( debugtrace_send_to_console )
|
||||
{
|
||||
serial_puts(sercon_handle, buf);
|
||||
}
|
||||
@@ -558,10 +537,9 @@ void debugtrace_printk(const char *fmt, ...)
|
||||
{
|
||||
for ( p = buf; *p != '\0'; p++ )
|
||||
{
|
||||
debugtrace_buf[debugtrace_prd++] = *p;
|
||||
|
||||
/* always leave a null byte at the end of the buffer */
|
||||
if (debugtrace_prd == debugtrace_bytes-1)
|
||||
debugtrace_buf[debugtrace_prd++] = *p;
|
||||
/* Always leave a nul byte at the end of the buffer. */
|
||||
if ( debugtrace_prd == (debugtrace_bytes - 1) )
|
||||
debugtrace_prd = 0;
|
||||
}
|
||||
}
|
||||
@@ -586,8 +564,6 @@ static int __init debugtrace_init(void)
|
||||
debugtrace_buf = (unsigned char *)alloc_xenheap_pages(order);
|
||||
ASSERT(debugtrace_buf != NULL);
|
||||
|
||||
debugtrace_reset(0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
__initcall(debugtrace_init);
|
||||
@@ -611,7 +587,7 @@ void panic(const char *fmt, ...)
|
||||
unsigned long flags;
|
||||
extern void machine_restart(char *);
|
||||
|
||||
debugtrace_dump(0);
|
||||
debugtrace_dump();
|
||||
|
||||
va_start(args, fmt);
|
||||
(void)vsnprintf(buf, sizeof(buf), fmt, args);
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include <xen/string.h>
|
||||
|
||||
#define BUG() do { \
|
||||
debugtrace_dump(0); \
|
||||
debugtrace_dump(); \
|
||||
printk("BUG at %s:%d\n", __FILE__, __LINE__); \
|
||||
FORCE_CRASH(); \
|
||||
} while ( 0 )
|
||||
@@ -30,13 +30,12 @@ struct domain;
|
||||
void cmdline_parse(char *cmdline);
|
||||
|
||||
#ifndef NDEBUG
|
||||
extern void debugtrace_reset(int send_to_console);
|
||||
extern void debugtrace_dump(int send_to_console);
|
||||
extern int debugtrace_send_to_console;
|
||||
extern void debugtrace_dump(void);
|
||||
extern void debugtrace_printk(const char *fmt, ...);
|
||||
#else
|
||||
#define debugtrace_reset(_send_to_console) ((void)0)
|
||||
#define debugtrace_dump(_send_to_console) ((void)0)
|
||||
#define debugtrace_printk(_f, ...) ((void)0)
|
||||
#define debugtrace_dump() ((void)0)
|
||||
#define debugtrace_printk(_f, ...) ((void)0)
|
||||
#endif
|
||||
|
||||
#define printk printf
|
||||
|
||||