aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/xmon/xmon.c
diff options
context:
space:
mode:
authorVinay Sridhar <vinay@linux.vnet.ibm.com>2009-05-14 19:13:07 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2009-05-21 01:44:25 -0400
commitf312deb4cd0c88196edf6dab192b7d42514398d6 (patch)
tree0275f78483b3285994ff6c791b82628615bf00ad /arch/powerpc/xmon/xmon.c
parent2138422bbab91c3e924c9836e394f4925b456b79 (diff)
powerpc/xmon: Add dl command to dump contents of __log_buf
Hello All, Quite a while back Michael Ellerman had posted a patch to add support to xmon to print the contents of the console log pointed to by __log_buf. Here's the link to that patch - http://ozlabs.org/pipermail/linuxppc64-dev/2005-March/003657.html I've ported the patch in the above link to 2.6.30-rc5 and have tested it. Thanks & regards, Vinay Signed-off-by: Michael Ellerman <michael at ellerman.id.au> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/xmon/xmon.c')
-rw-r--r--arch/powerpc/xmon/xmon.c47
1 files changed, 47 insertions, 0 deletions
diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
index 8dfad7d9a004..08121d3e47ba 100644
--- a/arch/powerpc/xmon/xmon.c
+++ b/arch/powerpc/xmon/xmon.c
@@ -110,6 +110,7 @@ static int bsesc(void);
110static void dump(void); 110static void dump(void);
111static void prdump(unsigned long, long); 111static void prdump(unsigned long, long);
112static int ppc_inst_dump(unsigned long, long, int); 112static int ppc_inst_dump(unsigned long, long, int);
113static void dump_log_buf(void);
113static void backtrace(struct pt_regs *); 114static void backtrace(struct pt_regs *);
114static void excprint(struct pt_regs *); 115static void excprint(struct pt_regs *);
115static void prregs(struct pt_regs *); 116static void prregs(struct pt_regs *);
@@ -197,6 +198,7 @@ Commands:\n\
197 di dump instructions\n\ 198 di dump instructions\n\
198 df dump float values\n\ 199 df dump float values\n\
199 dd dump double values\n\ 200 dd dump double values\n\
201 dl dump the kernel log buffer\n\
200 dr dump stream of raw bytes\n\ 202 dr dump stream of raw bytes\n\
201 e print exception information\n\ 203 e print exception information\n\
202 f flush cache\n\ 204 f flush cache\n\
@@ -2009,6 +2011,8 @@ dump(void)
2009 nidump = MAX_DUMP; 2011 nidump = MAX_DUMP;
2010 adrs += ppc_inst_dump(adrs, nidump, 1); 2012 adrs += ppc_inst_dump(adrs, nidump, 1);
2011 last_cmd = "di\n"; 2013 last_cmd = "di\n";
2014 } else if (c == 'l') {
2015 dump_log_buf();
2012 } else if (c == 'r') { 2016 } else if (c == 'r') {
2013 scanhex(&ndump); 2017 scanhex(&ndump);
2014 if (ndump == 0) 2018 if (ndump == 0)
@@ -2122,6 +2126,49 @@ print_address(unsigned long addr)
2122 xmon_print_symbol(addr, "\t# ", ""); 2126 xmon_print_symbol(addr, "\t# ", "");
2123} 2127}
2124 2128
2129void
2130dump_log_buf(void)
2131{
2132 const unsigned long size = 128;
2133 unsigned long i, end, addr;
2134 unsigned char buf[size + 1];
2135
2136 addr = 0;
2137 buf[size] = '\0';
2138
2139 if (setjmp(bus_error_jmp) != 0) {
2140 printf("Unable to lookup symbol __log_buf!\n");
2141 return;
2142 }
2143
2144 catch_memory_errors = 1;
2145 sync();
2146 addr = kallsyms_lookup_name("__log_buf");
2147
2148 if (! addr)
2149 printf("Symbol __log_buf not found!\n");
2150 else {
2151 end = addr + (1 << CONFIG_LOG_BUF_SHIFT);
2152 while (addr < end) {
2153 if (! mread(addr, buf, size)) {
2154 printf("Can't read memory at address 0x%lx\n", addr);
2155 break;
2156 }
2157
2158 printf("%s", buf);
2159
2160 if (strlen(buf) < size)
2161 break;
2162
2163 addr += size;
2164 }
2165 }
2166
2167 sync();
2168 /* wait a little while to see if we get a machine check */
2169 __delay(200);
2170 catch_memory_errors = 0;
2171}
2125 2172
2126/* 2173/*
2127 * Memory operations - move, set, print differences 2174 * Memory operations - move, set, print differences