Commit 7e5b5938 authored by Olaf Hering's avatar Olaf Hering Committed by Paul Mackerras

[PATCH] powerpc: add a raw dump command to xmon

Dump a stream of rawbytes with a new 'dr' command.
Produces less output and it is simpler to feed the output to scripts.
Also, dr has no dumpsize limits.
Signed-off-by: default avatarOlaf Hering <olh@suse.de>
Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
parent e3385222
...@@ -191,6 +191,7 @@ Commands:\n\ ...@@ -191,6 +191,7 @@ Commands:\n\
di dump instructions\n\ di dump instructions\n\
df dump float values\n\ df dump float values\n\
dd dump double values\n\ dd dump double values\n\
dr dump stream of raw bytes\n\
e print exception information\n\ e print exception information\n\
f flush cache\n\ f flush cache\n\
la lookup symbol+offset of specified address\n\ la lookup symbol+offset of specified address\n\
...@@ -1938,6 +1939,28 @@ bsesc(void) ...@@ -1938,6 +1939,28 @@ bsesc(void)
return c; return c;
} }
static void xmon_rawdump (unsigned long adrs, long ndump)
{
long n, m, r, nr;
unsigned char temp[16];
for (n = ndump; n > 0;) {
r = n < 16? n: 16;
nr = mread(adrs, temp, r);
adrs += nr;
for (m = 0; m < r; ++m) {
if (m < nr)
printf("%.2x", temp[m]);
else
printf("%s", fault_chars[fault_type]);
}
n -= r;
if (nr < r)
break;
}
printf("\n");
}
#define isxdigit(c) (('0' <= (c) && (c) <= '9') \ #define isxdigit(c) (('0' <= (c) && (c) <= '9') \
|| ('a' <= (c) && (c) <= 'f') \ || ('a' <= (c) && (c) <= 'f') \
|| ('A' <= (c) && (c) <= 'F')) || ('A' <= (c) && (c) <= 'F'))
...@@ -1960,6 +1983,13 @@ dump(void) ...@@ -1960,6 +1983,13 @@ dump(void)
nidump = MAX_DUMP; nidump = MAX_DUMP;
adrs += ppc_inst_dump(adrs, nidump, 1); adrs += ppc_inst_dump(adrs, nidump, 1);
last_cmd = "di\n"; last_cmd = "di\n";
} else if (c == 'r') {
scanhex(&ndump);
if (ndump == 0)
ndump = 64;
xmon_rawdump(adrs, ndump);
adrs += ndump;
last_cmd = "dr\n";
} else { } else {
scanhex(&ndump); scanhex(&ndump);
if (ndump == 0) if (ndump == 0)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment