xmon support for symbol lookup
Paul Mackerras
paulus at samba.org
Thu Feb 26 11:38:50 EST 2004
Hi Olof,
> Attached patch adds symbol lookup functions to xmon, similar to what Ben
> added to ppc32 but not requiring a linked-in system.map.
Nice :)
> It requires the kallsyms_lookupname patch (see previous post), so I won't
> push this until I've heard back that it's accepted upstream.
>
> Commands added are "la <symbol>" and "ls <address>". The syntax $<symbol>
> can also be used to specify addresses, like on ppc32:
Hopefully you mean "la <address>" and "ls <symbol>", at least that is
what the code seems to implement.
> ===== arch/ppc64/xmon/ppc-dis.c 1.1 vs edited =====
> --- 1.1/arch/ppc64/xmon/ppc-dis.c Thu Feb 14 06:14:36 2002
> +++ edited/arch/ppc64/xmon/ppc-dis.c Wed Feb 25 11:22:49 2004
Someone needs to update ppc-dis.c and ppc-opc.c with a more recent
version from the BFD library. The one we have seems to be missing
some power4 instructions, and also seems to have a 32-bit assumption
here:
> + } else if ((operand->flags & PPC_OPERAND_ABSOLUTE) != 0)
> print_address (value & 0xffffffff);
I don't like this bit, though:
> + if (addr) {
> + char namebuf[128];
> + const char *name;
> + char *modname;
> + long size, offset;
> +
> + name = kallsyms_lookup(addr, &size, &offset, &modname, namebuf);
> + if (name) {
> + if(modname)
> + fprintf(out, "\t# [%s]%s+0x%lx", modname, name, offset);
> + else
> + fprintf(out, "\t# %s+0x%lx", name, offset);
> + }
> + }
This should be put in the print_address function. (With correct
indentation. :) If we minimize the changes we make to ppc_dis.c, it
makes it easier to update it from the BFD version as we go along.
And here it looks like you are sometimes using 8 spaces to indent, and
sometimes a tab:
> +void
> +symbol_lookup(void)
> +{
> + int type = inchar();
> + unsigned long addr;
> + static char tmp[64];
> +
> + switch (type) {
> + case 'a':
> + if (scanhex(&addr)) {
It would be good if you could use tabs everywhere.
Regards,
Paul.
** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/
More information about the Linuxppc64-dev
mailing list