From: Mark Wielaard <mark@klomp.org>
To: Martin Rodriguez Reboredo <yakoyoku@gmail.com>
Cc: elfutils-devel@sourceware.org
Subject: Re: [PATCH] Getter and setter for Dwfl's offline_next_address
Date: Sun, 24 Mar 2024 18:08:55 +0100 [thread overview]
Message-ID: <20240324170855.GF5673@gnu.wildebeest.org> (raw)
In-Reply-To: <43c02fe9-1862-4257-8692-c4f3cc136ca8@gmail.com>
Hi Martin,
On Sun, Mar 24, 2024 at 11:11:21AM -0300, Martin Rodriguez Reboredo wrote:
> On 3/20/24 19:52, Mark Wielaard wrote:
> >Could you show an example of when/where you need it and what address
> >you set it to?
>
> For example, this test program reports the name and location pointed by
> the passed address.
>
> $ ./report /home/yakoyoku/.debug/.build-id/.../elf 0x0003281f
> 0x000000000003281f
> ??
> ??:0
>
> But due to the mentioned bias both of them are unknown or out of range.
>
> >The offline_next_address is only relevant for ET_REL files (like
> >object files or kernel modules). In general you will need to check the
> >bias, which various dwfl functions return to know the difference
> >between the addresses in the ELF, Dwarf or the module load address.
> >
> >That said, readelf, nm and dwfl_argp do "cheat" by setting the
> >offline_next_address to zero if they know they are just inspecting a
> >single object file. So maybe this is a functionality we need to
> >expose. But I don't fully understand why you need both a getter and a
> >setter for any arbitrary address.
>
> I've erroneously thought that setting `offline_next_address` was a
> requirement to obtain what I've needed. But if I use
> `dwfl_module_getelf` or `dwfl_module_getdwarf` I can get the correct
> name and location.
>
> 0x000000000003281f
> _ZNSt11__copy_moveILb0ELb0ESt26random_access_iterator_tagE8__copy_mIPcPhEET0_T_S6_S5_
> /usr/include/c++/13.2.1/bits/stl_algobase.h:388,18
>
> So this patch is kinda pointless, but at least I've managed to learn
> what I was missing. Anyways, thanks for the heads-up. :)
I don't think it was pointless. Clearly our documentation is not very
good (and given eu-readelf and eu-nm do cheat, maybe our interface/api
isn't really good either).
Maybe you could post your code for that ./report program and what you
had to do to get it to print the correct address/symbols. Then we at
least have some documentation for others which hit the same issue.
Thanks,
Mark
next prev parent reply other threads:[~2024-03-24 17:08 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-06 19:22 Martin Rodriguez Reboredo
2024-03-15 17:27 ` Aaron Merey
2024-03-20 22:52 ` Mark Wielaard
2024-03-24 14:11 ` Martin Rodriguez Reboredo
2024-03-24 17:08 ` Mark Wielaard [this message]
2024-03-24 19:17 ` Martin Rodriguez Reboredo
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=20240324170855.GF5673@gnu.wildebeest.org \
--to=mark@klomp.org \
--cc=elfutils-devel@sourceware.org \
--cc=yakoyoku@gmail.com \
/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).