Menu

#9 Callgrind: threads.c

open
nobody
5
2005-01-10
2005-01-10
Rob Wallace
No

Callgrind aborts in threads.c:

Callgrind: threads.c:251 (vgSkin_post_signal):
Assertion `*(vgSkin_current_fn_stack.top) == 0' failed.
==6977== at 0xB002BFEF: vgPlain_skin_assert_fail (in
/usr/lib/valgrind/stage2)
==6977== by 0xB002BFEE: (within
/usr/lib/valgrind/stage2)
==6977== by 0xB002C00E: vgPlain_skin_assert_fail (in
/usr/lib/valgrind/stage2)
==6977== by 0xB116C2F7: vgSkin_post_signal
(threads.c:257)

sched status:

Thread 1: status = Runnable, associated_mx = 0x0,
associated_cv = 0x0
==6977== at 0x804C1AA: critdsp (disp.c:207)
==6977== by 0x3AD5E79C: __libc_start_main (in
/lib/tls/libc-2.3.2.so)
==6977== by 0x804BAC0: (within
/data1/itemsdev/dist/items/bin/sp0c0.exe)

Note: see also the FAQ.txt in the source distribution.
It contains workarounds to several common problems.

If that doesn't help, please report this bug to:
Josef.Weidendorfer@gmx.de

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

Using:
callgrind-0.9.10
valgrind-2.2.0
glibc-2.3.2-95.27
gcc-3.4.2-2.el3
kernel-2.4.21-20.EL
RedHat Enterprise 3

Discussion

  • Koen Meersman

    Koen Meersman - 2005-03-14

    Logged In: YES
    user_id=1238690

    Hello,

    we have seen the same:

    Software verions used:
    ----------------------
    Valgrind: valgrind-2.4.0.rc2.tar.bz2
    Callgrind: CVS HEAD version of 11 Mars 2005

    Platform
    --------
    tench:/net/ganet/disc1/home/mea/tmp/callgrind> uname -a
    Linux tench.sup.cfmu.eurocontrol.be 2.4.9-e.27CFMU-sg #1 SMP
    Thu Jun 10 12:25:19 METDST 2004 i686 unknown

    tench:/etc> cat /etc/redhat-release
    Red Hat Linux Advanced Server release 2.1AS (Pensacola)

    Compiler used:
    --------------
    tench:/net/ganet/disc1/home/mea> gcc --version
    gcc (GCC) 3.4.4 20041122 (prerelease)
    Copyright (C) 2004 Free Software Foundation, Inc.
    This is free software; see the source for copying
    conditions. There is NO
    warranty; not even for MERCHANTABILITY or FITNESS FOR A
    PARTICULAR PURPOSE.

    mkdir work
    cd work
    tar -xvjf ../sources/valgrind-2.4.0.rc2.tar.bz2
    cd valgrind-2.4.0.rc2
    ./configure --prefix=/net/ganet/disc1/home/mea/tmp/callgrind
    make
    make install
    cd ..
    export PATH=/net/ganet/disc1/home/mea/tmp/callgrind/bin:$PATH
    export
    PKG_CONFIG_PATH=/net/ganet/disc1/home/mea/tmp/callgrind/lib/pkgconfig

    tar -xvjf ../sources/callgrind-20050311.tar.bz2
    cd callgrind
    ./autogen.sh
    ./configure --prefix=/net/ganet/disc1/home/mea/tmp/callgrind
    make
    make install

    cd /net/ganet/disc1/home/mea/tmp/
    mkdir run
    cd run

    callgrind ls -l /usr/bin
    -> OK, is working

    Testprog
    -------- test.c (got it somewhere on the internet)
    /* pthread.c by detour@metalshell.com
    *
    * Create multiple POSIX thread processes and wait for
    * each one to complete.
    *
    * http://www.metalshell.com/
    *
    */

    #include <unistd.h>
    #include <pthread.h>
    #include <stdio.h>
    #include <time.h>

    #define NUM_THREADS 10

    /* This becomes the main() of the new thread. It
    is requred to return void * and take void * as a
    parameter. */
    void *thread_function(void *arg) {
    fprintf(stdout, "Thread: %d running.\n", (int)arg);

    // Sleep for arg+1 seconds to verify pthread_join.

    sleep((int)arg+1);

    fprintf(stdout, "Thread: %d done.\n", (int)arg);

    pthread_exit(0);
    }

    int main() {
    int cnt;
    pthread_t p_thread[NUM_THREADS];

    for(cnt = 0; cnt < NUM_THREADS; cnt++)
    /* Returns 0 on successful creation of the thread. The
    second
    parameter, left NULL for this example, allows for
    options
    like CPU scheduling to be set. */
    if(pthread_create(&p_thread[cnt], NULL, thread_function,
    (void *)cnt) != 0)
    fprintf(stderr, "Error creating the thread");

    // Cycle through each thread and wait until it is completed.

    for(cnt = 0; cnt < NUM_THREADS; cnt++) {
    // Waits for p_thread[cnt] to finish.

    pthread_join(p_thread[cnt], NULL);
    }

    fprintf(stdout, "All threads completed.\n");

    return 0;
    }

    Compilation and test
    --------------------

    cd test
    gcc -g test.c -o test -lpthread

    tench:/net/ganet/disc1/home/mea/tmp/callgrind/test> whence test
    test
    tench:/net/ganet/disc1/home/mea/tmp/callgrind/test>
    callgrind ./test
    ==6868== Callgrind-0.9.11, a call-graph generating cache
    profiler for x86-linux.
    ==6868== Copyright (C) 2002-2004, and GNU GPL'd, by
    J.Weidendorfer, N.Nethercote et al.
    ==6868== Using valgrind-2.4.0.rc2, a program supervision
    framework for x86-linux.
    ==6868== Copyright (C) 2000-2005, and GNU GPL'd, by Julian
    Seward et al.
    --6868-- warning: L3 cache detected but ignored

    --6868-- warning: Pentium with 12 K micro-op instruction
    trace cache
    --6868-- Simulating a 16 KB cache with 32 B lines
    ==6868== For more details, rerun with: -v
    ==6868==
    Thread: 0 running.
    0x0002EA28
    BB# 81558

    Callgrind: threads.c:251 (vgSkin_post_signal): Assertion
    `*(vgSkin_current_fn_stack.top) == 0' failed.
    ==6868== at 0xB003514B: vgPlain_skin_assert_fail
    (vg_mylibc.c:1170)
    ==6868== by 0xB003514A: assert_fail (vg_mylibc.c:1166)
    ==6868== by 0xB0035182: vgPlain_skin_assert_fail
    (vg_mylibc.c:1171)
    ==6868== by 0xB118DE1C: vgSkin_post_signal (threads.c:267)
    ==6868== by 0xB00785E6:
    vgSkinInternal_post_deliver_signal (vg_toolint.c:500)
    ==6868== by 0xB008FC87: vgArch_signal_return (signal.c:640)
    ==6868== by 0xB008E6E6: x86_linux_sys_sigreturn_before
    (syscalls.c:584)
    ==6868== by 0xB005F4CA: vgPlain_client_syscall
    (vg_syscalls.c:6138)
    ==6868== by 0xB001754C: handle_syscall (vg_scheduler.c:632)
    ==6868== by 0xB001786F: vgPlain_scheduler
    (vg_scheduler.c:733)
    ==6868== by 0xB00905FD: vgArch_thread_wrapper (core_os.c:69)

    sched status:
    running_tid=1

    Thread 1: status = VgTs_Runnable
    ==6868== at 0x3A9D4C85: sigsuspend (in /lib/libc-2.2.4.so)
    ==6868== by 0x3A997C18: (within /lib/libpthread-0.9.so)
    ==6868== by 0x3A997CFB: pthread_create (in
    /lib/libpthread-0.9.so)
    ==6868== by 0x80485DF: main (test.c:40)

    Thread 2: status = VgTs_WaitSys
    ==6868== at 0x3AA8DB97: poll (in /lib/libc-2.2.4.so)
    ==6868== by 0x3A994CEF: (within /lib/libpthread-0.9.so)
    ==6868== by 0x3AA95829: clone (in /lib/libc-2.2.4.so)

    Thread 3: status = VgTs_WaitSys
    ==6868== at 0x3AA61CB1: nanosleep (in /lib/libc-2.2.4.so)
    ==6868== by 0x804856D: thread_function (test.c:25)
    ==6868== by 0x3A994FAE: (within /lib/libpthread-0.9.so)
    ==6868== by 0x3AA95829: clone (in /lib/libc-2.2.4.so)

    Thread 4: status = VgTs_Runnable
    ==6868== at 0x3AA9581E: clone (in /lib/libc-2.2.4.so)

    Note: see also the FAQ.txt in the source distribution.
    It contains workarounds to several common problems.

    If that doesn't help, please report this bug to:
    Josef.Weidendorfer@gmx.de

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

    tench:/net/ganet/disc1/home/mea/tmp/callgrind/test>

     
  • Koen Meersman

    Koen Meersman - 2005-04-28

    Logged In: YES
    user_id=1238690

    Hi,

    I've done the same test using the following:

    Fedora Core release 3 (Heidelberg)
    using:
    kerel-2.6.9-1.667
    callgrind-0.9.11
    valgrind-2.4.0
    gcc-3.4.2-6.fc3
    glibc-2.3.3-74

    but the result is the same:
    Assertion `*(vgSkin_current_fn_stack.top) == 0' failed.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.