Sharyathi Nagesh wrote:
I looked into libdwfl.h, which is used by systemtap, as I understand
this will be useful in debugging running machine and not the case I
am looking for so I am considering only libdw.h for the time being.
libdwfl can be useful also for post-mortem debugging. It manages address
space, i.e. knows which module is mapped to which address, and has a
couple useful features that are related to that. It understands that
debuginfo portion of the module can be stored separately from the main
ELF file, and supports build ID for debuginfo file lookup. It knows
about bias (the difference between where the library gets mapped, and
what's its base address as noted in the ELF file; important e.g. when
translating symbol table addresses to address space addresses). I think
it can do some limited REL file relocation (so that you can map kernel
modules into the address space). So it's basically a library of things
you would have to implement anyway, I think.
I'm not too familiar with libdwfl myself, so if what I've written above
seems vague, that's because it is ;)
Anyway, hope that helps.
PM