Bug 273465 - Callgrind: jumps.c:164 (new_jcc): Assertion '(0 <= jmp) && (jmp <= from->bb->cjmp_count)' failed.
Summary: Callgrind: jumps.c:164 (new_jcc): Assertion '(0 <= jmp) && (jmp <= from->bb->...
Status: RESOLVED FIXED
Alias: None
Product: valgrind
Classification: Developer tools
Component: callgrind (show other bugs)
Version: 3.6.0
Platform: Compiled Sources Linux
: NOR crash
Target Milestone: ---
Assignee: Josef Weidendorfer
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-17 08:49 UTC by Christian Matuszewski
Modified: 2011-10-17 17:11 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Christian Matuszewski 2011-05-17 08:49:55 UTC
Version:           3.6.0
OS:                Linux

uname -a: Linux sbcmp1 2.6.9-78.0.1.ELsmp #1 SMP Tue Jul 22 18:11:48 EDT 2008 i686 i686 i386 GNU/Linux

valgrind output:
==26194== Callgrind, a call-graph generating cache profiler
==26194== Copyright (C) 2002-2010, and GNU GPL'd, by Josef Weidendorfer et al.
==26194== Using Valgrind-3.6.1 and LibVEX; rerun with -h for copyright info
==26194== Command: bin/common_test
==26194==
==26194== For interactive control, run 'callgrind_control -h'.
memcpy
BB# 378333

Callgrind: jumps.c:164 (new_jcc): Assertion '(0 <= jmp) && (jmp <= from->bb->cjmp_count)' failed.
==26194==    at 0x3801982D: report_and_quit (m_libcassert.c:193)
==26194==    by 0x38019908: vgPlain_assert_fail (m_libcassert.c:267)
==26194==    by 0x3800D863: vgCallgrind_get_jcc (jumps.c:164)
==26194==    by 0x3800297F: vgCallgrind_push_call_stack (callstack.c:217)
==26194==    by 0x38001C29: vgCallgrind_setup_bbcc (bbcc.c:844)
==26194==    by 0x62CE1D43: ???

sched status:
  running_tid=1

Thread 1: status = VgTs_Runnable
==26194==    at 0xAAD2C0: memcpy (in /lib/tls/libc-2.3.4.so)
==26194==    by 0xCA55A8: __pthread_initialize_minimal (in /lib/tls/libpthread-2.3.4.so)
==26194==    by 0xCA52D7: ??? (in /lib/tls/libpthread-2.3.4.so)
==26194==    by 0xCA4EA7: ??? (in /lib/tls/libpthread-2.3.4.so)
==26194==    by 0xA349A1: _dl_init (in /lib/ld-2.3.4.so)
==26194==    by 0xA287FE: ??? (in /lib/ld-2.3.4.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.


Reproducible: Always
Comment 1 Josef Weidendorfer 2011-05-17 11:16:20 UTC
That should be fixed in the current SVN version. Can you check that?
Comment 2 Julian Seward 2011-10-12 10:29:36 UTC
Any update on this?
Comment 3 Ugo Riboni 2011-10-14 15:30:52 UTC
I can still reproduce this in 3.6.1

On ARM the bug happens on any program I try, including a trivial program with the following content:
int main() { return 1; }
Comment 4 Josef Weidendorfer 2011-10-14 16:45:22 UTC
Can you check the version from SVN trunk?
To become 3.7.0...
Comment 5 Peter Maydell 2011-10-14 17:37:50 UTC
I tried checking svn trunk but it doesn't compile :-)

make[3]: Entering directory `/root/valgrind/coregrind'
gcc -O2 -g -Wall -Wmissing-prototypes -Wshadow -Wpointer-arith -Wstrict-prototypes -Wmissing-declarations -Wno-format-zero-length -fno-strict-aliasing -fno-builtin -marm -mcpu=cortex-a8 -Wno-long-long  -Wno-pointer-sign -fno-stack-protector -O2 -g -Wall -Wmissing-prototypes -Wshadow -Wpointer-arith -Wstrict-prototypes -Wmissing-declarations -Wno-format-zero-length -fno-strict-aliasing -fno-builtin -marm -mcpu=cortex-a8 -lpthread   -o vgdb vgdb-vgdb.o
vgdb-vgdb.o: In function `close_connection':
/root/valgrind/coregrind/vgdb.c:1695: undefined reference to `pthread_join'
vgdb-vgdb.o: In function `received_signal':
/root/valgrind/coregrind/vgdb.c:1592: undefined reference to `pthread_cancel'
vgdb-vgdb.o: In function `standalone_send_commands':
/root/valgrind/coregrind/vgdb.c:1841: undefined reference to `pthread_create'
vgdb-vgdb.o: In function `gdb_relay':
/root/valgrind/coregrind/vgdb.c:1718: undefined reference to `pthread_create'
vgdb-vgdb.o: In function `invoke_gdbserver_in_valgrind':
/root/valgrind/coregrind/vgdb.c:1161: undefined reference to `__pthread_register_cancel'
/root/valgrind/coregrind/vgdb.c:1251: undefined reference to `__pthread_unregister_cancel'
collect2: ld returned 1 exit status

(adding another "-lpthread" at the end of the gcc command line got it past this, and yes, that callgrind seems to work on the trivial example that 3.6.1 barfs on.)
Comment 6 Philippe Waroquiers 2011-10-14 22:26:22 UTC
(In reply to comment #5)
> I tried checking svn trunk but it doesn't compile :-)
Does not link :).

Can you try the below patch (and re-run ./autogen.sh; ./configure; make)

Thanks

Index: coregrind/Makefile.am
===================================================================
--- coregrind/Makefile.am	(revision 12160)
+++ coregrind/Makefile.am	(working copy)
@@ -58,7 +58,7 @@
 vgdb_CCASFLAGS = $(AM_CCASFLAGS_PRI)
 vgdb_LDFLAGS   = $(AM_CFLAGS_PRI)
 if !VGCONF_PLATVARIANT_IS_ANDROID
-vgdb_LDFLAGS   += -lpthread
+vgdb_LDADD      = -lpthread
 endif
 if VGCONF_PLATFORMS_INCLUDE_X86_DARWIN
 vgdb_LDFLAGS   += -Wl,-read_only_relocs -Wl,suppress
Comment 7 Ugo Riboni 2011-10-17 08:05:12 UTC
@Philippe Apparently the patch was a(In reply to comment #6)
> (In reply to comment #5)
> > I tried checking svn trunk but it doesn't compile :-)
> Does not link :).
> 
> Can you try the below patch (and re-run ./autogen.sh; ./configure; make)

Apparently the patch has already been applied in SVN.
I'm trying building on my ARM system and if it builds testing it. I'll report results as soon as it's done.
Comment 8 Ugo Riboni 2011-10-17 08:39:07 UTC
It built just fine and is running too.

The only issue is that when I examine the callgrind.out files with kcachegrind all the function names in my executable are displayed as hex numbers, but those in other libraries (e.g. libc) are displayed as proper function names.

I'm not sure if it's a problem with kcachegrind, my executable or callgrind itself.
Comment 9 Christian Matuszewski 2011-10-17 09:45:55 UTC
I just built the SVN version and run callgrind on the original problem.
It's now working fine (without a failing assertion).

The function names in kcachegrind (version 0.4.5) are mostly O.K. (only a few functions which are called before main are displayed as hex numbers).
Comment 10 Josef Weidendorfer 2011-10-17 17:11:21 UTC
Ok, thanks.

Callgrind gets the symbol names from the debug info reader
of Valgrind core. So failing to do that on ARM is unrelated
to this bug report (perhaps you are not using DWARF?).

Closing.