Apparently there is a way to strip the debuggin info and put it in another file, and then link the executable to the debug file so GDB can automatically load it. But this doesn't seem to work for me:
gdc -g foo.d -o foo.exe objcopy --only-keep-debug foo.exe foo.debug strip -g foo.exe objcopy --add-gnu-debuglink=foo.debug foo.exe It doesn't add the .gnu_debuglink section to foo.exe, I don't know why..