https://sourceware.org/bugzilla/show_bug.cgi?id=31447

--- Comment #1 from Mark Wielaard <mark at klomp dot org> ---
This is the current "workaround" I use when working with individual ET_REL
DWARF files (also works for any other ELF type):

 static char *debuginfo_path = NULL;
 static const Dwfl_Callbacks dwfl_callbacks =
    {
      .find_elf = dwfl_build_id_find_elf,
      .find_debuginfo = dwfl_standard_find_debuginfo,
      .section_address = dwfl_offline_section_address,
      .debuginfo_path = &debuginfo_path,
    };

 int main (int argc, char **argv)
 {
    Dwfl *dwfl = dwfl_begin (&dwfl_callbacks);
    Dwfl_Module *module = dwfl_report_elf (dwfl, argv[1], argv[1], -1, 0,
false);
    if (module == NULL)
      printf ("%s\n", dwfl_errmsg (-1));
    dwfl_report_end (dwfl, NULL, NULL);

    Dwarf_Addr bias;
    Dwarf *dwarf = dwfl_module_getdwarf (module, &bias);
    if (dwarf == NULL)
      printf ("%s\n", dwfl_errmsg (-1));

    /* ... do something with dwarf ... */

    dwfl_end (dwfl); // Also cleans up dwarf.
 }

But this is obviously a little cumbersome if not really using any other libdwfl
features.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Reply via email to