[PATCH] improve xmon symbol lookup
Anton Blanchard
anton at samba.org
Thu Mar 4 01:20:32 EST 2004
> xmon will die reliable in symbol lookup, if the system is broken enough.
>
> This patch makes the lookup optional, E instead of e, T instead of t.
Id love to know where we are locking up. Actually im not sure why we
dont do the following, just wrap the entire kallsyms call with the
__debugger_fault_handler stuff.
Untested patch below.
Anton
===== arch/ppc64/xmon/xmon.c 1.36 vs edited =====
--- 1.36/arch/ppc64/xmon/xmon.c Fri Feb 27 16:25:16 2004
+++ edited/arch/ppc64/xmon/xmon.c Thu Mar 4 01:16:49 2004
@@ -191,12 +191,7 @@
static struct pt_regs *xmon_regs[NR_CPUS];
-void __xmon_print_symbol(const char *fmt, unsigned long address);
-#define xmon_print_symbol(fmt, addr) \
-do { \
- __check_printsym_format(fmt, ""); \
- __xmon_print_symbol(fmt, addr); \
-} while(0)
+void xmon_print_symbol(const char *fmt, unsigned long address);
/*
* Stuff for reading and writing memory safely
@@ -1974,6 +1969,8 @@
else
printf("Symbol '%s' not found.\n", tmp);
sync();
+ /* wait a little while to see if we get a machine check */
+ __delay(200);
}
__debugger_fault_handler = 0;
termch = 0;
@@ -1981,51 +1978,20 @@
}
}
-
-/* xmon version of __print_symbol */
-void __xmon_print_symbol(const char *fmt, unsigned long address)
+/* xmon version of print_symbol */
+void xmon_print_symbol(const char *fmt, unsigned long address)
{
- char *modname;
- const char *name;
- unsigned long offset, size;
-
if (setjmp(bus_error_jmp) == 0) {
__debugger_fault_handler = handle_fault;
sync();
- name = kallsyms_lookup(address, &size, &offset, &modname,
- tmpstr);
+
+ print_symbol(fmt, address);
+
sync();
/* wait a little while to see if we get a machine check */
__delay(200);
} else {
- name = "symbol lookup failed";
- }
-
- __debugger_fault_handler = 0;
-
- if (!name) {
- char addrstr[sizeof("0x%lx") + (BITS_PER_LONG*3/10)];
-
- sprintf(addrstr, "0x%lx", address);
- printf(fmt, addrstr);
- return;
- }
-
- if (modname) {
- /* This is pretty small. */
- char buffer[sizeof("%s+%#lx/%#lx [%s]")
- + strlen(name) + 2*(BITS_PER_LONG*3/10)
- + strlen(modname)];
-
- sprintf(buffer, "%s+%#lx/%#lx [%s]",
- name, offset, size, modname);
- printf(fmt, buffer);
- } else {
- char buffer[sizeof("%s+%#lx/%#lx")
- + strlen(name) + 2*(BITS_PER_LONG*3/10)];
-
- sprintf(buffer, "%s+%#lx/%#lx", name, offset, size);
- printf(fmt, buffer);
+ printf("*** symbol lookup failed");
}
}
** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/
More information about the Linuxppc64-dev
mailing list