On 11/13/2015 10:54 AM, Jan Kubalek wrote: > Hi :), > > I have a prog. with pthread semaphores. Everything works fine, but i > have a small problem with valgring. > > If I commpile my program with > gcc -gdwarf-2 -O0 -static main.c -lpthread > and run as > valgrind --tool=helgrind --read-var-info=yes ./a.out > I get > ==15757== Process terminating with default action of signal 11 (SIGSEGV) > ==15757== Access not within mapped region at address 0xFFFFFFFFFFFFFFF8 > ==15757== at 0x4010B8: main (main.c:39) > ==15757== If you believe this happened as a result of a stack > ==15757== overflow in your program's main thread (unlikely but > ==15757== possible), you can try to increase the size of the > ==15757== main thread stack using the --main-stacksize= flag. > ==15757== The main thread stack size used in this run was 8388608. > > (on line 39 there is sem_post(sem), where sem is valid pointer on the > semaphore which is created by sem_open("test", O_CREAT, S_IRWXU, 1)) > > Is this normal? I am really confused... > > > Thanks, > John > (and sorry fo my english :D) > >
What happens if you compile without "-static"? Valgrind wants to replace system libraries with its own versions so that it can trace memory allocation and release. It does so at runtime, so static linking is not good for it. -- David Chapman dcchap...@acm.org Chapman Consulting -- San Jose, CA Software Development Done Right. www.chapman-consulting-sj.com ------------------------------------------------------------------------------ _______________________________________________ Valgrind-users mailing list Valgrind-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/valgrind-users