delorie.com/djgpp/faq/debugging/basic.html
|
search
|
How do I debug my programs?
First, remember to use the -g switch when you compile. This puts
debugging information into your executable. Then, to debug the
program, use a command line like this:
go32 -d edebug32 myprog
edebug32 is the external debugger. See the file
edebug32.doc for information on the debugger commands. Note:
if you are running in a DPMI environment, you must use
ed32-dpmi instead of edebug32. go32
normally searches relative to the current directory, then from it's
own directory, then the PATH, for the external debugger
program.
You can use alternative debuggers:
- The full-screen debugger (get the file fsdbXXX.zip).
This presents a user interface like that of Borland's Turbo Debugger,
but unlike td, it isn't a source-level debugger (although it
will show the source code together with the machine instructions). It
also doesn't support 80x87 (you can't see it's register stack and
control word).
- LadyBUG (get the file ldbgXXX.zip). It is similar to
FSDB, but Emacs aficionados will feel right at home with its commands
keys. LadyBUG supports 80x87 debugging and remote debugging through a
serial link. Doesn't fully support debugging in DPMI
environments.
- The GNU Debugger (gdb) (get the files
gdbXXXbn.zip and gdbXXXdc.zip). This is a powerful
source-level debugger, but it uses a line-oriented user interface.
Note that it doesn't work exactly like the Unix versions. For
example, you can't pass command line parameters for the debuggee to
gdb, and you can only start the program once.
Both fsdb and gdb have separate DPMI and non-DPMI
versions.
You invoke any debugger like above, like this:
go32 -d debugger-name program args...