- If you have any more DDD tips of the day,
please send them to the DDD developers <ddd@ips.cs.tu-bs.de>.
- Welcome to DDD!
You can get help on all items by pointing at them and pressing F1.
And don't worry, you can undo most mistakes...
- Whenever you're stuck, try Help->What Now. This will analyze the
current DDD state and give you some hints on what to do next.
- Buttons with a small triangle in the upper right corner are special:
pressing and holding mouse button 1 on them will pop up a menu
with additional options.
- You can interrupt GDB and the current program by clicking on
Program->Interrupt or pressing Esc.
- If you made a mistake, try Edit->Undo. This will undo the most
recent debugger command and redisplay the previous program state.
- There are three ways to show the value of a variable:
- You can view its value, simply by pointing at it;
- You can print its value in the debugger console, using Print ();
- You can display it graphically, using Display ().
- A quick way to manipulate variables, breakpoints, and displays
is to press mouse button 3 on them.
- Double-clicking on any value in the data display
will toggle more details.
- If your program needs special terminal capabilities such as readline
or curses, let it run in the separate execution window
(Program->Run in Execution Window).
- If you want to customize the DDD fonts, see
Edit->Preferences->Fonts.
- To change the text background color, write into `
~/.ddd/init
':
Ddd*XmText.background: color
Ddd*XmTextField.background: color
Ddd*XmList.background: color
- When using GDB, all text fields have command and argument completion
with Tab, just like the shell. In a file selection box, type part of
a filename, hit Tab, and voila! It's completed.
- You can always recenter the command tool
by selecting View->Command Tool,
or by pressing Alt+8.
- To scroll the data display, most users find a panner
much more convenient than two scrollbars.
Check out Edit->Preferences->Startup->Data Scrolling.
- To limit the number of array elements in a data display, set
Edit->GDB Settings->Limit on array elements to print.
- If DDD cannot find a source, set the GDB source path via
Edit->GDB Settings or enter
`dir sourcedir_1:sourcedir_2:...:sourcedir_n' at the GDB prompt.
- To save the window size, use Edit->Save Options.
- You can quickly set breakpoints
by double-clicking in the breakpoint area.
- To see the actual type of a C++ object in GDB, set
Edit->GDB Settings->Set printing of object's derived type.
- To display data in hexadecimal format, display it and choose
Convert to Hex from the Display () menu,
or enter `graph display /x data' at the GDB prompt.
- To send a signal to your program,
use Status->Signals->Send.
- To quickly display variable values,
double-click on the variable name.
- After looking up an item or stepping through the program, you can use
Edit->Undo and Edit->Redo to return to earlier locations.
- You can repeat the last command by hitting RETURN.
Use Ctrl+B and Ctrl+F to search the command history.
- You can move breakpoints by dragging them.
Just press and hold mouse button 1 on a breakpoint,
move it to the new position and release mouse button 1 again.
- To make your program ignore signals, use Status->Signals and
unset the Pass button for the appropriate signal.
- You can save space by disabling toolbar captions.
See Edit->Preferences->Startup->Toolbar Appearance.
- To quickly edit breakpoint properties,
double-click on a breakpoint symbol.
- To have GDB start your program automatically upon startup,
put the following lines in your `.gdbinit
' file:
break main - or some other initial function
run - possibly giving arguments here
- To get rid of these tips of the day, unset
Edit->Preferences->Startup->Show Tip of the Day.
- To redirect stderr from the execution window to the debugger console,
add `2>/dev/tty' to the arguments of your program.
- To display the first n elements of a variable-length array ptr,
enter `graph display ptr[0]@n' at the GDB prompt.
- You can have each of DDD, GDB and the debugged program run on
different machines. See the DDD `--rhost' option for details.
- You can copy breakpoints by dragging them while pressing Shift.
Just press and hold Shift+mouse button 1 on a breakpoint,
move it to the new position and release mouse button 1 again.
- To save and restore data displays, cut, copy and paste them via
the Edit menu. Together with xclipboard, you can manage
arbitrary collections of data displays.
- Do you want to stop this debugging session and resume later?
Use File->Save Session!
- To debug a child process, put a call to `sleep' in the child right
after the `fork' call. Run the program and attach to the child process
using File->Attach to Process.
- If your program prints a lot of text on standard error, try
redirecting standard error to a file (via `2> FILE'), or add
to `~/.ddd/init
': Ddd*lineBufferedConsole: off.
- If the inferior debugger does not support stderr redirection, try
invoking DDD using `--debugger 'NAME 2> FILE''.
- Using GDB, you can define your own canned sequences of commands.
Try Commands->Define Command.
- To use GDB with Solaris CC, compile with `-xs'.
GDB wants debugging info in the executable.
- To use GDB with G77, compile with `-fdebug-kludge'. This gives
rudimentary information on COMMON and EQUIVALENCE variables in GDB.
See the G77 documentation for details.
- Double-clicking on a function call will lead you to the definition of
the function. Use Edit->Undo to return to the function call.
- Disabled breakpoints can be used as bookmarks.
Use Source->Edit Breakpoints to list all breakpoints;
then, click on Lookup to jump to a breakpoint location.
- You can assign user-defined buttons to frequently used commands.
Try Commands->Edit Buttons.
- In the Breakpoint and Display Editors,
you can toggle the selection with Ctrl+mouse button 1.
This allows you to select non-contiguous ranges of items.
- To change the properties of multiple breakpoints at once,
select them in the breakpoint editor (Source->Edit Breakpoints)
and click on Properties.
- Even while in the source window,
you can enter and edit GDB commands:
Just type the command and press RETURN.
- You can record commands to be executed when a breakpoint is hit.
In the Breakpoint Properties panel, try Record and End.
- You can easily resume a saved DDD session
by invoking DDD as `ddd =session'.
- If the DDD source window keeps on scrolling until the end of source is
reached, try changing the `glyphUpdateDelay' resource. See the
DDD manual for details.
- For further DDD customization (e.g. colors), see the `
Ddd
'
app-defaults file from the DDD WWW Site or the DDD source
distribution. Copy resources to `~/.ddd/init
' and edit as desired.
- In GCC, `-Wall' does not enable all warnings. See the GCC
documentation for other warnings you might consider useful.
- J.H.M. Dassen <jdassen@wi.leidenuniv.nl>
- To get a global idea of what a process or program does or is doing,
use a system call tracer, like `strace', `truss', or `trace'.
- J.H.M. Dassen <jdassen@wi.leidenuniv.nl>
- If you suspect memory corruption caused by problematic pointers,
try linking with Electric Fence `efence' or the `dbmalloc' library.
See the DDD WWW page for links.
- J.H.M. Dassen <jdassen@wi.leidenuniv.nl>
- Prevention is better than cure. Document your assumptions using
or GNU NANA. See the DDD WWW page for links.
- J.H.M. Dassen <jdassen@wi.leidenuniv.nl>
- The debugger isn't a substitute for good thinking. But, in some
cases, thinking isn't a substitute for a good debugger either. The
most effective combination is good thinking and a good debugger.
- Steve McConnell, Code Complete
- When you're totally stuck, try to find a helpful ear. In my experience,
nothing helps you more in debugging than to try to explain your problem
(what your code should do, and what it actually does) to someone else.
- J.H.M. Dassen <jdassen@wi.leidenuniv.nl>