Code::Blocks Forums
User forums => Help => Topic started by: Folco on June 02, 2010, 06:21:19 pm
-
Hi all,
First, my config : Debian Lenny 32 bits, C::B svn 6297, packages by Jens.
I currently get a Segfault when running one of my programs. It happens when doing a strlen.
I have specified the "executing working directory" in "Project > Properties > Build target" (for both Release and Debug targets).
The default path work when I run my program with "Run" or "Build and run" icons.
But when I use "Run to cursor" to debug my program, the "executing working directory" doesn't seem to be handled, so my program terminates because it hasn't found an image which it has to load : an exception occurs, I handle it and close the program.
But this occur before the Segfault, so I can't see when it occurs !
The question is : How could I specify the "executing working directory" for GDB ? Without that, I can't debug my program. :(
-
BTW : I just found my bug (giving NULL to a string constructor, so strlen tried to work at a NULL adress...).
Nevertheless, I'm always interested in having a way to solve my problem. :)
-
Memory errors are easier to catch with valgrind...
Can you give us the debugger's log?
Settings -> Compiler & Debugger -> Debugger -> Show debugger's debug log
-
The debugger log doesn't seem to help me a lot :
Building to ensure sources are up-to-date
Build succeeded
Selecting target:
Debug
Adding source dir: /mnt/Data/Programmation/PC/FPG2 cpp/src/
Adding source dir: /mnt/Data/Programmation/PC/FPG2 cpp/src/
Changing directory to: "../../FPG2 cpp"
Adding file: bin/Debug/FPG2
Starting debugger:
done
Registered new type: wxString
Registered new type: STL String
Registered new type: STL Vector
Setting breakpoints
Debugger name and version: GNU gdb 6.8-debian
Child process PID: 7779
Program exited with code 01.
Debugger finished with status 0
But thanks for valgrind, I'll look at it. I usually use it just to know if my programs don't leak memory.
-
The log string you've posted is from the normal debugger's plugin log.
There is another one, but is not enabled by default, go here to enable it:
Settings -> Compiler & Debugger -> Debugger -> Show debugger's debug log
Valgrind is way more powerful than that :)