How to use callgrind on Centos Linux 5.5
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_开发者_JS百科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.
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);
精彩评论