2

I am trying to use the callgrind profiler to profile my C++ program. I am using Valgrind version 3.6,1 on Linux Centos Version 5.5 on a Intel 32-bit processor. I keep getting the following error(shown below) when I try to profile my program. I already used Linux gprof but it didn't provide any useful profiling information. Please tell me what I am doing wrong or what workaround I should use. Thank you

valgrind --tool=callgrind --dump-instr=yes --simulate-cache-yes --collect-jumps=yes ./MatchUpAccurate.exe -input /home/frankc/DQTTest5/MatchUpTest/TestData/mdata2003.dbf -fileloc /home/frankc/DQTTest5/MatchUpTest/TestData -version 15,

==25558== Callgrind, a call-graph generating cache profiler, ==25558== Copyright (C) 2002-2010, and GNU GPL'd, by Josef Weidendorfer et al., ==25558== Using Valgrind-3.6.1 and LibVEX; rerun with -h for copyright info, ==25558== Command: ./MatchUpAccurate.exe -input /home/frankc/DQTTest5/MatchUpTest/TestData/mdata2003.dbf -fileloc /home/frankc/DQTTest5/MatchUpTest/TestData -version 15, ==25558==, ==25558== For interactive control, run 'callgrind_control -h'., memcpy, BB# 486126,

Callgrind: jumps.c:164 (new_jcc): Assertion '(0 <= jmp) && (jmp <= from->bb->cjmp_count)' failed., ==25558== at 0x3801E4C8: report_and_quit (m_libcassert.c:193), ==25558== by 0x3801E69C: vgPlain_assert_fail (m_libcassert.c:267), ==25558== by 0x3800FCD9: vgCallgrind_get_jcc (jumps.c:164), ==25558== by 0x38003534: vgCallgrind_push_call_stack (callstack.c:217), ==25558== by 0x38001FDB: vgCallgrind_setup_bbcc (bbcc.c:844), ==25558== by 0x629B9E93: ???,

sched status:, running_tid=1,

Thread 1: status = VgTs_Runnable, ==25558== at 0xB64A30: memcpy (in /lib/libc-2.5.so), ==25558== by 0xC845D3: __pthread_initialize_minimal (in /lib/libpthread-2.5.so), ==25558== by 0xC84217: ??? (in /lib/libpthread-2.5.so), ==25558== by 0xC83DA7: ??? (in /lib/libpthread-2.5.so), ==25558== by 0xAE2162: call_init (in /lib/ld-2.5.so), ==25558== by 0xAE228F: _dl_init (in /lib/ld-2.5.so), ==25558== by 0xAD484E: ??? (in /lib/ld-2.5.so),

Note: see also the FAQ in the source distribution., It contains workarounds to several common problems., In particular, if Valgrind aborted or crashed after, identifying problems in your program, there's a good chance, that fixing those problems will prevent Valgrind aborting or, crashing, especially if it happened in m_mallocfree.c.,

If that doesn't help, please report this bug to: www.valgrind.org,

In the bug report, send all the above text, the valgrind, version, and what OS and version you are using. Thanks.

Frank
  • 1,406
  • 2
  • 16
  • 42
  • mmmm what is the version of libc on the host? Is it a vm or physical? I guess it is gonna be a ABI/version conflict of libc. If you cannot figure it out, just report it. Chances are, a dev will be able to tell you in 5 seconds – sehe Apr 21 '11 at 20:57
  • sehe, Thank you for your response. In order to determine what version of libc is on the Centos Linux 5.5 host, I tried: rpm -qa | grep glibc. The response was: glibc-devel-2.5-49.el5_5.7 glibc-2.5-49.el5_5.7 glibc-headers-2.5-49.el5_5.7 glibc-common-2.5-49.el5_5.7 sehe, can you tell if it is vm or physical? Do I have a version conflict with libc? Thank you. – Frank Apr 21 '11 at 21:10
  • Last night, I wrote a simple program using the fibonacci function, I tried profiling the program with valgrind/callgrind 3.6.1 but callgrind complained about std::ios_base::Init::Init() (in /usr/lib/libstdc++.so.6.0.8). I just received an email from a programmer who got some results using Valgrind/Callgrind 3.6.0 Ubuntu. Why does Callgrind work on Ubuntu and not Centos Linux 5.5? Thank you – Frank Apr 22 '11 at 15:01
  • I received an email from centos.org. Centos says callgrind works on Centos Linux 5.5 x86_64 using glibc-2.5-58.el5_6.2.x86_64 glibc-2.5-58.el5_6.2.i686, glibc-devel-2.5-58.el5_6.2.x86_64 glibc-devel-2.5-58.el5_6.2.i386. However , I am using Centos Linux x86_32 using glibc-2.5.49.el5_57 glibc-devel-2.5.49.el5-5.7. Does anyone know how to workaround around the libc version mismatch on Centos x86_32? Thank you. – Frank Apr 25 '11 at 12:26
  • I decided to switch to OReport from callgrind this past weekend. I installed OReport on our x86_32 Centos Linux 5.5 release. Oreport has many more options that callgrind so there is a lot to learn. However, today I managed to get a very good OReport profile of a very complicated program which our company is developing. Sehe, thank you for pointing out the libc mismatch problem on callgrind. – Frank Apr 26 '11 at 01:44
  • Thanks for suggesting opeport (I had all but forgotten about it); I'm sorry I couldn't be of more help (didn't have any CentOS image lying around anymore) – sehe Apr 26 '11 at 06:31

1 Answers1

1

Good evening, I received an email from the Callgrind Engineer, Josef Weidenorfer. Josef sent me a valgrind/callgrind patch to fix my callgrind problem. Here is the patch(shown below). I just applied the patch and rebuilt valgrind/callgrind. Now callgrind can profile the fibonacci(25) function on Centos Linux 5.5. Thank you.

--- a/callgrind/bbcc.c
+++ b/callgrind/bbcc.c
@@ -693,6 +693,7 @@ void CLG_(setup_bbcc)(BB* bb)
               /* change source for delayed push */
               CLG_(current_state).bbcc = top_ce->jcc->from;
               sp = top_ce->sp;
+               passed = top_ce->jcc->jmp;
               CLG_(pop_call_stack)();
           }
           else {
@@ -841,6 +841,7 @@ void CLG_(setup_bbcc)(BB* bb)
    if (!skip && CLG_(current_state).nonskipped) {
      /* a call from skipped to nonskipped */
      CLG_(current_state).bbcc = CLG_(current_state).nonskipped;
+      passed = CLG_(current_state).bbcc->bb->cjmp_count;
    }
    CLG_(push_call_stack)(CLG_(current_state).bbcc, passed,
                        bbcc, sp, skip);
larsr
  • 5,447
  • 19
  • 38
Frank
  • 1,406
  • 2
  • 16
  • 42