Anyone use DDD?

brian_d_foy on 2006-10-01T23:47:40

Gnu has the Data Display Debugger, or ddd, and I even found an article in English about it. I was going to ignore it for my chapter on debugging in Mastering Perl until I saw that Peter Scott showed it breifly in Perl Debugged.

After much yak shaving last night (fix my FreeBSD routing table so I could cvsup ports so I could compile gcc34 so I could compile ddd), and much online poker playing while the compilation was under way (won one tournament, second in two others, final table in another, and a miserable 48th in the last one, up 15,000 play chips by the end), I got this thing install. With more yak shaving to let my FreeBSD machine display thing on my Powerbook (not sure I had to use xhost last time I did this, odd) because my Intel laptop's monitor flickered a moment then never came back. It isn't fun editing /etc/rc.conf to set the defaultrouter when I can't see the screen. Some of you might really like the challenge, but I think it sucked. Although, punching the screen won't break it any worse. :)

So, does anyone use this? Does anyone happen to have the Mac OS X binary that seems to have disappeared from the net?

Aside from that, what else might you be using as a debugger or IDE? I know about Komodo, EPIC, and Affrus. What else is out there?


ddd on OSX

sigzero on 2006-10-02T01:08:30

You seem to be able to install it using macports.

Updating FreeBSD ports

tagg on 2006-10-02T07:36:33

Now that you've set up cvsup it may not be an issue anymore, but alternatively, check out portsnap for updating your ports tree.

Yes, barely.

jjore on 2006-10-02T16:28:01

I've used ddd only very lightly when debugging the C++ code at work and I might have loaded perl into it once or twice. It's one of those things I think I really ought to get goot at but haven't yet.

Either that or Emacs' GUD. Both probably. I ought to learn both. It's all gdb under the hood anyway.

Used it for debugging C

shild on 2006-10-02T17:15:12

I used it to debug C code, although not lately. It is great for displaying structures.
For Perl I prefer the '-d' debugging.
Are you adding debugging of XS modules?
If so I have a neat trick to debug using gdb that I learned from muppet on the perl-xs list.
I haven't tried it with ddd, I should test it someday.

Re:Used it for debugging C

brian_d_foy on 2006-10-02T19:04:35

I won't cover XS debugging since I'm not covering XS stuff (leaving that to Extending and Embedding Perl), but what's your trick? :)

Re:Used it for debugging C

shild on 2006-10-03T14:04:49

Here are the instructions I got. This has saved me a lot of debugging time.

#################################################

set the env var PASTHRU_INC when compiling your extension:

      $ # turn on debugging symbols, turn off optimization (to
      $ # prevent out-of-order execution that makes debugging
      $ # rather confusing)
      $ export PASTHRU_INC='-Wall -g -O0'

then you can run your program in gdb and be taken to the exactly right
spot when it crashes. you can inspect all of the values to find out
what happened.

some versions of gdb don't get things right when you try to set a
breakpoint in a module that isn't loaded yet, and since xs modules are
dynamic objects then you run into this a lot. i get around this by
running the perl debugger inside gdb.

      $ gdb perl
      (gdb) set args -d mycoolscript.pl
      (gdb) run
          DB # break here to get back to gdb
          DB ^C
      (gdb) # set the breakpoint where you want... C function...
      (gdb) break gtk_main
      (gdb) # or the xsub
      (gdb) break XS_Gtk2_main
      (gdb) # go back to perl
      (gdb) continue
          DB # carry on
          DB c ...
      Breakpoint 1, XS_Gtk2_main (my_perl=0x800200, cv=0x8c1434) at
xs/Gtk2.c:381
      381 dXSARGS;
      (gdb)