www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.debugger - using gdb with DMD on OS X

I've been messing around with this for a couple of hours, and I'm having
difficulty determining whether gdb on OS X can be used with DMD at all (it
seems to work ok with gdc). I've tried compiling with both -g and -gc switches.

The first problem is that you can't set breakpoints, with gdb complaining "No
source file named" whatever. Using absolute pathnames with the break or
directory commands doesn't help:
  
  obijohn:~/projects/d$ gdb hi
  [... copyright notice for gdb ...]
  (gdb) break hi.d:5
  No source file named hi.d.
  Make breakpoint pending on future shared library load? (y or [n]) 
  (gdb) directory ~/projects/d
  Source directories searched: /Users/obijohn/projects/d:$cdir:$cwd
  (gdb) pwd
  Working directory /Users/obijohn/projects/d.
  (gdb) break hi.d:5
  No source file named hi.d.
  Make breakpoint pending on future shared library load? (y or [n]) 
  (gdb) break "~/projects/d/hi.d:5"
  No source file named ~/projects/d/hi.d.
  Make breakpoint pending on future shared library load? (y or [n]) 
  (gdb) break "/Users/obijohn/projects/d/hi.d:5"
  No source file named /Users/obijohn/projects/d/hi.d.
  Make breakpoint pending on future shared library load? (y or [n]) 

Since this problem doesn't exist when compiling with gdc, I'm assuming it's a
dmd issue (perhaps relating to the paths used in the symbolic information?). 

If this is a gdb issue, then that's a bigger problem since we're stuck with the
version that Apple supplies with XCode (can't update to gdb-6.8 since the gnu
sources won't compile on OS X, there's no fink or macports gdb available, and
the latest Apple version is 6.3.5). 

Anyone had any luck with this?
Mar 16 2009