From a2e66773735d2d2de2ba652e44650288c88ad752 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Tue, 6 Apr 2021 18:57:04 +0930 Subject: Return symbol from symbol_at_address_func include/ * dis-asm.h (struct disassemble_info ): Return asymbol*. binutils/ * objdump.c (objdump_symbol_at_address): Return asymbol*. opcodes/ * dis-buf.c (generic_symbol_at_address): Return symbol* NULL. * s12z-dis.c (decode_possible_symbol): Use symbol returned from symbol_at_address_func. --- binutils/objdump.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'binutils/objdump.c') diff --git a/binutils/objdump.c b/binutils/objdump.c index aa1215cede8..ea80a704ee3 100644 --- a/binutils/objdump.c +++ b/binutils/objdump.c @@ -1459,14 +1459,16 @@ objdump_print_address (bfd_vma vma, struct disassemble_info *inf) /* Determine if the given address has a symbol associated with it. */ -static int +static asymbol * objdump_symbol_at_address (bfd_vma vma, struct disassemble_info * inf) { asymbol * sym; sym = find_symbol_for_address (vma, inf, NULL); + if (sym != NULL && bfd_asymbol_value (sym) == vma) + return sym; - return (sym != NULL && (bfd_asymbol_value (sym) == vma)); + return NULL; } /* Hold the last function name and the last line number we displayed -- cgit v1.2.1