Making Simple Use of the Debugger. Overview
The Intel® IDB supports DBX and GDB modes. By default, IDB operates
like the DBX debugger. In the GDB mode, Intel IDB operates like the GNU*
Debugger, GDB*. See the Starting
the Debugger section to get to know how to launch the debugger in
the required mode.
You look for a bug by doing the following:
- Find a repeatable reproducer of the bug (the simpler
the reproducer is, the easier the next steps will be).
- Prepare
your program for debugging.
- Start the
debugger.
Give commands to the debugger.
- Command the debugger to either
- Prepare to create a process running the program,
or
- Attach to and interrupt a process that you created
using normal operating system specific methods.
- Command the debugger to create breakpoints that will
pause the process as close as possible to where the bug happened.
- If you are using the debugger to create the process,
tell it to create the process now.
- Do whatever it takes to reproduce the bug, so that
the breakpoints
will stop the process close to where the bug has caused something detectably
wrong to happen.
-
Look around to determine
the location of the bug:
- If the bug is in the code where the debugger
has stopped the process, exit the debugger and fix the bug.
- If the bug has not happened yet, remove any breakpoints
that are triggering too often, create other breakpoints that work better
at locating the problem, and continue
the process.
- If the bug has already occurred, take the same
steps of creating breakpoints and so on, but set one or more breakpoints
earlier in the program before the error occurs. Rerun from an earlier
position (a snapshot
if you made one, or else the beginning of the program), and step through
the program to determine the exact line causing the error.