[PATCH] xmon command for symbol lookups

Olof Johansson olof at austin.ibm.com
Wed Feb 25 07:35:11 EST 2004


One of the most crippling drawbacks (for me) with xmon is that you need
a System.map to lookup all addresses in when you're digging through
disassembly.

The attached patch adds a new command, "n <address>" that will show the
corresponding symbol in the same way that the "t" command does.

It also fixes another thing that's irritated me before: xmon doesn't
take values in 0x<hex> form, only <hex>.


3:mon> t
c00000007e4978b0  c00000000004d894  .xmon+0x15c/0x358
c00000007e497a90  c00000000004d2e0  .sysrq_handle_xmon+0x5c/0x64
c00000007e497b20  c00000000024d7c4  .__handle_sysrq_nolock+0xe0/0x184
c00000007e497bd0  c00000000024d6c0  .handle_sysrq+0x70/0x94
c00000007e497c60  c000000000102dd0  .write_sysrq_trigger+0x88/0xac
c00000007e497cf0  c0000000000b4464  .vfs_write+0x10c/0x164
c00000007e497d90  c0000000000b45a0  .sys_write+0x50/0x94
c00000007e497e30  c0000000000119bc  ret_from_syscall_1
exception: c00 (System Call) regs c00000007e497ea0
                   000000000ff27b2c
<Stack drops into userspace 00000000ffffe780>
3:mon> di c00000000024d6c0
c00000000024d6c0  60000000      nop
c00000000024d6c4  38210090      addi    r1,r1,144
c00000000024d6c8  e8010010      ld      r0,16(r1)
c00000000024d6cc  ebe1fff8      ld      r31,-8(r1)
c00000000024d6d0  eb81ffe0      ld      r28,-32(r1)
c00000000024d6d4  eba1ffe8      ld      r29,-24(r1)
c00000000024d6d8  ebc1fff0      ld      r30,-16(r1)
c00000000024d6dc  7c0803a6      mtlr    r0
c00000000024d6e0  4bfffeac      b       0xc00000000024d58c
c00000000024d6e4  fbc1fff0      std     r30,-16(r1)
c00000000024d6e8  ebc2c5d8      ld      r30,-14888(r2)
c00000000024d6ec  7c0802a6      mflr    r0
c00000000024d6f0  fb41ffd0      std     r26,-48(r1)
c00000000024d6f4  fb61ffd8      std     r27,-40(r1)
c00000000024d6f8  7cba2b78      mr      r26,r5
c00000000024d6fc  7c9b2378      mr      r27,r4
3:mon> n 0xc00000000024d58c
c00000000024d58c: .__sysrq_unlock_table+0x0/0x30
3:mon>





Another enhancement would be to simply print the symbol as a comment
behind the address when doing disasm, but that would make the output
wider than 80 characters. Does anyone have problems with that or should
I add that as well?


Thanks,

Olof

--
Olof Johansson                                        Office: 4F005/905
pSeries Linux Development                             IBM Systems Group
Email: olof at austin.ibm.com                          Phone: 512-838-9858
All opinions are my own and not those of IBM
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: xmon-n-cmd
Url: http://ozlabs.org/pipermail/linuxppc64-dev/attachments/20040224/0d049fe1/attachment.txt 


More information about the Linuxppc64-dev mailing list