Home Valgrind shows question marks

# Valgrind shows question marks

user9199
1#
user9199 Published in September 19, 2018, 3:19 am

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==
==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==
...


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.

• Possible duplicate of Strange valgrind output – Green Jan 12 at 17:29
• You should probably state the layout of your source code, and how you compiled your program. Stating how you started Valgrind would be helpful, too. Compile with -g3 or -g2 to ensure symbols are present. Compile with -O1 or -O0 to ensure accurate symbols. Also see Preparing your Program in the Valgrind Quick Start Guide. – jww Jan 12 at 17:48
• I added the Valgrind command. I'm not sure what you mean by the layout of the source code. Code::Blocks only has "-g" no "-g2" or "-g3". Also I couldn't find "-O0". – tyebillion Jan 12 at 18:20