This is the mail archive of the elfutils-devel@sourceware.org mailing list for the elfutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Libdw sample for reading function names and addresses


Thanks for the replies. I will have a look. Will get back if I get further
issues.

Regards
Bud

On Sun, Nov 9, 2014 at 8:57 PM, Petr Machata <pmachata@redhat.com> wrote:

> Mark Wielaard <mjw@redhat.com> writes:
>
> > On Sat, 2014-11-08 at 22:00 -0500, buddhika chamith wrote:
> >> I have a requirement to read off function names and addresses from an
> >> ELF binary debug symbols. Is there any such piece of code that's
> >> already there that you have written? I had a look at some elfutils
> >> codes (e.g: nm.c) in the hope of adapting them to my requirement. But
> >> the libdw API is seems bit intimidating to me given that I have
> >> little knowledge on Dwarf format.
> >
> > There is no such thing as "debug symbols". There are various DIEs (Debug
> > Information Entries) that can be associated with particular address
> > ranges though. You might want to read a bit about DWARF at
> > http://dwarfstd.org/
>
> There's also .symtab, if that's enough.  dwfl_module_getsymtab and
> dwfl_module_getsym should be able to retrieve it even from a separate
> debug-info file, in case it was stripped, otherwise gelf_getsym would be
> enough (and easier to set up than Dwfl).
>
> Petr.
>
Thanks for the replies. I will have a look. Will get back if I get further issues.

Regards
Bud

On Sun, Nov 9, 2014 at 8:57 PM, Petr Machata <pmachata@redhat.com> wrote:
Mark Wielaard <mjw@redhat.com> writes:

> On Sat, 2014-11-08 at 22:00 -0500, buddhika chamith wrote:
>> I have a requirement to read off function names and addresses from an
>> ELF binary debug symbols. Is there any such piece of code that's
>> already there that you have written? I had a look at some elfutils
>> codes (e.g: nm.c) in the hope of adapting them to my requirement. But
>> the libdw API is seems bit intimidating to me given that I have
>> little knowledge on Dwarf format.
>
> There is no such thing as "debug symbols". There are various DIEs (Debug
> Information Entries) that can be associated with particular address
> ranges though. You might want to read a bit about DWARF at
> http://dwarfstd.org/

There's also .symtab, if that's enough.  dwfl_module_getsymtab and
dwfl_module_getsym should be able to retrieve it even from a separate
debug-info file, in case it was stripped, otherwise gelf_getsym would be
enough (and easier to set up than Dwfl).

Petr.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]