User forums > Help

Can't debug programs from Code::Blocks on Mac OSX

(1/4) > >>

Yannick Semail:
Here is the setup:
Code::Blocks 12.11
Gcc/g++ 4.7.3 from Macports installed in /opt/local/bin
ggdb 7.6 (updated gdb) from Macports installed in /opt/local/bin

Changed the debugger in Code::Blocks/Settings/Debugger/Default/Executable path: /opt/local/bin/ggdb

Kept the default Environment setting Terminal to launch console program to:
osascript -e 'tell app "Terminal"' -e 'activate' -e 'do script "$SCRIPT"' -e 'end tell'

Any C/C++ program that is being debugged stalls with gdb not stopping at breakpoints:

Here is a debugging log:
Building to ensure sources are up-to-date
Selecting target:
Debug
Adding source dir: /Users/yannick/Dropbox/0.Development/SFML.Working.Example/
Adding source dir: /Users/yannick/Dropbox/0.Development/SFML.Working.Example/
Adding file: /Users/yannick/Dropbox/0.Development/SFML.Working.Example/SFMLapplication
Changing directory to: /Users/yannick/Dropbox/0.Development/SFML.Working.Example/.
Set variable: DYLD_LIBRARY_PATH=.:
Starting debugger: /opt/local/bin/ggdb -nx -fullname  -quiet  -args /Users/yannick/Dropbox/0.Development/SFML.Working.Example/SFMLapplication
done
Registered new type: wxString
Registered new type: STL String
Registered new type: STL Vector
Setting breakpoints
Can't launch console (osascript -e 'tell app "Terminal"' -e 'activate' -e 'do script ""' -e 'end tell' sleep 80006888)
Debugger name and version: GNU gdb (GDB) 7.6

oBFusCATed:

--- Quote from: Yannick Semail on June 20, 2013, 10:24:51 pm ---Can't launch console (osascript -e 'tell app "Terminal"' -e 'activate' -e 'do script ""' -e 'end tell' sleep 80006888)

--- End quote ---
As far as I know the command used to launch the terminal has changed, but I have no mac where I can set the proper command.
Please experiment and tell me which it is.

phisch2:
Can a developer indicate what steps need to be taken to troubleshoot this problem?  I need to get the debugger working on Mac for my class.  I have a Mac and can run whatever tests are needed.  FWIW, the included command to activate the terminal works fine to open the terminal for a regular run, just not for debug sessions.  The debugger process does seem to be running, but when the terminal opens the program being debugged is not running in that terminal window.  Some sort of debugger attachment issue?
Thanks,

oBFusCATed:
Can you do the following test:

Start several terminals, then use ps in a terminal to see how many executables there are?
Also how many terminals do you have when the terminal fails. Try to close them all and repeat the procedure.

Also check if debugging a GUI project works. See the details in the other topic you've started.

SteveBerl:

--- Quote from: oBFusCATed on January 13, 2014, 07:38:44 pm ---Can you do the following test:

Start several terminals, then use ps in a terminal to see how many executables there are?
Also how many terminals do you have when the terminal fails. Try to close them all and repeat the procedure.

Also check if debugging a GUI project works. See the details in the other topic you've started.

--- End quote ---

New to Code::Blocks, but found this thread and tried what you asked. The number of bash processes is always the same as the number of terminal windows I open.

Each time I attempt to debug my HelloWorld.cpp console program, a new terminal window opens and gives a shell prompt, but the debug window in Code::Blocks complains that it Can't open console. The debugger seems to be live, and talking to my program. I can see a gdb process running. From the Code::Blocks window I can step through my code. But the terminal window doesn't seem to be connected to it.

When I can get one to build, I will try to debug a GUI project also and see how that goes.

Navigation

[0] Message Index

[#] Next page

Go to full version