Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I get a visual debugger on Mac OS when I have no Xcode project?

I am porting a project over to OS X. I am finding GDB debugging in the console to be woefully insufficient and really need a visual debugger. My project is built using Scons and as such, it sidesteps Xcode's IDE entirely. This is acceptable until I need to fire up a visual debugger and step through my code.

Aside from generating and maintaining an Xcode project (to supplement all of the other platforms I have to support already), what can I do to get a visual debugger up and running on OS X?

This is for a C++ project.

like image 920
Michael Labbé Avatar asked May 24 '10 20:05

Michael Labbé


People also ask

How to add breakpoint in visual Studio for Mac?

Set a breakpoint To do that, place the cursor in the line of code and press ⌘ \ ( command + \ ). Another way to set a breakpoint is by selecting Run > Toggle Breakpoint from the menu. Visual Studio indicates the line on which the breakpoint is set by highlighting it and displaying a red dot in the left margin.

Where is the Debug button on Mac?

Click on the Apple menu and choose Shutdown. Restart your Macб and as soon as it starts to boot, press Command-V (If your Mac plays a startup chime, press Command-V as soon as you hear it). Wait until you see white text on the screen and release the keys.


3 Answers

Simple:

  1. Start XCode
  2. Click 'Run' in top menu
  3. Choose attach to process, choose the process you want to debug

Make sure to compile with full debug of course ... which means using option -ggdb

like image 104
tomdemuyt Avatar answered Oct 30 '22 13:10

tomdemuyt


Xcode supports makefile projects - you can just drag all your source into a new legacy project template, set up the makefile command line, tell it where the executable lives, and you're in business.

like image 32
Paul R Avatar answered Oct 30 '22 12:10

Paul R


If you are Emacs friendly then: M-x gdb will put you into "gud" mode. This turns Emacs into a visual debugger. This can be made to work with the new lldb too.

like image 30
davidh Avatar answered Oct 30 '22 13:10

davidh