[PATCH] objdump: z80: show symbol names for addresses in disassembly

Jan Beulich jbeulich@suse.com
Fri Mar 27 14:22:26 GMT 2026


On 25.03.2026 11:12, Zeal8bit wrote:
> --- a/opcodes/z80-dis.c
> +++ b/opcodes/z80-dis.c
> @@ -117,6 +117,12 @@ prt_e (struct buffer *buf, disassemble_info * info, const char *txt)
>         int target_addr = (buf->base + 2 + e) & 0xffff;
>         buf->n_used = buf->n_fetch;
>         info->fprintf_func (info->stream, "%s0x%04x", txt, target_addr);
> +      if (info->symbol_at_address_func)
> +        {
> +          asymbol *s = info->symbol_at_address_func (target_addr, info);
> +          if (s && s->name)
> +            info->fprintf_func (info->stream, " <%s>", s->name);
> +        }
>       }
>     else
>       buf->n_used = -1;
> @@ -139,6 +145,7 @@ prt_nn (struct buffer *buf, disassemble_info * info, const char *txt)
>     int nn;
>     unsigned char *p;
>     int i;
> +  asymbol *s;
>     p = (unsigned char*) buf->data + buf->n_fetch;
>     if (fetch_data (buf, info, buf->nn_len))
> @@ -148,6 +155,12 @@ prt_nn (struct buffer *buf, disassemble_info * info, const char *txt)
>         while (i--)
>           nn = nn * 0x100 + p[i];
>         info->fprintf_func (info->stream, txt, nn);
> +      if (info->symbol_at_address_func)
> +        {
> +          s = info->symbol_at_address_func (nn, info);
> +          if (s && s->name)
> +            info->fprintf_func (info->stream, " <%s>", s->name);
> +        }
>         buf->n_used = buf->n_fetch;
>       }
>     else

The vast majority or opcodes/*-dis*.c use info->print_address_func() as the
higher level interface (aiui). Is there a particular reason you need to use
info->symbol_at_address_func() here? If there is, it wants providing in the
description, and then the new variables you introduce also want to be
pointer-to-const.

Jan


More information about the Binutils mailing list