static unsigned long nidump = 16;
static unsigned long ncsum = 4096;
static int termch;
+static char tmpstr[128];
static u_int bus_error_jmp[100];
#define setjmp xmon_setjmp
static void csum(void);
static void bootcmds(void);
void dump_segments(void);
+static void symbol_lookup(void);
static void debug_trace(void);
dd dump double values\n\
e print exception information\n\
f flush cache\n\
+ la lookup symbol+offset of specified address\n\
+ ls lookup address of specified symbol\n\
m examine/change memory\n\
mm move a block of memory\n\
ms set a block of memory\n\
case 'd':
dump();
break;
+ case 'l':
+ symbol_lookup();
+ break;
case 'r':
if (excp != NULL)
prregs(excp); /* print regs */
void
print_address(unsigned long addr)
{
- printf("0x%lx", addr);
+ const char *name;
+ char *modname;
+ long size, offset;
+
+ name = kallsyms_lookup(addr, &size, &offset, &modname, tmpstr);
+
+ if (name) {
+ if (modname)
+ printf("0x%lx\t# %s:%s+0x%lx", addr, modname, name, offset);
+ else
+ printf("0x%lx\t# %s+0x%lx", addr, name, offset);
+ } else
+ printf("0x%lx", addr);
}
+
/*
* Memory operations - move, set, print differences
*/
return 0;
}
+ /* skip leading "0x" if any */
+
+ if (c == '0') {
+ c = inchar();
+ if (c == 'x')
+ c = inchar();
+ } else if (c == '$') {
+ int i;
+ for (i=0; i<63; i++) {
+ c = inchar();
+ if (isspace(c)) {
+ termch = c;
+ break;
+ }
+ tmpstr[i] = c;
+ }
+ tmpstr[i++] = 0;
+ *vp = kallsyms_lookup_name(tmpstr);
+ if (!(*vp)) {
+ printf("unknown symbol '%s'\n", tmpstr);
+ return 0;
+ }
+ return 1;
+ }
+
d = hexdigit(c);
- if( d == EOF ){
+ if (d == EOF) {
termch = c;
return 0;
}
v = (v << 4) + d;
c = inchar();
d = hexdigit(c);
- } while( d != EOF );
+ } while (d != EOF);
termch = c;
*vp = v;
return 1;
lineptr = str;
}
+
+static void
+symbol_lookup(void)
+{
+ int type = inchar();
+ unsigned long addr;
+ static char tmp[64];
+
+ switch (type) {
+ case 'a':
+ if (scanhex(&addr)) {
+ printf("%lx: ", addr);
+ xmon_print_symbol("%s\n", addr);
+ }
+ termch = 0;
+ break;
+ case 's':
+ getstring(tmp, 64);
+ if (setjmp(bus_error_jmp) == 0) {
+ __debugger_fault_handler = handle_fault;
+ sync();
+ addr = kallsyms_lookup_name(tmp);
+ if (addr)
+ printf("%s: %lx\n", tmp, addr);
+ else
+ printf("Symbol '%s' not found.\n", tmp);
+ sync();
+ }
+ __debugger_fault_handler = 0;
+ termch = 0;
+ break;
+ }
+}
+
+
/* xmon version of __print_symbol */
void __xmon_print_symbol(const char *fmt, unsigned long address)
{
char *modname;
const char *name;
unsigned long offset, size;
- char namebuf[128];
if (setjmp(bus_error_jmp) == 0) {
__debugger_fault_handler = handle_fault;
sync();
name = kallsyms_lookup(address, &size, &offset, &modname,
- namebuf);
+ tmpstr);
sync();
/* wait a little while to see if we get a machine check */
__delay(200);