From: "mark at klomp dot org" <sourceware-bugzilla@sourceware.org>
To: elfutils-devel@sourceware.org
Subject: [Bug libdw/31447] Provide a public debug section relocation function
Date: Sun, 03 Mar 2024 12:35:52 +0000 [thread overview]
Message-ID: <bug-31447-10460-XJMXpSPASu@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-31447-10460@http.sourceware.org/bugzilla/>
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.
next prev parent reply other threads:[~2024-03-03 12:35 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-03 12:19 [Bug libdw/31447] New: " mark at klomp dot org
2024-03-03 12:35 ` mark at klomp dot org [this message]
2024-03-21 14:19 ` [Bug libdw/31447] " dichen at redhat dot com
2024-05-12 7:29 ` dichen at redhat dot com
2024-05-12 9:06 ` mark at klomp dot org
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=bug-31447-10460-XJMXpSPASu@http.sourceware.org/bugzilla/ \
--to=sourceware-bugzilla@sourceware.org \
--cc=elfutils-devel@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).