public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
* Handling pgoff in perf elf mmap/mmap2 elf info
@ 2018-09-19 12:12 Christoph Sterz
  2018-09-19 12:24 ` Ulf Hermann
  0 siblings, 1 reply; 17+ messages in thread
From: Christoph Sterz @ 2018-09-19 12:12 UTC (permalink / raw)
  To: elfutils-devel

[-- Attachment #1: Type: text/plain, Size: 2186 bytes --]

Hi,

I work on Hotspot[1] an opensource linux perf aggregator and visualizer.
For this we use perfparser[2], which in turn uses libdw for unwinding.

Recently, we found more and more perf trace-files to use the 'pgoff'
field [3].
This happens especially on newer distros, (arch, opensuse tumbleweed).

We suspect perf to offset its recording-addresses of mmapped
dsos/executables starting with a specific section, such that they denote
their pointers with this pg_offset parameter. (e.g. skipping a library's
header and setting pgoff to the headersize). Although we are not 100%
sure about this information.

The Function I am using here is:
extern Dwfl_Module *dwfl_report_elf (Dwfl *dwfl, const char *name,
                     const char *file_name, int fd,
                     GElf_Addr base, bool add_p_vaddr);

in the specific call I am doing is:

 Dwfl_Module *ret = dwfl_report_elf(
                m_dwfl, info.originalFileName.constData(),
               
info.localFile.absoluteFilePath().toLocal8Bit().constData(), -1,
                info.addr,
                false);

and I am wondering how to include the pgoff here.

Simply subtracting it from info.addr results in a lots of "address range
overlaps an existing module" errors, where I guess I subtracted too
much. I know pgoff is in bytes.
Tried adding the offset, also overlap errors.

Ignoring the offset results in errors where perfparser fails to find ELF
for instruction pointer addresses.

I would be happy to hear if anyone has experience unwinding with these
offsets.
Maybe there is a different function I should use reporting the elf.
Maybe even someone unwinded/parsed perf data before.

Thanks,

Christoph


[1] https://github.com/KDAB/hotspot
[2] http://code.qt.io/cgit/qt-creator/perfparser.git/
[3] sparse info at
http://man7.org/linux/man-pages/man2/perf_event_open.2.html

-- 
Christoph Sterz | christoph.sterz@kdab.com | Software Engineer
KDAB (Deutschland) GmbH, a KDAB Group company
Tel: +49-30-521325470
KDAB - The Qt, C++ and OpenGL Experts



[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4003 bytes --]

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2018-10-20 10:49 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-19 12:12 Handling pgoff in perf elf mmap/mmap2 elf info Christoph Sterz
2018-09-19 12:24 ` Ulf Hermann
2018-09-21 13:07   ` Mark Wielaard
2018-09-21 13:35     ` Ulf Hermann
2018-09-26 14:38     ` Milian Wolff
2018-10-09 20:33       ` Milian Wolff
2018-10-11 17:02         ` Ulf Hermann
2018-10-11 17:37           ` Mark Wielaard
2018-10-11 18:14             ` Milian Wolff
2018-10-15 20:39               ` Milian Wolff
2018-10-15 21:05                 ` Mark Wielaard
2018-10-15 21:06                   ` Milian Wolff
2018-10-17 14:52                     ` Milian Wolff
2018-10-17 22:26                       ` Mark Wielaard
2018-10-18  7:41                 ` Ulf Hermann
2018-10-20 10:49                 ` Milian Wolff
2018-10-15 20:48               ` Milian Wolff

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).