ARM: fiq_debugger: Use kmsg_dumper to dump kernel logs

Signed-off-by: Arve Hjønnevåg <arve@android.com>
This commit is contained in:
Arve Hjønnevåg 2012-11-26 20:05:37 -08:00 committed by John Stultz
parent 9b6224b1f5
commit a38d2154c8

View file

@ -23,6 +23,7 @@
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/kernel_stat.h> #include <linux/kernel_stat.h>
#include <linux/kmsg_dump.h>
#include <linux/irq.h> #include <linux/irq.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/reboot.h> #include <linux/reboot.h>
@ -207,29 +208,19 @@ static void debug_prompt(struct fiq_debugger_state *state)
debug_puts(state, "debug> "); debug_puts(state, "debug> ");
} }
int log_buf_copy(char *dest, int idx, int len);
static void dump_kernel_log(struct fiq_debugger_state *state) static void dump_kernel_log(struct fiq_debugger_state *state)
{ {
char buf[1024]; char buf[512];
int idx = 0; size_t len;
int ret; struct kmsg_dumper dumper = { .active = true };
int saved_oip;
/* setting oops_in_progress prevents log_buf_copy()
* from trying to take a spinlock which will make it kmsg_dump_rewind_nolock(&dumper);
* very unhappy in some cases... while (kmsg_dump_get_line_nolock(&dumper, true, buf,
*/ sizeof(buf) - 1, &len)) {
saved_oip = oops_in_progress; buf[len] = 0;
oops_in_progress = 1;
for (;;) {
ret = log_buf_copy(buf, idx, 1023);
if (ret <= 0)
break;
buf[ret] = 0;
debug_puts(state, buf); debug_puts(state, buf);
idx += ret;
} }
oops_in_progress = saved_oip;
} }
static char *mode_name(unsigned cpsr) static char *mode_name(unsigned cpsr)
@ -523,18 +514,7 @@ static void begin_syslog_dump(struct fiq_debugger_state *state)
static void end_syslog_dump(struct fiq_debugger_state *state) static void end_syslog_dump(struct fiq_debugger_state *state)
{ {
char buf[128]; dump_kernel_log(state);
int ret;
int idx = 0;
while (1) {
ret = log_buf_copy(buf, idx, sizeof(buf) - 1);
if (ret <= 0)
break;
buf[ret] = 0;
debug_printf(state, "%s", buf);
idx += ret;
}
} }
#endif #endif