[binutils] Problems about utilizing BFD in a symbolic debugger

Nick Clifton nickc@redhat.com
Wed Mar 16 14:00:24 GMT 2022


Hi Rui,

> Glad to join the binutils community.

And it is very nice to have you join us.

> Using BFD doc/bfd.h, I've found BFD functions like bfd_find_nearest_line, bfd_canonicalize_symtab to implement features on "symbol-->address-->line", such as command 'b main / b func_name', or showing correct file and line after 'b *0x40000040' command.
> But I do not find any other BFD functions on "line-->address", to implement command like 'b main.c:14'.

There aren't any!  The BFD library does not have code to implement
source line to address mapping.  It only handles the other way around
(is address to source line).  So unfortunately you are going to need
to delve into the GDB code to solve this problem.


> And the symbol table in ELF or what the bfd_canonicalize_symtab returns seems to be a rather simple symbol table with no variable in the source file,

True - and again this is because the BFD library does not implement
this kind of mapping, so there is no need to contain this information
in the symbol table.


Cheers
   Nick



More information about the Binutils mailing list