public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
* Libdw sample for reading function names and addresses
@ 2014-11-09  3:00 buddhika chamith
  0 siblings, 0 replies; 4+ messages in thread
From: buddhika chamith @ 2014-11-09  3:00 UTC (permalink / raw)
  To: elfutils-devel

[-- Attachment #1: Type: text/plain, Size: 500 bytes --]

Hi Devs,

Not entirely sure if this is the correct forum. But any help is greatly
appreciated. 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.

Thanks in advance
Bud

[-- Attachment #2: attachment.html --]
[-- Type: text/html, Size: 567 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Libdw sample for reading function names and addresses
@ 2014-11-11  4:41 buddhika chamith
  0 siblings, 0 replies; 4+ messages in thread
From: buddhika chamith @ 2014-11-11  4:41 UTC (permalink / raw)
  To: elfutils-devel

[-- Attachment #1: Type: text/plain, Size: 1222 bytes --]

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.
>

[-- Attachment #2: attachment.html --]
[-- Type: text/html, Size: 1823 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Libdw sample for reading function names and addresses
@ 2014-11-10  1:57 Petr Machata
  0 siblings, 0 replies; 4+ messages in thread
From: Petr Machata @ 2014-11-10  1:57 UTC (permalink / raw)
  To: elfutils-devel

[-- Attachment #1: Type: text/plain, Size: 1000 bytes --]

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.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Libdw sample for reading function names and addresses
@ 2014-11-09 17:04 Mark Wielaard
  0 siblings, 0 replies; 4+ messages in thread
From: Mark Wielaard @ 2014-11-09 17:04 UTC (permalink / raw)
  To: elfutils-devel

[-- Attachment #1: Type: text/plain, Size: 976 bytes --]

On Sat, 2014-11-08 at 22:00 -0500, buddhika chamith wrote:
> Not entirely sure if this is the correct forum. But any help is greatly
> appreciated. 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/

You might want to take a look at src/addr2line.c which has some code
(print_dwarf_function) to print out some information found in the DWARF
debuginfo associated with a particular address.

Cheers,

Mark

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-11-11  4:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-09  3:00 Libdw sample for reading function names and addresses buddhika chamith
2014-11-09 17:04 Mark Wielaard
2014-11-10  1:57 Petr Machata
2014-11-11  4:41 buddhika chamith

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).