How it works...

In this first example, we have become familiar with the Winpdb Reborn tool. This debugging environment (like every environment in general) allows you to stop program execution at precise points, inspect the execution stack, the contents of the variables, the status of the objects created, and much more.

To use Winpdb Reborn, just take a note of the following basic steps:

  1. Set some breakpoints in the source code (the Source window).
  2. Inspect the functions through the Step Into function.
  3. View the status of the variables (the Namespace window) and the execution stack (the Stack window).

The breakpoints are set by simply double-clicking the desired line with the left mouse button (you will see the selected line underlined in red). As a general warning, it is inadvisable to have multiple commands on the same line; otherwise, it will not be possible to associate breakpoints with some of them.

When you use the right mouse button, you can selectively disable breakpoints without removing them (the red highlighting will disappear). To remove all the breakpoints instead, use the Clear All command, which is present in the Breakpoints menu, as mentioned previously.

When the first breakpoint is reached, it is good to keep an eye on the following views in the point of the program that is being analyzed:

  • The Stack view shows the contents of the execution stack, where all the instances of various methods that are currently suspended appear. Typically, the one at the bottom of the stack is the main method and the one at the top of the stack is the method containing the breakpoint that has been reached.
  • The Namespace view shows the local variables of the method and allows you to inspect the values. If the variables refer to objects, then it is possible to find out the unique identifier of the object and inspect its status.

In general, the execution of a program can be managed with different modes associated with the icon (or the Fx keys) present on the Winpdb Reborn command bar.

Finally, we'll point out the following important execution methods:

  • Step Into (F7 key): This resumes the execution of the program one line at a time, and invocations of library methods or subroutines.
  • Return (F12 key): This allows you to resume execution at the exact point where the Step Into function was activated.
  • Next (F6 key): This resumes the execution of the program one line at a time without stopping in any methods invoked.
  • Run to Line (F8 key) This runs the program until it stops (waiting for new commands) at the indicated line.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset