Skip to contentSkip to conversation

regression: perf script IP address format

DISCUSSION Milian Wolff 1 participant 2 messages Aug 30, 2016

lore
Share & tools
lore
#0 lore raw

Hey all,

I'm encountering an issue related to the one I reported a few days ago, where the -g address feature was broken due to the wrong address being used.

We fixed this by using al.addr instead of ip, but this now breaks the output of perf script:

Before 67540759151aefafddade3e27c4671ab7b3d230f was applied:

lab_mandelbrot 28224 13656.319122: 995647 cycles:ppp:

                  403a8a _start+0x2a (/ssd/milian/projects/kdab/training-
material/addon/profiling/build/lab_mandelbrot/src/lab_mandelbrot)
            7f8a88e1c291 __libc_start_main+0xf1 (/usr/lib/libc-2.24.so)
                  40307a main+0x4a (/ssd/milian/projects/kdab/training-
material/addon/profiling/build/lab_mandelbrot/src/lab_mandelbrot)
            7f8a8ae39ae9 QApplicationPrivate::init+0x9 (/usr/lib/
libQt5Widgets.so.5.7.0)
            7f8a8a69e7af QGuiApplicationPrivate::init+0x2f (/usr/lib/
libQt5Gui.so.5.7.0)
            7f8a8a15b3bf QCoreApplicationPrivate::init+0xaaf (/usr/lib/
libQt5Core.so.5.7.0)
            7f8a8a69cced QGuiApplicationPrivate::createEventDispatcher+0x2d (/
usr/lib/libQt5Gui.so.5.7.0)
            7f8a8a69c252 QGuiApplicationPrivate::createPlatformIntegration
+0x5c2 (/usr/lib/libQt5Gui.so.5.7.0)
            7f8a8a68e01f QPlatformIntegrationFactory::create+0xef (/usr/lib/
libQt5Gui.so.5.7.0)
            7f8a8a13f9c2 QFactoryLoader::instance+0x112 (/usr/lib/
libQt5Core.so.5.7.0)
            7f8a8a14a6a5 [unknown] (/usr/lib/libQt5Core.so.5.7.0)
            7f8a8a15121e [unknown] (/usr/lib/libQt5Core.so.5.7.0)
            7f8a87aa5f82 dlopen+0x32 (/usr/lib/libdl-2.24.so)
            7f8a87aa6521 [unknown] (/usr/lib/libdl-2.24.so)
            7f8a8b5493a4 _dl_catch_error+0x74 (/usr/lib/ld-2.24.so)
            7f8a87aa5ee9 [unknown] (/usr/lib/libdl-2.24.so)
            7f8a8b54d2d9 _dl_open+0xc9 (/usr/lib/ld-2.24.so)
            7f8a8b5493a4 _dl_catch_error+0x74 (/usr/lib/ld-2.24.so)
            7f8a8b54d85d dl_open_worker+0x11d (/usr/lib/ld-2.24.so)
            7f8a8b547005 _dl_map_object_deps+0x275 (/usr/lib/ld-2.24.so)
            7f8a8b5493a4 _dl_catch_error+0x74 (/usr/lib/ld-2.24.so)
            7f8a8b546d80 openaux+0x30 (/usr/lib/ld-2.24.so)
            7f8a8b5423fd _dl_map_object+0x8d (/usr/lib/ld-2.24.so)
            7f8a8b54a5d4 _dl_name_match_p+0x44 (/usr/lib/ld-2.24.so)
            7f8a8b55364c strcmp+0xc (/usr/lib/ld-2.24.so)

After it got applied:

lab_mandelbrot 28224 13656.319122: 995647 cycles:ppp:

                    3a8a _start+0xffffffffff80002a (/ssd/milian/projects/kdab/
training-material/addon/profiling/build/lab_mandelbrot/src/lab_mandelbrot)
                   20291 __libc_start_main+0xffff00eaee4080f1 (/usr/lib/
libc-2.24.so)
                    307a main+0xffffffffff80004a (/ssd/milian/projects/kdab/
training-material/addon/profiling/build/lab_mandelbrot/src/lab_mandelbrot)
                  158ae9 QApplicationPrivate::init+0xffff00eaea63e009 (/usr/
lib/libQt5Widgets.so.5.7.0)
                   f97af QGuiApplicationPrivate::init+0xffff00eaeb4b602f (/
usr/lib/libQt5Gui.so.5.7.0)
                  28d3bf QCoreApplicationPrivate::init+0xffff00eaec264aaf (/

usr/lib/libQt5Core.so.5.7.0)
f7ced QGuiApplicationPrivate::createEventDispatcher
+0xffff00eaeb4b602d (/usr/lib/libQt5Gui.so.5.7.0)
f7252 QGuiApplicationPrivate::createPlatformIntegration
+0xffff00eaeb4b65c2 (/usr/lib/libQt5Gui.so.5.7.0)
e901f QPlatformIntegrationFactory::create
+0xffff00eaeb4b60ef (/usr/lib/libQt5Gui.so.5.7.0)

                  2719c2 QFactoryLoader::instance+0xffff00eaec264112 (/usr/
lib/libQt5Core.so.5.7.0)
                  27c6a5 [unknown] (/usr/lib/libQt5Core.so.5.7.0)
                  28321e [unknown] (/usr/lib/libQt5Core.so.5.7.0)
                     f82 dlopen+0xffff00eaf0ab6032 (/usr/lib/libdl-2.24.so)
                    1521 [unknown] (/usr/lib/libdl-2.24.so)
                    f3a4 _dl_catch_error+0xffff00eae958c074 (/usr/lib/
ld-2.24.so)
                     ee9 [unknown] (/usr/lib/libdl-2.24.so)
                   132d9 _dl_open+0xffff00eae958c0c9 (/usr/lib/ld-2.24.so)
                    f3a4 _dl_catch_error+0xffff00eae958c074 (/usr/lib/
ld-2.24.so)
                   1385d dl_open_worker+0xffff00eae958c11d (/usr/lib/
ld-2.24.so)
                    d005 _dl_map_object_deps+0xffff00eae958c275 (/usr/lib/
ld-2.24.so)
                    f3a4 _dl_catch_error+0xffff00eae958c074 (/usr/lib/
ld-2.24.so)
                    cd80 openaux+0xffff00eae958c030 (/usr/lib/ld-2.24.so)
                    83fd _dl_map_object+0xffff00eae958c08d (/usr/lib/
ld-2.24.so)
                   105d4 _dl_name_match_p+0xffff00eae958c044 (/usr/lib/
ld-2.24.so)
                   1964c strcmp+0xffff00eae958c00c (/usr/lib/ld-2.24.so)

This breaks consumers of the perf script output who want to feed the IP address into addr2line, most notably stackcollapse-perf.

Namhyung, how do you propose to fix this issue, while keeping -g address function in reports?

Also, while at it, I'd really like to see a way to output the srcline information in backtraces output by perf script, such that the expensive addr2line invocation by stackcollapse-perf becomes obsolete. Any suggestion on how to do that? I think it will mean refactoring perf script to become aware of a --call-graph option, similar to perf report. Additionally, the data must then be published to the python/perl bindings...

Thanks

Signature · 4 lines
Milian Wolff | [email protected] | Software Engineer
KDAB (Deutschland) GmbH&Co KG, a KDAB Group company
Tel: +49-30-521325470
KDAB - The Qt Experts
#1 lore raw
Quoted 93 lines · On Dienstag, 30. August 2016 17:42:47 CEST Milian Wolff wrote:

Hey all,

I'm encountering an issue related to the one I reported a few days ago, where the -g address feature was broken due to the wrong address being used.

We fixed this by using al.addr instead of ip, but this now breaks the output of perf script:

Before 67540759151aefafddade3e27c4671ab7b3d230f was applied:

lab_mandelbrot 28224 13656.319122: 995647 cycles:ppp:

                  403a8a _start+0x2a (/ssd/milian/projects/kdab/training-
material/addon/profiling/build/lab_mandelbrot/src/lab_mandelbrot)
            7f8a88e1c291 __libc_start_main+0xf1 (/usr/lib/libc-2.24.so)
                  40307a main+0x4a (/ssd/milian/projects/kdab/training-
material/addon/profiling/build/lab_mandelbrot/src/lab_mandelbrot)
            7f8a8ae39ae9 QApplicationPrivate::init+0x9 (/usr/lib/
libQt5Widgets.so.5.7.0)
            7f8a8a69e7af QGuiApplicationPrivate::init+0x2f (/usr/lib/
libQt5Gui.so.5.7.0)
            7f8a8a15b3bf QCoreApplicationPrivate::init+0xaaf (/usr/lib/
libQt5Core.so.5.7.0)
            7f8a8a69cced QGuiApplicationPrivate::createEventDispatcher+0x2d
(/ usr/lib/libQt5Gui.so.5.7.0)
            7f8a8a69c252 QGuiApplicationPrivate::createPlatformIntegration
+0x5c2 (/usr/lib/libQt5Gui.so.5.7.0)
            7f8a8a68e01f QPlatformIntegrationFactory::create+0xef (/usr/lib/
libQt5Gui.so.5.7.0)
            7f8a8a13f9c2 QFactoryLoader::instance+0x112 (/usr/lib/
libQt5Core.so.5.7.0)
            7f8a8a14a6a5 [unknown] (/usr/lib/libQt5Core.so.5.7.0)
            7f8a8a15121e [unknown] (/usr/lib/libQt5Core.so.5.7.0)
            7f8a87aa5f82 dlopen+0x32 (/usr/lib/libdl-2.24.so)
            7f8a87aa6521 [unknown] (/usr/lib/libdl-2.24.so)
            7f8a8b5493a4 _dl_catch_error+0x74 (/usr/lib/ld-2.24.so)
            7f8a87aa5ee9 [unknown] (/usr/lib/libdl-2.24.so)
            7f8a8b54d2d9 _dl_open+0xc9 (/usr/lib/ld-2.24.so)
            7f8a8b5493a4 _dl_catch_error+0x74 (/usr/lib/ld-2.24.so)
            7f8a8b54d85d dl_open_worker+0x11d (/usr/lib/ld-2.24.so)
            7f8a8b547005 _dl_map_object_deps+0x275 (/usr/lib/ld-2.24.so)
            7f8a8b5493a4 _dl_catch_error+0x74 (/usr/lib/ld-2.24.so)
            7f8a8b546d80 openaux+0x30 (/usr/lib/ld-2.24.so)
            7f8a8b5423fd _dl_map_object+0x8d (/usr/lib/ld-2.24.so)
            7f8a8b54a5d4 _dl_name_match_p+0x44 (/usr/lib/ld-2.24.so)
            7f8a8b55364c strcmp+0xc (/usr/lib/ld-2.24.so)

After it got applied:

lab_mandelbrot 28224 13656.319122: 995647 cycles:ppp:

                    3a8a _start+0xffffffffff80002a
(/ssd/milian/projects/kdab/
training-material/addon/profiling/build/lab_mandelbrot/src/lab_mandelbrot)
20291 __libc_start_main+0xffff00eaee4080f1 (/usr/lib/ libc-2.24.so)
                    307a main+0xffffffffff80004a (/ssd/milian/projects/kdab/
training-material/addon/profiling/build/lab_mandelbrot/src/lab_mandelbrot)
158ae9 QApplicationPrivate::init+0xffff00eaea63e009 (/usr/
lib/libQt5Widgets.so.5.7.0)
                   f97af QGuiApplicationPrivate::init+0xffff00eaeb4b602f (/
usr/lib/libQt5Gui.so.5.7.0)
                  28d3bf QCoreApplicationPrivate::init+0xffff00eaec264aaf (/

usr/lib/libQt5Core.so.5.7.0)
f7ced QGuiApplicationPrivate::createEventDispatcher
+0xffff00eaeb4b602d (/usr/lib/libQt5Gui.so.5.7.0)
f7252 QGuiApplicationPrivate::createPlatformIntegration
+0xffff00eaeb4b65c2 (/usr/lib/libQt5Gui.so.5.7.0)
e901f QPlatformIntegrationFactory::create
+0xffff00eaeb4b60ef (/usr/lib/libQt5Gui.so.5.7.0)

                  2719c2 QFactoryLoader::instance+0xffff00eaec264112 (/usr/
lib/libQt5Core.so.5.7.0)
                  27c6a5 [unknown] (/usr/lib/libQt5Core.so.5.7.0)
                  28321e [unknown] (/usr/lib/libQt5Core.so.5.7.0)
                     f82 dlopen+0xffff00eaf0ab6032 (/usr/lib/libdl-2.24.so)
                    1521 [unknown] (/usr/lib/libdl-2.24.so)
                    f3a4 _dl_catch_error+0xffff00eae958c074 (/usr/lib/
ld-2.24.so)
                     ee9 [unknown] (/usr/lib/libdl-2.24.so)
                   132d9 _dl_open+0xffff00eae958c0c9 (/usr/lib/ld-2.24.so)
                    f3a4 _dl_catch_error+0xffff00eae958c074 (/usr/lib/
ld-2.24.so)
                   1385d dl_open_worker+0xffff00eae958c11d (/usr/lib/
ld-2.24.so)
                    d005 _dl_map_object_deps+0xffff00eae958c275 (/usr/lib/
ld-2.24.so)
                    f3a4 _dl_catch_error+0xffff00eae958c074 (/usr/lib/
ld-2.24.so)
                    cd80 openaux+0xffff00eae958c030 (/usr/lib/ld-2.24.so)
                    83fd _dl_map_object+0xffff00eae958c08d (/usr/lib/
ld-2.24.so)
                   105d4 _dl_name_match_p+0xffff00eae958c044 (/usr/lib/
ld-2.24.so)
                   1964c strcmp+0xffff00eae958c00c (/usr/lib/ld-2.24.so)
Quoted 5 lines

This breaks consumers of the perf script output who want to feed the IP address into addr2line, most notably stackcollapse-perf.

Namhyung, how do you propose to fix this issue, while keeping -g address function in reports?

This is odd... On a different machine of mine which runs the same distribution I get very different results... I'm compiling my test binary with the same gcc (GCC) 6.1.1 20160802, against the same libraries.

One one machine I see:

$ dwarfdump /home/milian/projects/kdab/training-material/addon/profiling/
build/lab_mandelbrot/src/lab_mandelbrot | grep low_pc | awk '{print $2}'  | 
head -n 10

0x00000000
0x00403c50
0x00403ca1
0x00403ca1
0x00403cb5
0x00403cbb
0x00403cbb
0x00403cbb
0x00403cbb
0x00403cbb

^-- here, addr2line won't work when we pass e.g. just 3c50, we must pass 403c50 and that is currently broken in the perf script output.

But on my laptop I see this:

$ dwarfdump /home/milian/projects/kdab/training-material/addon/profiling/
build/lab_mandelbrot/src/lab_mandelbrot | grep low_pc | awk '{print $2}'  | 
head -n 10

0x00000000
0x000039f0
0x00003a50
0x00003a50
0x00003a65
0x00003a6b
0x00003a6b
0x00003a6b
0x00003a6b
0x00003a6b

^-- here, the current perf script output is OK and we can simply pass e.g. 39f0...

I've checked, the compiler flags are also the same on both platforms... Can someone explain me why I'm seeing this? I was trying to fix the issue by adding node->map->start to the IP reported in sample__fprintf_callchain. But considering it currently works on one machine and is broken on a second, I'm not sure which version is correct...

Thanks

Signature · 4 lines
Milian Wolff | [email protected] | Software Engineer
KDAB (Deutschland) GmbH&Co KG, a KDAB Group company
Tel: +49-30-521325470
KDAB - The Qt Experts