Difference between revisions of "Troubleshooter Python Debugger Tab"

From Lianjapedia
Jump to: navigation, search
(Created page with "''Under Construction. Coming soon in Lianja v5.0'' ==The Troubleshooter== The Troubleshooter ... {{ns:file}}:troubleshooter_pythondebugger.png|800px|left|link={{filepath:...")
 
(Actionbar)
 
(12 intermediate revisions by the same user not shown)
Line 1: Line 1:
''Under Construction.  Coming soon in Lianja v5.0''
 
 
 
==The Troubleshooter==
 
==The Troubleshooter==
The Troubleshooter ...
+
The Troubleshooter provides a tabbed interface bringing together debugging, tracing and performance metrics to assist you in testing and tuning your Apps.
  
[[{{ns:file}}:troubleshooter_pythondebugger.png|800px|left|link={{filepath:troubleshooter_pythondebugger.png}}|Troubleshooter]]
+
[[{{ns:file}}:troubleshooter_pydebugger.png|800px|left|border|link={{filepath:troubleshooter_pydebugger.png}}|Troubleshooter]]
 
<br clear=all>
 
<br clear=all>
  
 
==The Python Debugger Tab==
 
==The Python Debugger Tab==
The Python Debugger Tab contains the Python scripting Debugger.  The tabbed upper container contains an '''Output''' panel and the files currently loaded in the Debugger.  The lower tabbed container contains the following:
+
The Python Debugger Tab contains the Python Debugger.  The tabbed upper container contains an '''Output''' panel and the files currently loaded in the Python Debugger.  The lower tabbed container has the following:
  
 
* Command Window
 
* Command Window
Line 17: Line 15:
 
* Locals Grid
 
* Locals Grid
  
Below these are a message line showing the current operation and an actionbar.
+
Below these are: a message line showing the current operation and an actionbar.
  
===Activating the Python Debugger===
+
===Activating the Debugger===
 
As with all [[Troubleshooter]] tabs, the Python Debugger Tab can be selected by clicking on its tab.
 
As with all [[Troubleshooter]] tabs, the Python Debugger Tab can be selected by clicking on its tab.
  
 
===Loading Files in the Debugger===
 
===Loading Files in the Debugger===
Scripts can be loaded from the [[Apps Workspace]].  Open the file (double-click the filename) in the [[Script Editor]] then click the '''Open file in Debugger''' toolbutton.  
+
Scripts can be loaded into the Python Debugger from the [[Apps Workspace]].  Open the file (double-click the filename) in the [[Script Editor]] then click the '''Open file in Debugger''' toolbutton.  
  
[[{{ns:file}}:apps_open_in_debugger.png|800px|left|link={{filepath:apps_open_in_debugger.png}}|Open file in Debugger]]
+
[[{{ns:file}}:troubleshooter_pydebugger1.png|800px|left|border|link={{filepath:troubleshooter_pydebugger1.png}}|Open file in Debugger]]
 
<br clear=all>
 
<br clear=all>
  
Library files can be loaded from the [[Library Workspace]] in the same way: open the file (double-click the filename) in the [[Script Editor]] then click the '''Open file in Debugger''' toolbutton.  
+
Right-clicking on the tab containing the script name displays the context menu, which also includes an option to '''Open File In Debugger'''.
  
[[{{ns:file}}:debug_tab_run.png|left|link={{filepath:debug_tab_run.png}}|Debug Tab]]
+
[[{{ns:file}}:troubleshooter_jsdebugger1b.png|left|link={{filepath:troubleshooter_jsdebugger1b.png}}|Open file in Debugger]]
 
<br clear=all>
 
<br clear=all>
  
Note: if multiple files are loaded, the file in the leftmost tab will be debugged when '''Run/Continue''' is clicked.
+
Alternatively, in the [[Pages Workspace]], clicking on the 'flag' icon in the header of a Section loads the Python Scripting Libraries and/or source code ([[Webview Section Attributes|WebView]] or [[Developing Lianja Custom Sections in Python|Custom]]) for that Section into the Python Debugger.  
  
Called programs are automatically loaded when referenced by a program being debugged and '''Step Into''' is clicked.
+
[[{{ns:file}}:troubleshooter_pydebugger1a.png|800px|left|border|link={{filepath:troubleshooter_pydebugger1a.png}}|Debug the code for this section]]
 +
<br clear=all>
  
 
Right-clicking in a loaded file displays the context menu:
 
Right-clicking in a loaded file displays the context menu:
 
   
 
   
[[{{ns:file}}:debug_tab_file_cm.png|left|link={{filepath:debug_tab_file_cm.png}}|Debug Tab]]
+
[[{{ns:file}}:debug_tab_file_cm.png|left|link={{filepath:debug_tab_file_cm.png}}|Context Menu]]
 
<br clear=all>
 
<br clear=all>
  
 
Note: some menu options only operate when the file is in edit mode.  See [[#actionbar|actionbar]] below for how to switch mode.
 
Note: some menu options only operate when the file is in edit mode.  See [[#actionbar|actionbar]] below for how to switch mode.
  
While the debugger is active, hovering the mouse over a command, function, field or variable will display its Intellitip with information about its usage, syntax or definition.  For more about Intellitips and other Lianja CodeAssistant for Lianja/VFP features, see [[Script_Editor#The_Lianja_CodeAssistant_for_Lianja.2FVFP|Script Editor: The Lianja CodeAssistant]].
+
While the debugger is active, hovering the mouse over a variable will display its datatype, size and current value.
  
[[{{ns:file}}:debug_tab_file_tips.png|left|link={{filepath:debug_tab_file_tips.png}}|Debug Tab]]
+
[[{{ns:file}}:troubleshooter_pydebugger2.png|left|link={{filepath:troubleshooter_pydebugger2.png}}|Variable]]
 
<br clear=all>
 
<br clear=all>
  
 
===Output===
 
===Output===
 
The Output panel displays program and [[#Command|Command Window]] output.
 
The Output panel displays program and [[#Command|Command Window]] output.
[[{{ns:file}}:debug_tab_output.png|left|link={{filepath:debug_tab_output.png}}|Debug Tab]]
+
[[{{ns:file}}:troubleshooter_pydebugger3.png|left|link={{filepath:troubleshooter_pydebugger3.png}}|Output]]
 
<br clear=all>
 
<br clear=all>
  
 
Right-clicking in the Output panel displays the context menu:
 
Right-clicking in the Output panel displays the context menu:
  
[[{{ns:file}}:debug_tab_output_cm.png|left|link={{filepath:debug_tab_output_cm.png}}|Debug Tab]]
+
[[{{ns:file}}:debug_tab_output_cm.png|left|link={{filepath:debug_tab_output_cm.png}}|Context Menu]]
 
<br clear=all>
 
<br clear=all>
  
 
===Command===
 
===Command===
The Debug Console contains a Lianja/VFP Command Window.  All Lianja/VFP [[:Category:Commands|commands]] and [[:Category:Functions|functions]] can be used in the Command Window apart from [[:Category:Looping Commands|flow control and looping commands]] and others that form a begin...end statement block.
+
The Debug Console contains a Python Command Window.  
  
Note also, as in the floating [[Command Window]] and [[Console Workspace]]:
+
Output and errors are displayed in the [[#Output|Output panel]].
* The semi-colon ';' line continuation character is not supported.
+
* [[&]] macro substitution is supported.
+
 
+
Output is displayed in the '''Output''' panel; errors are reported in the [[Troubleshooter Error Viewer Tab|Error Viewer Tab]].
+
  
 
===Breakpoints===
 
===Breakpoints===
Breakpoints cause execution of the running program to pause before the line of code set as a breakpoint is run. Breakpoints can be set and unset using the [[#actionbar|actionbar]] or by clicking in the line number column to the left of the selected line.
+
Breakpoints cause execution of the running program to pause before the line of code set as a breakpoint is run.
 +
 
 +
Breakpoints can be set and unset using the [[#actionbar|actionbar]] or by clicking in the line number column to the left of the selected line.
  
[[{{ns:file}}:debug_tab_bp1.png|left|link={{filepath:debug_tab_bp1.png}}|Debug Tab]]
+
[[{{ns:file}}:troubleshooter_pydebugger4.png|left|link={{filepath:troubleshooter_pydebugger4.png}}|Breakpoints]]
 
<br clear=all>
 
<br clear=all>
  
Line 78: Line 75:
 
Click '''Remove All Breakpoints''' in the [[#actionbar|actionbar]] to clear all current breakpoints.
 
Click '''Remove All Breakpoints''' in the [[#actionbar|actionbar]] to clear all current breakpoints.
  
[[{{ns:file}}:debug_tab_bp2.png|left|link={{filepath:debug_tab_bp2.png}}|Debug Tab]]
+
[[{{ns:file}}:troubleshooter_pydebugger5.png|left|link={{filepath:troubleshooter_pydebugger5.png}}|Remove All Breakpoints]]
 
<br clear=all>
 
<br clear=all>
  
Line 84: Line 81:
 
Watches (or 'watchpoints') cause execution of the running program to pause after the value of a field or memory variable set as a watchpoint changes.  Watches are set using the [[#actionbar|actionbar]]:
 
Watches (or 'watchpoints') cause execution of the running program to pause after the value of a field or memory variable set as a watchpoint changes.  Watches are set using the [[#actionbar|actionbar]]:
  
[[{{ns:file}}:debug_tab_wp1.png|left|link={{filepath:debug_tab_wp1.png}}|Debug Tab]]
+
[[{{ns:file}}:troubleshooter_pydebugger6.png|left|link={{filepath:troubleshooter_pydebugger6.png}}|Watches]]
 
<br clear=all>
 
<br clear=all>
  
The Watchpoints grid shows the name, data type and current value for currently set watchpoints.  Double-clicking on a grid row will clear that watchpoint.
+
The Watches grid shows the name, data type and current value for currently set watchpoints.  Double-clicking on a grid row will clear that watchpoint.
  
 
Click '''Remove All Watches''' in the [[#actionbar|actionbar]] to clear all current watchpoints.
 
Click '''Remove All Watches''' in the [[#actionbar|actionbar]] to clear all current watchpoints.
  
[[{{ns:file}}:debug_tab_wp2.png|left|link={{filepath:debug_tab_wp2.png}}|Debug Tab]]
+
[[{{ns:file}}:troubleshooter_pydebugger7.png|left|link={{filepath:troubleshooter_pydebugger7.png}}|Remove All Watches]]
 
<br clear=all>
 
<br clear=all>
  
Line 97: Line 94:
 
The Call Stack grid shows the filename and line number for each program in the current stack.
 
The Call Stack grid shows the filename and line number for each program in the current stack.
  
[[{{ns:file}}:debug_tab_cs.png|left|link={{filepath:debug_tab_cs.png}}|Debug Tab]]
+
[[{{ns:file}}:troubleshooter_pydebugger8.png|left|link={{filepath:troubleshooter_pydebugger8.png}}|Call Stack]]
 
<br clear=all>
 
<br clear=all>
  
 
===Globals===
 
===Globals===
 +
The Globals grid shows details of global objects and variables.
  
 +
[[{{ns:file}}:troubleshooter_pydebugger9.png|left|link={{filepath:troubleshooter_pydebugger9.png}}|Globals]]
 +
<br clear=all>
  
 
===Locals===
 
===Locals===
 
+
Not currently used.
  
 
===Actionbar===
 
===Actionbar===
Line 128: Line 128:
 
|-
 
|-
 
|valign="top"|Refresh all files  
 
|valign="top"|Refresh all files  
|valign="top"|Refresh all files in the debugger.  This will update them with any changes made using the [[Script Editor]] in the [[Apps Workspace]] or [[Library Workspace]].
+
|valign="top"|Refresh all files in the debugger.  This will update them with any changes made using the [[Script Editor]] in the [[Apps Workspace]].
 
|-
 
|-
 
|valign="top"|Step Over
 
|valign="top"|Step Over
Line 138: Line 138:
 
|valign="top"|Step Out
 
|valign="top"|Step Out
 
|valign="top"|Run until returning to the calling program, then move to the next line.
 
|valign="top"|Run until returning to the calling program, then move to the next line.
 +
|-
 +
|valign="top"|Add Conditional Breakpoint
 +
|valign="top"|Not currently supported.
 
|-
 
|-
 
|valign="top"|Toggle Breakpoint
 
|valign="top"|Toggle Breakpoint
Line 151: Line 154:
 
|valign="top"|Remove all watchpoints.
 
|valign="top"|Remove all watchpoints.
 
|-
 
|-
|valign="top"|List Status
+
|valign="top"|Deactivate/Activate Breakpoints
|valign="top"|[[LIST STATUS|List the current data environment]] in the Output window.
+
|valign="top"|Disable or enable breakpoints.  From v8.0.
 
|-
 
|-
|valign="top"|List Memory
+
|valign="top"|Deactivate/Activate Watchpoints
|valign="top"|[[LIST MEMORY|List the current memory variables]] in the Output window.
+
|valign="top"|Disable or enable watchpoints. From v8.0.
|-
+
|valign="top"|List Structure
+
|valign="top"|[[LIST STRUCTURE|List the structure]] of the currently selected table or cursor in the Output window.
+
 
|-
 
|-
 
|valign="top"|Clear
 
|valign="top"|Clear
Line 164: Line 164:
 
|-
 
|-
 
|}
 
|}
 
==See Also==
 
[[Command Window]], [[:Category:Error Handling|Error Handling and Debugging]], [[Script Editor]]
 
  
 
[[Category:Troubleshooter]]
 
[[Category:Troubleshooter]]
[[Category:Error Handling]]
+
[[Category:Python Scripting]]
 +
[[Category:Lianja v5.0]]

Latest revision as of 09:36, 3 August 2022

The Troubleshooter

The Troubleshooter provides a tabbed interface bringing together debugging, tracing and performance metrics to assist you in testing and tuning your Apps.

Troubleshooter


The Python Debugger Tab

The Python Debugger Tab contains the Python Debugger. The tabbed upper container contains an Output panel and the files currently loaded in the Python Debugger. The lower tabbed container has the following:

  • Command Window
  • Breakpoints Grid
  • Watches Grid
  • Call Stack Grid
  • Globals Grid
  • Locals Grid

Below these are: a message line showing the current operation and an actionbar.

Activating the Debugger

As with all Troubleshooter tabs, the Python Debugger Tab can be selected by clicking on its tab.

Loading Files in the Debugger

Scripts can be loaded into the Python Debugger from the Apps Workspace. Open the file (double-click the filename) in the Script Editor then click the Open file in Debugger toolbutton.

Open file in Debugger


Right-clicking on the tab containing the script name displays the context menu, which also includes an option to Open File In Debugger.

Open file in Debugger


Alternatively, in the Pages Workspace, clicking on the 'flag' icon in the header of a Section loads the Python Scripting Libraries and/or source code (WebView or Custom) for that Section into the Python Debugger.

Debug the code for this section


Right-clicking in a loaded file displays the context menu:

Context Menu


Note: some menu options only operate when the file is in edit mode. See actionbar below for how to switch mode.

While the debugger is active, hovering the mouse over a variable will display its datatype, size and current value.

Variable


Output

The Output panel displays program and Command Window output.

Output


Right-clicking in the Output panel displays the context menu:

Context Menu


Command

The Debug Console contains a Python Command Window.

Output and errors are displayed in the Output panel.

Breakpoints

Breakpoints cause execution of the running program to pause before the line of code set as a breakpoint is run.

Breakpoints can be set and unset using the actionbar or by clicking in the line number column to the left of the selected line.

Breakpoints


The Breakpoints grid shows the filename and line number for currently set breakpoints. Double-clicking on a grid row will clear that breakpoint.

Click Remove All Breakpoints in the actionbar to clear all current breakpoints.

Remove All Breakpoints


Watches

Watches (or 'watchpoints') cause execution of the running program to pause after the value of a field or memory variable set as a watchpoint changes. Watches are set using the actionbar:

Watches


The Watches grid shows the name, data type and current value for currently set watchpoints. Double-clicking on a grid row will clear that watchpoint.

Click Remove All Watches in the actionbar to clear all current watchpoints.

Remove All Watches


Call Stack

The Call Stack grid shows the filename and line number for each program in the current stack.

Call Stack


Globals

The Globals grid shows details of global objects and variables.

Globals


Locals

Not currently used.

Actionbar

Action Description
Run/Continue Run or continue running the program to the next breakpoint or watchpoint or to the end if no breakpoints or watchpoints are set.
Stop Stop debugging.
Edit Code Put the currently selected file into edit mode.
Save Code Displayed when edit mode (Edit Code above) has been selected. Click to save any changes and exit edit mode.
Revert Code Displayed when edit mode (Edit Code above) has been selected. Click to cancel any changes and exit edit mode.
Refresh all files Refresh all files in the debugger. This will update them with any changes made using the Script Editor in the Apps Workspace.
Step Over Move to the next line of code without running the current line.
Step Into Run the current line of code then move to the next line.
Step Out Run until returning to the calling program, then move to the next line.
Add Conditional Breakpoint Not currently supported.
Toggle Breakpoint Set a breakpoint on the current line, or unset the breakpoint if one already exists.
Toggle Watch Set a watchpoint on the currently selected variable or field, or unset the watchpoint if one already exists.
Remove All Breakpoints Remove all breakpoints.
Remove All Watches Remove all watchpoints.
Deactivate/Activate Breakpoints Disable or enable breakpoints. From v8.0.
Deactivate/Activate Watchpoints Disable or enable watchpoints. From v8.0.
Clear Clear the Output window.