DDD (Data Display Debugger)
DDD is extremely useful, especially, if you are coming from another development environment like Delphi or Visual C++ and you want to step through the source code as it runs, but in a visual way, with the cute little "stop" icons in the margin for breakpoints and all.
You need to get DDD either from your Linux distro CDs, or by downloading it. Install it, and start the application by clicking on the ddd ioon in you can, or typing ddd from the commmand line. The DDD GUI begins.
It is only truely useful when wxWidgets was built with the extra GDB bugging info. Have your library built with GDB support, then build your contrib libraries also, and finally build plucker-desktop. You should now have a plucker-desktop executable that is about 100 megs in size. Have your application installed to its bin directory (probably /usr/bin).
Note: GTK has an annoyance that the mouse has to be over a textctrl for it to have the focus when typing it something into a textctrl.
From the DDD menu, choose File > Open Program... and select your executable that you installed.
Your application's main .cpp file appears in the main window ready for action.
Setting And Using A Breakpoint
Might as well have it do something interesting to start, and breakpoints are it.
Point your mouse to some line inside the OnInit() function and click the button. A nice example is to click right above the MyFrame->Show(TRUE) line.
Now click the breakpoint button from the toolbar (icon of a stopsign). A stop sign appears in the margin of the source code.
From the DDD menu, choose Program > Run (or alternatively click the 'Run' on the side menu). Plucker Desktop will now begin execution, and stop when it hits your breakpoint.
Choose Program > Step from the menu (or the 'Step' button in the floating menu). The program will step through to each instruction as it happens. Step through a few of them to watch the flow as it goes from the plucker-desktop code to the wxWidgets library. When you have seen enough, choose Program > Continue or Cont button from the floating menu) and plucker-desktop will now continue, showing its dialog and everything else that it does.
Remove your breakpoint before you forget about it. Click on the stopsign in the margin, and pressing the stop icon in the toolbar (which now says 'Clear').
Bottom Log Window
At the bottom of DDD is a log window. There are 2 types of messages that you will see in here: Those from GDB and those from Plucker Desktop. The GBD messages are prefixed with (gdb) and the plucker-desktop ones are prefixed with [Debug].
= Your application will send messages whenever there you put a wxLogDebug("<something>"); line in the sourcecode.
Restarting DDD Because It Won't Do What I Want Anymore
There is a log window at the bottom and sometimes it may say to you "Can't do such and such", for example: 'warning Cannot insert breakpoint -2'.
This can happen even if you are starting DDD as a new session (since it saves the last session).
You don't need to find out why, just Restart DDD and you can do what you want. Choose File > Restart and DDD will wipe anything that is was doing. After beginnning DDD again, you can choose File > Open Program and continue debugging your application.
Jumping To A Certain Function
Well and fine for your main .cpp file, but what if you want to debug something else?
Here is a quick way to go to some function: Enter the name of the class and function into the top menu bar. For example:
Now from the menu choose Source > Lookup. This function appears in the window ready for you to add breakpoints or whatever you want to do.
Now that you are more familiar with DDD, there is some customizations that you may wish to do. From the DDD menu, choose Edit > Preferences.
- On the 'Source' tab, enable the "Display Source Line Numbers". The source line numbers appear next to their lines.
Be sure to select Edit > Save Preferences when you are done, to save the preferences before you leave.