Author Topic: gdb not breaking on c++ program (compiled with clang++-3.8)  (Read 2808 times)

Offline wrh

  • Single posting newcomer
  • *
  • Posts: 4
gdb not breaking on c++ program (compiled with clang++-3.8)
« on: August 28, 2017, 02:48:26 am »
I have just begun using Code::Blocks, and have moved two c++ programs to it.  Debugging break points work fine for one, but not the other (starting
the debugger just plows through without hitting any set breakpoints).  I am using the clang compiler (3.8) and /usr/bin/gdb as the debugger.

Based on net searches, I have verified that:
1) there are no blanks in the file name path,
2) Full debug symbols is selected,
3) No optimizations are chosen,
4) No "strip symbols" is selected (verified binary),
5) "Debug" build is selected to run.

For the "no break" case (with a breakpoint set in the main() of the program), I get this log:

Active debugger config: GDB/CDB debugger:Default
Building to ensure sources are up-to-date
Selecting target:
Debug
Adding source dir: /home/bill/SoftwareDev/Hut/Tools/Parsing/ParserGenerator/
Adding source dir: /home/bill/SoftwareDev/Hut/Tools/Parsing/
Adding file: /home/bill/SoftwareDev/Hut/Tools/Parsing/ParserGenerator/bin/Debug/ParserGenerator
Changing directory to: /home/bill/SoftwareDev/Hut/Tools/Parsing/ParserGenerator/.
Set variable: LD_LIBRARY_PATH=.:
Starting debugger: /usr/bin/gdb -nx -fullname -quiet  -args /home/bill/SoftwareDev/Hut/Tools/Parsing/ParserGenerator/bin/Debug/ParserGenerator
done
Registered new type: wxString
Registered new type: STL String
Registered new type: STL Vector
Setting breakpoints
Debugger name and version: GNU gdb (Ubuntu 7.11.1-0ubuntu1~16.5) 7.11.1
During startup program exited with code 1.
Debugger finished with status 0

I't possible that there is some kind of error in the c++ run time start-up based on the messages given,
but have no way of tracking down the problem -- it must be occurring before main() is called.
Is there any way to determine what is causing the program to exit code 1 before reaching main?



 

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: gdb not breaking on c++ program (compiled with clang++-3.8)
« Reply #1 on: August 28, 2017, 09:07:59 am »
Most probably it doesn't find some shared library. Unfortunately this is really hard issue to debug.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline wrh

  • Single posting newcomer
  • *
  • Posts: 4
Re: gdb not breaking on c++ program (compiled with clang++-3.8)
« Reply #2 on: August 29, 2017, 12:07:04 am »
Thanks for the response.  It appears a cut and paste error in the "Program Arguments" was the culprit (the program ran fine from the terminal).  I suspect I did something there which caused an exit on the argument parsing; not sure what, but I'm past it now.