aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArve Hjønnevåg2012-11-26 22:05:37 -0600
committerArve Hjønnevåg2013-02-22 17:27:46 -0600
commit503df62b4b21d1aff8748b134a2ab60b36ad1da9 (patch)
tree0f1335f05d096a993ea9f10ade3b3ad4b8c17ac5
parent8ab64be7c59330f34921dace18ab8a92cbc536a5 (diff)
downloadkernel-common-503df62b4b21d1aff8748b134a2ab60b36ad1da9.tar.gz
kernel-common-503df62b4b21d1aff8748b134a2ab60b36ad1da9.tar.xz
kernel-common-503df62b4b21d1aff8748b134a2ab60b36ad1da9.zip
ARM: fiq_debugger: Use kmsg_dumper to dump kernel logs
Signed-off-by: Arve Hjønnevåg <arve@android.com>
-rw-r--r--arch/arm/common/fiq_debugger.c40
1 files changed, 10 insertions, 30 deletions
diff --git a/arch/arm/common/fiq_debugger.c b/arch/arm/common/fiq_debugger.c
index 5e9005bfdbb..eabd94b98f4 100644
--- a/arch/arm/common/fiq_debugger.c
+++ b/arch/arm/common/fiq_debugger.c
@@ -23,6 +23,7 @@
23#include <linux/clk.h> 23#include <linux/clk.h>
24#include <linux/platform_device.h> 24#include <linux/platform_device.h>
25#include <linux/kernel_stat.h> 25#include <linux/kernel_stat.h>
26#include <linux/kmsg_dump.h>
26#include <linux/irq.h> 27#include <linux/irq.h>
27#include <linux/delay.h> 28#include <linux/delay.h>
28#include <linux/reboot.h> 29#include <linux/reboot.h>
@@ -207,29 +208,19 @@ static void debug_prompt(struct fiq_debugger_state *state)
207 debug_puts(state, "debug> "); 208 debug_puts(state, "debug> ");
208} 209}
209 210
210int log_buf_copy(char *dest, int idx, int len);
211static void dump_kernel_log(struct fiq_debugger_state *state) 211static void dump_kernel_log(struct fiq_debugger_state *state)
212{ 212{
213 char buf[1024]; 213 char buf[512];
214 int idx = 0; 214 size_t len;
215 int ret; 215 struct kmsg_dumper dumper = { .active = true };
216 int saved_oip;
217 216
218 /* setting oops_in_progress prevents log_buf_copy() 217
219 * from trying to take a spinlock which will make it 218 kmsg_dump_rewind_nolock(&dumper);
220 * very unhappy in some cases... 219 while (kmsg_dump_get_line_nolock(&dumper, true, buf,
221 */ 220 sizeof(buf) - 1, &len)) {
222 saved_oip = oops_in_progress; 221 buf[len] = 0;
223 oops_in_progress = 1;
224 for (;;) {
225 ret = log_buf_copy(buf, idx, 1023);
226 if (ret <= 0)
227 break;
228 buf[ret] = 0;
229 debug_puts(state, buf); 222 debug_puts(state, buf);
230 idx += ret;
231 } 223 }
232 oops_in_progress = saved_oip;
233} 224}
234 225
235static char *mode_name(unsigned cpsr) 226static char *mode_name(unsigned cpsr)
@@ -523,18 +514,7 @@ static void begin_syslog_dump(struct fiq_debugger_state *state)
523 514
524static void end_syslog_dump(struct fiq_debugger_state *state) 515static void end_syslog_dump(struct fiq_debugger_state *state)
525{ 516{
526 char buf[128]; 517 dump_kernel_log(state);
527 int ret;
528 int idx = 0;
529
530 while (1) {
531 ret = log_buf_copy(buf, idx, sizeof(buf) - 1);
532 if (ret <= 0)
533 break;
534 buf[ret] = 0;
535 debug_printf(state, "%s", buf);
536 idx += ret;
537 }
538} 518}
539#endif 519#endif
540 520