Handmade Hero » Forums » Code » Decent OS X standalone debuggers
DanB91
Dan
19 posts / 1 project

None

#1454 Decent OS X standalone debuggers
3 years, 8 months ago

Would anyone know of any decent stand alone debuggers for OSX that can use LLDB? (I don't think Xcode supports this mode).

There is a thread on Linux standalone debuggers and they recommended DDD, but that seems that it requires GDB (which I could install with MacPorts) and it seems to be very difficult to use. How compatible are Clang built executables with GDB?

None
owensd
David Owens II
69 posts

A software engineer that enjoys living in enemy territory.

#1456 Decent OS X standalone debuggers
3 years, 8 months ago

Xcode 6 uses LLDB. In fact, it's the only debugger that Xcode supports out of the box.
DanB91
Dan
19 posts / 1 project

None

#1457 Decent OS X standalone debuggers
3 years, 8 months ago

Sorry, what I meant by "doesn't support this mode", I was referring to a standalone debug mode, not to the usage LLDB (I am aware that Xcode only uses LLDB). However, I am not aware of a mode where I can just debug an executable in Xcode without having to first create a project, a la DDD or Visual Studio.

None
owensd
David Owens II
69 posts

A software engineer that enjoys living in enemy territory.

#1458 Decent OS X standalone debuggers
3 years, 8 months ago Edited by David Owens II on Jan. 3, 2015, 11:06 p.m.

Well, it ends up being the same as VS, but you need to manually do it.

Step 1: Create a new Project using the OS X -> Other -> Empty template. (I put this project in handmade/misc/osx/HandmadeHero.xcodeproj).
Step 2: Create a new scheme (I named mine Handemade Hero)
Step 3: Edit the scheme, under "Run", set the executable to the path to your binary

This allows you to debug the executable now. To break on main, add a symbolic breakpoint.

Debug -> Breakpoints -> Create Symbolic Breakpoint

For the name, enter "main" (or whatever function you want to break on).

[Edit] I've attached a sample.
stefan
1 posts
#1463 Decent OS X standalone debuggers
3 years, 8 months ago Edited by stefan on Jan. 4, 2015, 12:25 a.m.

Plus you can add your source code files to Xcode so you can set breakpoints as in VS : in the File menu choose 'Add Files to "your-project"'.

Make sure you save your project so you don't have to recreate it.
Then you are able to step through, setup breakpoints, as in VS.

I'm using it that way, I'm following on OSX with SDL2 (mixing code OSX/Linux/SDL).
owensd
David Owens II
69 posts

A software engineer that enjoys living in enemy territory.

#1464 Decent OS X standalone debuggers
3 years, 8 months ago

There's no need to add the files to the project; you can set breakpoints without it. Also, then you don't need to manage multiple different project systems. You just need to the hook for debugging that you set up once instead of having to maintain throughout the life time of your project.