This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: How to lookup a symbol for vma using BFD?
Thank you, this was very helpful.
I've borrowed the code from objdump.c and it works fine, I can find
the symbol I want.
But for some reason I cannot find a filename/line info using
bfg_find_line() for that symbol.
I've found that the comp unit for this file contains no
DW_AT_stmt_list attribute and comp_unit_maybe_decode_line_info() from
dwarf2.c returns FALSE thus preventing comp_unit_find_line() from
looking up variable table.
In fact, for now I'm interesting in filename only but I cannot find a
way to retrieve it. I can try, of course to build my "special BFD lib,
but perhaps there is some standard way?
Dmitry
2008/8/6 Nick Clifton <nickc@redhat.com>:
> Hi Dmitry,
>
>> I need to implement the following functionality:
>> Using an ELF file, I need to find the symbol (perhaps, not a
>> function!) for some vma.
>> Let's suppose I have an array defined as
>
> Have a look at the file binutils/addr2line.c which implements something
> similar to what you want. Alternatively look at binutils/objdump.c and in
> particular the find_symbol_for_address() function which does pretty much
> exactly what you need.
>
> Cheers
> Nick
>
>
>