Inspecting and Changing the Value of Data Elements

From RAD Studio
Jump to: navigation, search

Go Up to How To Use the Debugger

The Debug Inspector lets you inspect data elements by automatically formatting the type of data it is displaying. The Debug Inspector is especially useful for examining compound data objects, such as arrays and linked lists. Because you can inspect individual items displayed in the Debug Inspector, you can perform a walkthrough of compound data objects by opening a Debug Inspector on a component of the compound object.

Note: The Debug Inspector is only available when the process is stopped in the debugger.

To inspect a data element currently selected in the Code Editor

  1. In the Code Editor, place the insertion point on the data element that you want to inspect.
  2. Right-click and choose Debug > Inspect from the context menu to display the Debug Inspector.

To inspect a data element by typing the expression into the Inspect dialog box

  1. Choose Run > Inspect to display the Inspect dialog box.
  2. In the Inspect dialog box, type the expression you want to inspect.
  3. Click OK.The Debug Inspector is displayed.

Unlike watch expressions, the scope of a data element in the Debug Inspector is fixed at the time you evaluate it. If you use the Inspect command from the Code Editor, the debugger uses the location of the insertion point to determine the scope of the expression you are inspecting. This makes it possible to inspect data elements that are not within the current scope of the execution point.

If you use Run > Inspect, the data element is evaluated within the scope of the execution point.

If the execution point is in the scope of the expression you are inspecting, the value appears in the Debug Inspector. If the execution point is outside the scope of the expression, the value is undefined and the Debug Inspector becomes blank.

To view members of the object you are inspecting

  1. Click the Data tab to view strings, boolean values, and other values for such things as variable name, expression, and owner.

Tip: If you want to see the hexadecimal representation of a string, sub-inspect the string value in the Debug Inspector.

  1. Click the Methods tab to view all of the methods that are members of the object's class.
  2. Tip: If you want to see the return type for any method, select the method and look at the status bar of the Debug Inspector, where the syntax line for the method, including the return type is displayed.

  3. Click the Properties tab to view all of the properties for the active object.
  4. Click any property name to see its type displayed in the status bar of the Debug Inspector.
  5. Click the question mark (?) icon to see the actual value for that property at this point of the execution of the application.

To change the value of a data element

  1. In the Debug Inspector, select a data element that has an ellipsis (...) next to it.The ellipsis indicates that the data element can be modified.
  2. Click the ellipsis (...), or right-click the element and choose Change.
  3. Type a new value, then click OK.

To inspect local variable values

  1. While running in Debug mode, double-click any variable that appears in the Local Variables window.This displays the Debug Inspector for that local variable.
  2. Inspect the variable's value. Change the value by clicking the button with an ellipsis (...) on it.

See Also