Home Valgrind shows question marks
Reply: 1

Valgrind shows question marks

tyebillion
1#
tyebillion Published in 2018-01-12 17:26:14Z

I have compiled a program using Code::Blocks. I have turned on "produce debugging symbols" under the "Debug" target, and also turned off "strip all symbols..." But when I run the program with Valgrind I get question marks in the output:

$ valgrind --leak-check=yes --track-origins=yes --log-file=valgrind_output.txt
~/bin/myprg

==3766== Memcheck, a memory error detector
==3766== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
==3766== Using Valgrind-3.11.0 and LibVEX; rerun with -h for copyright info
==3766== Command: /home/xxxxxx/bin/myprg
==3766== Parent PID: 3209
==3766== 
==3766== Warning: client switching stacks?  SP change: 0xffefff978 --> 0xffed13da0
==3766==          to suppress, use: --max-stackframe=3062744 or greater
==3766== Invalid write of size 4
==3766==    at 0x40892B: ??? (in /home/xxxxxx/bin/myprg)
==3766==    by 0x40275C: ??? (in /home/xxxxxx/bin/myprg)
==3766==    by 0x56FB82F: (below main) (libc-start.c:291)
==3766==  Address 0xffed13ddc is on thread 1's stack
==3766== 
==3766== Invalid write of size 4
==3766==    at 0x408931: ??? (in /home/xxxxxx/bin/myprg)
==3766==    by 0x40275C: ??? (in /home/xxxxxx/bin/myprg)
==3766==    by 0x56FB82F: (below main) (libc-start.c:291)
==3766==  Address 0xffed13dd4 is on thread 1's stack
==3766== 
...

What is the meaning of this output, and how do I find the piece of code that is causing this error?

Update: Solution

The problem was with Code::Blocks. It is necessary to correctly configure the project build options for the whole project and not just the "Debug" target. So all flags except "-std=c++11" were removed from the "whole project" options, so nothing was overriding the "Debug" options. Also the linker ".o" files need to be deleted when the options are changed, to force Code::Blocks to rebuild the executable.

Maxim Egorushkin
2#
Maxim Egorushkin Reply to 2018-01-12 17:50:31Z

The code needs to be compiled and linked with debug info (-g command line option) and -fno-omit-frame-pointer for valgrind to show correct stack traces.

See The stack traces given by Memcheck (or another tool) aren't helpful. How can I improve them? for more details.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.299291 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO