macOS: debugging hell - strange behavior in lldb and gdb

John Colvin via Digitalmars-d-debugger digitalmars-d-debugger at
Tue Feb 14 15:56:22 PST 2017

On Tuesday, 14 February 2017 at 23:35:15 UTC, Relja Ljubobratovic 
> On Tuesday, 14 February 2017 at 20:32:53 UTC, John Colvin wrote:
>> The docs say it is, but they could be wrong. Could you run dub 
>> with -v (and without any manually added -gc) and share the 
>> output?
> Sure, here's what I'd think is the relevant part:
> Performing "debug" build using ldc2 for x86_64.
> File '/Users/relja/Projects/dlangplayground/dub.json' modified, 
> need rebuild.
> dlangplayground ~master: building configuration "application"...
> ldc2 -mcpu=haswell 
> -of.dub/build/application-debug-posix.osx-x86_64-ldc_2071-A59B2D18A3A7E59FF17DA8905B6773B0/dlangplayground -d-debug -g -w -oq -od=.dub/obj -d-version=Have_dlangplayground -Isource/ source/app.d -vcolumns
> So, no -gc.

-g is there though, which is actually what the docs say.

gdb should suppport D (assuming it's not an ancient gdb), so -g 
should be better there. Overall, gdb is a better debugger for D. 
-g means D debug info, -gc means pretend to be C.

The most portable way to get -gc in your debug builds, add this 
to the project's dub.sdl
buildType "debug" {
	buildOptions "debugMode" "debugInfoC"
or if you're using dub.json:
"buildTypes": {
	"debug": {
		"buildOptions": ["debugMode", "debugInfoC"]

> Btw. it seems like I'm using dub v1.1.2 from homebrew:
> $ dub --version
> DUB version unknown, built on Jan 16 2017
> $ readlink /usr/local/bin/dub
> ../Cellar/dub/1.1.2/bin/dub
> I'll test this with newer releases in the next few days, and if 
> situation is the same, I'll file a bug.
> Once again, thanks man - feels fantastic having a debugger once 
> again! :)
> Cheers,
> Relja

I maintain the D packages in homebrew, so let me know if you have 
any problems. homebrew is up to date with the latest stable dub 
release, so a quick brew update && brew upgrade dub should get 
you up to date..

More information about the Digitalmars-d-debugger mailing list