jq Wrote: > Reposted from digitmars.D.debugger, because there seems to be no life there: > > Note that I'm seeing the same problem with gdc compiled programs. This is on > linux - debian testing, to be precise. Thanks for any help here. > > --------- > > Hi. I'm porting a program from C++ to D and finally at the point to try > running it. Needless to say, there are bugs, and I'm trying to debug them. > > I've applied the patch floating around to GDB 6.8 to support D. I then take > a trivial hello world program, compile with dmd -g and run inside gdb. > Whether or not I use the D patches, I get the following behavior. > > Any suggestions? > > Thanks > > jlqu...@cerberus:~/d$ gdb ./junk > GNU gdb 6.8-debian > Copyright (C) 2008 Free Software Foundation, Inc. > License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> > This is free software: you are free to change and redistribute it. > There is NO WARRANTY, to the extent permitted by law. Type "show copying" > and "show warranty" for details. > This GDB was configured as "x86_64-linux-gnu"... > (gdb) b main > Breakpoint 1 at 0x804aa79 > (gdb) run > Starting program: /home/jlquinn/d/junk > [Thread debugging using libthread_db enabled] > [New Thread 0xf7d43ae0 (LWP 22977)] > [Switching to Thread 0xf7d43ae0 (LWP 22977)] > > Breakpoint 1, 0x0804aa79 in main () > Current language: auto; currently asm > (gdb) l > 1 /tmp/cc2j8MlC.s: No such file or directory. > in /tmp/cc2j8MlC.s > (gdb) >
For some reason you have to set breakpoints using line numbers or mangled names such as _Dmain. Also when debugging dmd-compiled binaries gdb won't show you line numbers in backtrace. The only solution that I know of is to compile with ldc. Haven't tried gdc yet.