3

I do TDD on a daily basis for my C++ development on Solaris10. It has greatly reduced the time I have to spend using my debugger but sometime this is the only option.

DBX is pretty powerful but not that user friendly. Note that I'm talking about console DBX not the SunStudio GUI for DBX).

What are the best productivity tips you can give for dbx C++ debugging?

PS. Changing debugger is not an option.

Nazgob
  • 8,502
  • 4
  • 40
  • 42

4 Answers4

9

I have bookmarked a few sites related to dbx. Here they are, in no particular order in case they might be useful to you:

EDIT on 2012 july 19th: I've tried to fix several link since Chris Quenelle's blog has moved. Some articles can still be accessed thanks to the wayback machine.

Bill the Lizard
  • 398,270
  • 210
  • 566
  • 880
Luc Hermitte
  • 31,979
  • 7
  • 69
  • 83
2

One of the powerful features of dbx is the built in ksh. You can write shell functions that are as complex as you might want to print customized views of data structures, or follow pointers in a specific route. The shell is an old variation of pdksh, so it's not the nicest for programming, but it's much better than not having any built-in language to use. There is also extensive help available from the command line. One trick for searching the help is to use "vi $helpfile" from within the dbx command shell. Tha tedits the raw helpfile data in one large file. You can see some examples of shell functions in the dbxrc file that ships with dbx and is loaded by default. You can see a more sophisticated example by looking at the libumem integration module. You can find it here:

http://quenelle.org/sun%20tech/2007/using-dbx-and-libumem.html

Chris Quenelle
  • 801
  • 4
  • 16
  • Alas that Blog entry is missing, found another at https://blogs.oracle.com/solaris/post/solaris-memory-leak-checking-with-libumem which has a couple of other links at the bottom (possibly the same ones as in the answer above). – alls0rts Nov 16 '21 at 12:32
1

I too have to use dbx at work and understand your frustrations!

A few tips I have discovered which make my life a little easier:

Using the built commands system like this: when stop { print whatever ; }
Obviously doesn't work when whatever is out of scope, but I find it useful enough. I have yet to have much joy with the 'trace' facility, YMMV.

Making your own .dbxrc file makes life much easier, as does the "pathmap" feature.

Finally, this is only obvious if you know it already, but try Sun's manual.

It isn't particularly well written, but still an essential read.

alanc
  • 4,102
  • 21
  • 24
Chris Huang-Leaver
  • 6,059
  • 6
  • 41
  • 67
1

Thanks to Luc Hermitte! Here is an updated version of his links and a few others.

Additional tips:

  • dbx has a ksh shell built in, so you can build powerful customized functions.
  • You can get simple tracing with something like:
    • when at foo.cc:35 { print varname; }
  • view all of the online help using: vi $helpfile
Chris Quenelle
  • 801
  • 4
  • 16