There's more...

As you saw in the Winpdb Reborn GUI screenshot, the GUI is divided into five main windows:

  • Namespace: In this window, the names of entities are displayed, which are various variables and identifiers that are defined by the program and used in the source file.
  • Threads: The current thread of the execution is shown, and it is characterized by the TID  (short for Thread IDentification) fields, the name of the thread, and the thread status.
  • Stack: This is where the execution stack of the program to be analyzed is shown. Stacks are also known as Last In, First Out (LIFO) data structures, as the last element inserted is the first to be removed. When a program calls a function, the called function must know how to return the calling control, so the return address of the calling function is entered into the program execution stack. The program execution stack also contains the memory for the local variables used at each invocation of the function.
  • Console: This is a command-line interface, thus allowing a textual interaction between the user and Winpdb Reborn.
  • Source: This window shows the source code to debug. By scrolling along the lines of code, it is also possible to insert the breakpoints by pressing F9 once you are on the line of code of interest.

The breakpoint is a very basic debugging tool. In fact, it allows you to run a program, but with the possibility of interrupting it at the desired point or when certain conditions occur, in order to acquire information on a running program.

There are multiple debugging strategies. Here, we list some of them:

  • Reproduce the error: Identify the input data that caused it.
  • Simplify the error: Identify the simplest possible data that caused it.
  • Divide and rule: Perform the main proceeding in step-over mode until the anomaly occurs. The method that caused it is the last performed before it was possible to find the problem, so we can re-debug by doing step-in into that particular invocation, and proceeding again with step-over following the method's instructions.
  • Proceed consciously: During debugging, you constantly compare the current values of the variables with the ones you would expect.
  • Check all the details: Don't overlook the details while debugging. It is best to make a note if you notice any discrepancies in the source code.
  • Correct the errors: Correct the error only if you are sure you have understood the problem well.
..................Content has been hidden....................

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