Difference between revisions of "IDE Window: Variable Inspector"

From Free Pascal wiki
Jump to navigationJump to search
 
(10 intermediate revisions by 3 users not shown)
Line 1: Line 1:
[[category:IDE Window|Variable Inspector]][[category:IDE Window - Debug|Variable Inspector]][[category:Debugging]]
+
{{IDE Window: Variable Inspector}}
 
 
  
 
= Important =  
 
= Important =  
  
You must [[Debugger_Setup |setup the debugger]] and start the project to debug it. Only then this window will be useful.
+
You must [[Debugger_Setup |setup the debugger]] and start the project to debug it. Only then will this window be useful.
  
 
= Variable Inspector =
 
= Variable Inspector =
Line 12: Line 11:
 
[[File:Debug_Inspector.png]]
 
[[File:Debug_Inspector.png]]
  
Allows to watch an expression.
+
This window allows you to watch an expression. If the expression is a structure, then each field is displayed as a separate entry.  
  
Expressions can be local or global variables, ([[GDB_Debugger_Tips#Properties|certain]]) properties, or pascal expressions (limited support, e.g. "a+1"). [[GDB_Debugger_Tips#Inspecting_Data-types_.28Watch.2FHint.29|See here for more information]]
+
Expressions can be local or global variables, ([[GDB_Debugger_Tips#Properties|certain]]) properties, or Pascal expressions (limited support, e.g. "a+1"). [[GDB_Debugger_Tips#Inspecting_Data-types_.28Watch.2FHint.29|See here for more information]]
  
If the expression is a structure, then each field is displayed as a separate entry. If the result is a structure that has properties, they may not be included.
+
= Limitations =
 +
 
 +
* The Variable Inspector <u>does not automatically follow</u> the changes of current Thread or Stack. You can toggle the "use instance class" setting, to refresh the result.
 +
* This dialog is <u>not</u> affected by the [[IDE_Window:_Debug_History|History]] dialog.
 +
* If the result is a structure that has properties, they may not be included.
  
 
= Scope (Stackframe, Thread) =
 
= Scope (Stackframe, Thread) =
  
The values are evaluated according to the scope set in the [[IDE_Window:_Threads|Thread]] and [[IDE_Window:_Call_Stack|Stack]] dialog. Default is the current Thread and top stack frame.
+
The values are evaluated according to the scope set in the [[IDE_Window:_Threads|Thread]] and [[IDE_Window:_Call_Stack|Stack]] dialog at the time you set the expression. The default scope is the current Thread and top stack frame. Both dialogs (Stack and Frame) offer to change the "current" Frame/Thread.
Both (Stack and Frame) dialog offer to change the "current" Frame/Thread. The watch window will follow this selection.
 
  
This dialog is <u>not</u> affected by the [[IDE_Window:_Debug_History|History]] dialog.
+
= Interface =
  
= Interface =
+
;Setting the value:
 +
:The interface does not currently provide any method to change the expression from within the dialog. (This was added to Lazarus past version 1.0).
 +
:The value can be set from the [[IDE_Window:_Watch_list|Watch list]] (via context menu of an existing watch) or the [[IDE_Window:_Evaluate/Modify|Evaluate Window]].
  
;Input/Dropdown: Allows to enter/change the expression for the data to display. The dropdown provides a history of recent expressions.
 
  
 
;Data/Method-Tabs: If the data is a structure with methods, they are displayed separately.
 
;Data/Method-Tabs: If the data is a structure with methods, they are displayed separately.
Line 36: Line 39:
  
 
;Use Instance class type: Objects are normally shown according to the declaration of the watched expression. Showing "Sender: TObject" will only show you data, that is declared in TObject. However object variables can contain objects of inherited classes. Sender may be a TForm. Using this the debugger will find the actual class of the object and display all data.
 
;Use Instance class type: Objects are normally shown according to the declaration of the watched expression. Showing "Sender: TObject" will only show you data, that is declared in TObject. However object variables can contain objects of inherited classes. Sender may be a TForm. Using this the debugger will find the actual class of the object and display all data.
 +
 +
= See Also =
 +
 +
* [[IDE_Window:_Watch_list|Watch list]]
 +
* [[IDE_Window:_Evaluate/Modify|Evaluate Window]]

Latest revision as of 17:30, 1 July 2015

English (en)

Important

You must setup the debugger and start the project to debug it. Only then will this window be useful.

Variable Inspector

Also known as "Debug Inspector"

Debug Inspector.png

This window allows you to watch an expression. If the expression is a structure, then each field is displayed as a separate entry.

Expressions can be local or global variables, (certain) properties, or Pascal expressions (limited support, e.g. "a+1"). See here for more information

Limitations

  • The Variable Inspector does not automatically follow the changes of current Thread or Stack. You can toggle the "use instance class" setting, to refresh the result.
  • This dialog is not affected by the History dialog.
  • If the result is a structure that has properties, they may not be included.

Scope (Stackframe, Thread)

The values are evaluated according to the scope set in the Thread and Stack dialog at the time you set the expression. The default scope is the current Thread and top stack frame. Both dialogs (Stack and Frame) offer to change the "current" Frame/Thread.

Interface

Setting the value
The interface does not currently provide any method to change the expression from within the dialog. (This was added to Lazarus past version 1.0).
The value can be set from the Watch list (via context menu of an existing watch) or the Evaluate Window.


Data/Method-Tabs
If the data is a structure with methods, they are displayed separately.

Context menu

Debug Inspector context.png

Use Instance class type
Objects are normally shown according to the declaration of the watched expression. Showing "Sender: TObject" will only show you data, that is declared in TObject. However object variables can contain objects of inherited classes. Sender may be a TForm. Using this the debugger will find the actual class of the object and display all data.

See Also