From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Thomas-Mich Richter <tmricht@linux.vnet.ibm.com>
Cc: "linux-perf-use." <linux-perf-users@vger.kernel.org>
Subject: Re: Question to struct map
Date: Wed, 13 Sep 2017 12:18:34 -0300 [thread overview]
Message-ID: <20170913151834.GG5866@kernel.org> (raw)
In-Reply-To: <ff3ff19d-de45-61f9-cd16-5d7c39c67cf0@linux.vnet.ibm.com>
Em Wed, Sep 13, 2017 at 04:48:03PM +0200, Thomas-Mich Richter escreveu:
> On 09/12/2017 05:17 PM, Arnaldo Carvalho de Melo wrote:
> > Em Tue, Sep 12, 2017 at 05:04:53PM +0200, Thomas-Mich Richter escreveu:
> >> I have a question regarding struct map.
> >> What is the purpose is the functions pointers in struct map named map_ip and unmap_ip?
> >> How do they relate the to dso the struct map is refering to?
> > A DSO has a symbol table (ELF or other kind, like the JIT ones
> > (documented in tools/perf/Documentation/jit-interface.txt) that may be
> > identity mapped or not, requiring or not use of relocation, etc.
> > The map, on the other hand, is where this DSO was loaded in memory,
> > which will be used to add to the symbol offset to do the address
> > resolution.
>
> I think I got it now.
> The map__map_ip() function converts a symbol's virtual memory address to the
> byte offset of that symbol in the ELF file.
>
> The map__unmap_ip() function does the opposite.
>
> Thanks for the explanation.
You're welcome, and if I may suggest, please consider these moments as
opportunities to help people that, like you, scratch their heads in the
future about these pointers, adding comments to the struct definition
:-)
- Arnaldo
prev parent reply other threads:[~2017-09-13 15:18 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-12 15:04 Question to struct map Thomas-Mich Richter
2017-09-12 15:17 ` Arnaldo Carvalho de Melo
2017-09-13 14:48 ` Thomas-Mich Richter
2017-09-13 15:18 ` Arnaldo Carvalho de Melo [this message]
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=20170913151834.GG5866@kernel.org \
--to=acme@kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=tmricht@linux.vnet.ibm.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 NNTP newsgroup(s).