RAD Studio (Common)
ContentsIndex
PreviousUpNext
Overview of Debugging

RAD Studio includes both the CodeGear .NET Debugger and CodeGear Win32 Debugger. The IDE automatically uses the appropriate debugger based on the active project type. Cross-platform debugging within a project group is supported and, where possible, the debuggers share a common user interface. 

The integrated debuggers let you find and fix both runtime errors and logic errors in your RAD Studio application. Using the debuggers, you can step through code, set breakpoints and watches, and inspect and modify program values. As you debug your application, the debug windows are available to help you manage the debug session and provide information about the state of your application. 

The Debug Inspector enables you to examine various data types such as arrays, classes, constants, functions, pointers, scalar variables, and interfaces. To use the Debug Inspector, select RunInspect.

Stepping through code lets you run your program one line of code at a time. After each step, you can examine the state of the program, view the program output, modify program data values, and continue executing the next line of code. The next line of code does not execute until you tell the debugger to continue.  

The Run menu provides the Trace Into and Step Over commands. Both commands tell the debugger to execute the next line of code. However, if the line contains a function call, Trace Into executes the function and stops at the first line of code inside the function. Step Over executes the function, then stops at the first line after the function.

The Evaluate/Modify functionality allows you to evaluate an expression. You can also modify a value for a variable and insert that value into the variable. The Evaluate/Modify functionality is customized for the language you are using:

  • For a C++ project, the Evaluate/Modify dialog accepts only C++ expressions.
  • For a C# project, the Evaluate/Modify dialog accepts only C# expressions.
  • For a Delphi project, the Evaluate/Modify dialog accepts only Delphi expressions.

Breakpoints pause program execution at a certain point in the program or when a particular condition occurs. You can then use the debugger to view the state of your program, or step over or trace into your code one line or machine instruction at a time. The debugger supports four types of breakpoints:

  • Source breakpoints pause execution at a specified location in your source code.
  • Address breakpoints pause execution at a specified memory address.
  • Data breakpoints allow you to pause execution when memory at a particular address changes.
  • Module load breakpoints pause execution when the specified module loads.
Note: Data breakpoints are available only for the Win32 debugger.

Watches lets you track the values of program variables or expressions as you step over or trace into your code. As you step through your program, the value of the watch expression changes if your program updates any of the variables contained in the watch expression.

The following debug windows are available to help you debug your program. By default, most of the windows are displayed automatically when you start a debugging session. You can also view the windows individually by selecting ViewDebug Windows.  

Each window provides one or more right-click context menus. The F1 Help for each window provides detailed information about the window and the context menus.

Debug Window 
Description 
Breakpoint List  
Displays all of the breakpoints currently set in the Code Editor or CPU window.  
Call Stack  
Displays the current sequence of function calls.  
Watch List  
Displays the current value of watch expressions based on the scope of the execution point.  
Local Variables  
Displays the current function’s local variables, enabling you to monitor how your program updates the values of variables as the program runs.  
Modules  
Displays processes under control of the debugger and the modules currently loaded by each process. It also provides a hierarchical view of the namespaces, classes, and methods used in the application.  
Threads Status  
Displays the status of all processes and threads of execution that are executing in each application being debugged. This is helpful when debugging multi-threaded applications.  
Event Log  
Displays messages that pertain to process control, breakpoints, output, threads, and module.  
CPU  
Displays the low-level state of your program, including the assembly instructions for each line of source code and the contents of certain registers.  
FPU  
Displays the contents of the Floating-point Unit and SSE registers in the CPU.  

Remote debugging lets you debug an application running on a remote computer. Your computer must be connected to the remote computer through TCP/IP and the remote debugger must be installed on the remote machine. After you create and copy the required application files to the remote computer, you can connect to that computer and begin debugging.

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!