diff options
author | Olaf Hering <olh@suse.de> | 2006-03-08 14:40:28 -0500 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2006-03-16 21:22:33 -0500 |
commit | 7e5b59384eebe35bff8429243f089931ce1cdf38 (patch) | |
tree | b4d4ecdb96c26eed704bc4ea254348b268a1717a /arch/powerpc/xmon | |
parent | e33852228f74b8ccbed8595083bb725b70902ed7 (diff) |
[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: Olaf Hering <olh@suse.de>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/xmon')
-rw-r--r-- | arch/powerpc/xmon/xmon.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c index 7d02fa2a899..4735b41c113 100644 --- a/arch/powerpc/xmon/xmon.c +++ b/arch/powerpc/xmon/xmon.c | |||
@@ -191,6 +191,7 @@ Commands:\n\ | |||
191 | di dump instructions\n\ | 191 | di dump instructions\n\ |
192 | df dump float values\n\ | 192 | df dump float values\n\ |
193 | dd dump double values\n\ | 193 | dd dump double values\n\ |
194 | dr dump stream of raw bytes\n\ | ||
194 | e print exception information\n\ | 195 | e print exception information\n\ |
195 | f flush cache\n\ | 196 | f flush cache\n\ |
196 | la lookup symbol+offset of specified address\n\ | 197 | la lookup symbol+offset of specified address\n\ |
@@ -1938,6 +1939,28 @@ bsesc(void) | |||
1938 | return c; | 1939 | return c; |
1939 | } | 1940 | } |
1940 | 1941 | ||
1942 | static void xmon_rawdump (unsigned long adrs, long ndump) | ||
1943 | { | ||
1944 | long n, m, r, nr; | ||
1945 | unsigned char temp[16]; | ||
1946 | |||
1947 | for (n = ndump; n > 0;) { | ||
1948 | r = n < 16? n: 16; | ||
1949 | nr = mread(adrs, temp, r); | ||
1950 | adrs += nr; | ||
1951 | for (m = 0; m < r; ++m) { | ||
1952 | if (m < nr) | ||
1953 | printf("%.2x", temp[m]); | ||
1954 | else | ||
1955 | printf("%s", fault_chars[fault_type]); | ||
1956 | } | ||
1957 | n -= r; | ||
1958 | if (nr < r) | ||
1959 | break; | ||
1960 | } | ||
1961 | printf("\n"); | ||
1962 | } | ||
1963 | |||
1941 | #define isxdigit(c) (('0' <= (c) && (c) <= '9') \ | 1964 | #define isxdigit(c) (('0' <= (c) && (c) <= '9') \ |
1942 | || ('a' <= (c) && (c) <= 'f') \ | 1965 | || ('a' <= (c) && (c) <= 'f') \ |
1943 | || ('A' <= (c) && (c) <= 'F')) | 1966 | || ('A' <= (c) && (c) <= 'F')) |
@@ -1960,6 +1983,13 @@ dump(void) | |||
1960 | nidump = MAX_DUMP; | 1983 | nidump = MAX_DUMP; |
1961 | adrs += ppc_inst_dump(adrs, nidump, 1); | 1984 | adrs += ppc_inst_dump(adrs, nidump, 1); |
1962 | last_cmd = "di\n"; | 1985 | last_cmd = "di\n"; |
1986 | } else if (c == 'r') { | ||
1987 | scanhex(&ndump); | ||
1988 | if (ndump == 0) | ||
1989 | ndump = 64; | ||
1990 | xmon_rawdump(adrs, ndump); | ||
1991 | adrs += ndump; | ||
1992 | last_cmd = "dr\n"; | ||
1963 | } else { | 1993 | } else { |
1964 | scanhex(&ndump); | 1994 | scanhex(&ndump); |
1965 | if (ndump == 0) | 1995 | if (ndump == 0) |