|
From: Raul G. <rau...@ma...> - 2015-02-17 20:22:51
Attachments:
callgrind.txt
callgrind.out.3615
|
Hello world_perftest! |
|
From: Josef W. <Jos...@gm...> - 2015-02-18 09:44:41
|
Am 17.02.2015 um 21:22 schrieb Raul Garcia: > I am a new user, I am doing a "hello world" test of Valgrind but i keep > hitting this error: > ... > 2,709 *???*:getenv [/home/otro/arm_emulator/hello_x86] The "???" are not really any errors, but a sign that for these functions, valgrind could not locate debug information providing a source file name. > This is the command that I used, as you can see I used -g and -O0 > options as suggested. > > $ gcc -static -g -O0 hello.c -o hello_x86 getenv above is from glibc, and you seem not to have debug information installed for the statically linkable glibc. "-O0" or "-g" does not help here, because the issue is with an already compiled library. Does it work if you remove "-static"? I have no idea if Ubuntu provides debug info for libc.a ... > But when I try to see the analysis with callgrind I get: > > Ir > -------------------------------------------------------------------------------- > 11,737 PROGRAM TOTALS > > -------------------------------------------------------------------------------- > Ir file:function > -------------------------------------------------------------------------------- > 2,709 ???:getenv [/home/otro/arm_emulator/hello_x86] > 1,133 ???:_int_malloc [/home/otro/arm_emulator/hello_x86] > 813 ???:intel_check_word [/home/otro/arm_emulator/hello_x86] > 792 ???:malloc_consolidate [/home/otro/arm_emulator/hello_x86] > 783 ???:_IO_file_overflow [/home/otro/arm_emulator/hello_x86] > 555 ???:strncmp [/home/otro/arm_emulator/hello_x86] > 435 ???:ptmalloc_init.part.7 [/home/otro/arm_emulator/hello_x86] > 361 ???:(below main) [/home/otro/arm_emulator/hello_x86] > 342 ???:_IO_default_xsputn [/home/otro/arm_emulator/hello_x86] > 311 ???:_dl_init_paths [/home/otro/arm_emulator/hello_x86] > > And I cant see the cost of the functions . What can be the problem? Some > logs are attached, i hope they are helpful. Self cost is there. To see inclusive costs, you need to use "callgrind_annotate --inclusive=yes ...". And "--tree=both" shows a butterfly output of the call graph. I would suggest do use kcachegrind/qcachegrind to visualize callgrind results. Josef |
|
From: Azat K. <a3a...@gm...> - 2015-02-18 10:03:07
|
On Wed, Feb 18, 2015 at 10:44:27AM +0100, Josef Weidendorfer wrote: > Am 17.02.2015 um 21:22 schrieb Raul Garcia: > > I am a new user, I am doing a "hello world" test of Valgrind but i keep > > hitting this error: > > ... > > 2,709 *???*:getenv [/home/otro/arm_emulator/hello_x86] > > The "???" are not really any errors, but a sign that for these functions, > valgrind could not locate debug information providing a source file name. > > > This is the command that I used, as you can see I used -g and -O0 > > options as suggested. > > > > $ gcc -static -g -O0 hello.c -o hello_x86 > > getenv above is from glibc, and you seem not to have debug information > installed for the statically linkable glibc. > "-O0" or "-g" does not help here, because the issue is with an already > compiled library. > Does it work if you remove "-static"? I have no idea if Ubuntu provides > debug info for libc.a ... Debian do provides, so I guess that ubuntu too: libc6-dev: /usr/lib/x86_64-linux-gnu/libc.a > > > But when I try to see the analysis with callgrind I get: > > > > Ir > > -------------------------------------------------------------------------------- > > 11,737 PROGRAM TOTALS > > > > -------------------------------------------------------------------------------- > > Ir file:function > > -------------------------------------------------------------------------------- > > 2,709 ???:getenv [/home/otro/arm_emulator/hello_x86] > > 1,133 ???:_int_malloc [/home/otro/arm_emulator/hello_x86] > > 813 ???:intel_check_word [/home/otro/arm_emulator/hello_x86] > > 792 ???:malloc_consolidate [/home/otro/arm_emulator/hello_x86] > > 783 ???:_IO_file_overflow [/home/otro/arm_emulator/hello_x86] > > 555 ???:strncmp [/home/otro/arm_emulator/hello_x86] > > 435 ???:ptmalloc_init.part.7 [/home/otro/arm_emulator/hello_x86] > > 361 ???:(below main) [/home/otro/arm_emulator/hello_x86] > > 342 ???:_IO_default_xsputn [/home/otro/arm_emulator/hello_x86] > > 311 ???:_dl_init_paths [/home/otro/arm_emulator/hello_x86] > > > > And I cant see the cost of the functions . What can be the problem? Some > > logs are attached, i hope they are helpful. > > Self cost is there. > To see inclusive costs, you need to use "callgrind_annotate > --inclusive=yes ...". > And "--tree=both" shows a butterfly output of the call graph. > > I would suggest do use kcachegrind/qcachegrind to visualize callgrind > results. > > Josef |
|
From: Josef W. <Jos...@gm...> - 2015-02-18 10:57:01
|
Am 18.02.2015 um 11:02 schrieb Azat Khuzhin: >> Does it work if you remove "-static"? I have no idea if Ubuntu provides >> debug info for libc.a ... > > Debian do provides, so I guess that ubuntu too: > libc6-dev: /usr/lib/x86_64-linux-gnu/libc.a That file on Ubuntu 14.10 (I am running this here) does not have debug info: ~> objdump -h /usr/lib/x86_64-linux-gnu/libc.a | grep debug_ ~> Can you check this on Debian? Ubuntu splits off debug info into -dbg files. For shared libc it's libc6-dbg. ~> objdump -h /usr/lib/debug/lib/x86_64-linux-gnu/libc-2.19.so | grep debug_ 68 .debug_aranges 000112b0 0000000000000000 0000000000000000 000017e0 2**4 69 .debug_info 003fcbf8 0000000000000000 0000000000000000 00012a90 2**0 70 .debug_abbrev 000968a2 0000000000000000 0000000000000000 0040f688 2**0 71 .debug_line 000c147a 0000000000000000 0000000000000000 004a5f2a 2**0 72 .debug_str 0002534c 0000000000000000 0000000000000000 005673a4 2**0 73 .debug_loc 00247f70 0000000000000000 0000000000000000 0058c6f0 2**0 74 .debug_ranges 0004b7d0 0000000000000000 0000000000000000 007d4660 2**4 But libc6-dbg has nothing about the static libc. Josef |
|
From: Azat K. <a3a...@gm...> - 2015-02-18 11:23:56
|
On Wed, Feb 18, 2015 at 11:56:51AM +0100, Josef Weidendorfer wrote: > Am 18.02.2015 um 11:02 schrieb Azat Khuzhin: > >> Does it work if you remove "-static"? I have no idea if Ubuntu provides > >> debug info for libc.a ... > > > > Debian do provides, so I guess that ubuntu too: > > libc6-dev: /usr/lib/x86_64-linux-gnu/libc.a My mistake I misread previous mail, there are no debug symbols in libc.a. >From glibc-deb-svn/trunk/debian/rules: NOSTRIP_$(libc)-dbg = 1 > > That file on Ubuntu 14.10 (I am running this here) does not have debug info: > > ~> objdump -h /usr/lib/x86_64-linux-gnu/libc.a | grep debug_ > ~> > > Can you check this on Debian? > > Ubuntu splits off debug info into -dbg files. For shared libc it's > libc6-dbg. > > ~> objdump -h /usr/lib/debug/lib/x86_64-linux-gnu/libc-2.19.so | grep > debug_ > 68 .debug_aranges 000112b0 0000000000000000 0000000000000000 > 000017e0 2**4 > 69 .debug_info 003fcbf8 0000000000000000 0000000000000000 00012a90 > 2**0 > 70 .debug_abbrev 000968a2 0000000000000000 0000000000000000 0040f688 > 2**0 > 71 .debug_line 000c147a 0000000000000000 0000000000000000 004a5f2a > 2**0 > 72 .debug_str 0002534c 0000000000000000 0000000000000000 005673a4 > 2**0 > 73 .debug_loc 00247f70 0000000000000000 0000000000000000 0058c6f0 > 2**0 > 74 .debug_ranges 0004b7d0 0000000000000000 0000000000000000 007d4660 > 2**4 > > But libc6-dbg has nothing about the static libc. > > Josef |
|
From: Josef W. <Jos...@gm...> - 2015-02-18 12:58:28
|
Am 18.02.2015 um 12:23 schrieb Azat Khuzhin: > On Wed, Feb 18, 2015 at 11:56:51AM +0100, Josef Weidendorfer wrote: >> Am 18.02.2015 um 11:02 schrieb Azat Khuzhin: >>>> Does it work if you remove "-static"? I have no idea if Ubuntu provides >>>> debug info for libc.a ... >>> >>> Debian do provides, so I guess that ubuntu too: >>> libc6-dev: /usr/lib/x86_64-linux-gnu/libc.a > > My mistake I misread previous mail, there are no debug symbols in > libc.a. > >>From glibc-deb-svn/trunk/debian/rules: > NOSTRIP_$(libc)-dbg = 1 Ah, ok. But does the -dbg package contain debug info for static libc? That's not the case on Ubuntu. Anyway, this issue seems not to be a problem with Valgrind. Josef |
|
From: Azat K. <a3a...@gm...> - 2015-02-18 13:13:42
|
On Wed, Feb 18, 2015 at 01:58:21PM +0100, Josef Weidendorfer wrote: > Am 18.02.2015 um 12:23 schrieb Azat Khuzhin: > > On Wed, Feb 18, 2015 at 11:56:51AM +0100, Josef Weidendorfer wrote: > >> Am 18.02.2015 um 11:02 schrieb Azat Khuzhin: > >>>> Does it work if you remove "-static"? I have no idea if Ubuntu provides > >>>> debug info for libc.a ... > >>> > >>> Debian do provides, so I guess that ubuntu too: > >>> libc6-dev: /usr/lib/x86_64-linux-gnu/libc.a > > > > My mistake I misread previous mail, there are no debug symbols in > > libc.a. > > > >>From glibc-deb-svn/trunk/debian/rules: > > NOSTRIP_$(libc)-dbg = 1 > > Ah, ok. But does the -dbg package contain debug info for static libc? > That's not the case on Ubuntu. No, libc-dbg didn't contain debug info for static libc. > Anyway, this issue seems not to be a problem with Valgrind. Yep. |