Gdb always program exited with code 01

gdb

I am using scientific linux. I am trying to compile a project that uses a bunch of cpp files. Right now, it compiles successfully, but the values/data I'm getting are definitely wrong.

In the directory user/project/Build, I enter make to compile and link all the cpp files. I then have to go to user/run/ and then type ./run.sh values.txt

When I go to directory /user/project/Build/bin and then type gdb project and then set breakpoints, there are no problems. But when I hit run, I always see Program exited with code 01. It doesn't matter if I set breakpoints in main.cpp or another source file. Isn't gdb supposed to stop at the breakpoint?

Best Answer

I think you can use the trick.

set the break point in exit.

gdb ..

b exit

run ..

bt

so you can know where the main call the exit funciton

Related Question