Post Debugger: Difference between revisions
| (23 intermediate revisions by 5 users not shown) | |||
| Line 1: | Line 1: | ||
[[Image:Compost4Debugger.PNG | 800px | right]] | |||
=Overview= | |||
Debugging a post processor requires several components. | |||
# A debug enabled post | |||
# A debug tool | |||
# A GibbsCAM session with a part that can run the post | |||
With these components, the debug tool allows the post developer to inspect how the GibbsCAM part uses the post processor as it runs. | |||
== | ==Legacy Post Debugger== | ||
The post debugger | The legacy post debugger was an experimental tool that was used with some versions of Compost3 to assist developers in debugging post processors. It was de-supported with GibbsCAM V11 and Compost4. | ||
= | =Compost4 Integrated Debugger= | ||
Compost4 v 4.3 and later includes an integrated debugger. Beta versions of Compost4 4.2.99.x have been released to allow users to test the post debugger. | |||
== | ==File Format== | ||
Compost was designed from inception to contain integrated debug services and the POST format has always included debug information. The debugger built into Compost4 works using these features of the POST format, so it can only debug posting sessions that use a POST file. Compost4 always upgrades a PST file into a POST when opened. When using the debugger post developers must use the POST version of the file inside GibbsCAM when debugging. | |||
==Features== | |||
Debugger Features include | |||
* Breakpoints | |||
* interactive code stepping | |||
* Output inspection (Output Window) | |||
* Variable/Flag inspection (Variables) | |||
* Program State inspection (Watches and Callstack) | |||
* | == Usage == | ||
* | The Compost4 debugger has 3 software components. | ||
* | * Compost4 v.4.2.99.x or later | ||
* GibbsCAM 11.3.10 or later. | |||
* GibbsCAMCompostDebugAddin (the plug-in that links GibbsCAM and Compost). | |||
The | The GibbsCAMCompostDebugAddin is shipped with all compatible versions of GibbsCAM, but is disabled by default. Before a post can be debugged, this plug-in must be manually enabled in the plug-in manager. | ||
When enabled, the post developer has 2 choices for how to start a debug session. | |||
===Starting from GibbsCAM === | |||
When a part is open in GibbsCAM and a post is selected, the Compost Debugger -> Attach to Compost menu item can be used to start a debug session using the current part/post. If there are no compost instances running, GibbsCAM will start a new one and open the selected post. If a single compost instance is already running, it will automatically be used. If there are multiple compost instances running the plugin will show a compost selection dialog to allow the user to pick what compost instance to use. | |||
===Starting from Compost=== | |||
A post developer can trigger a debug session from the debug menu or the debug toolbar button. When started from Compost, a new instance of GibbsCAM is always started. | |||
==Connecting GibbsCAM and Compost== | |||
Once, the session is started, GibbsCAM and Compost will connect to each other and establish a debug link. When the link is established, Compost will enable a number of debug features that are available from the debug menu. | |||
Some features, such as step control and the output window, will only be functional when GibbsCAM is actually posting. Some common compost features will be disabled while debugging an active posting session, such as compiling and saving. | |||
==Breakpoints== | |||
A breakpoint is a way to tell GibbsCAM to pause posting at a specific location in the program, or when a specific set of conditions are true. Breakpoints are primarily accessed via the Breakpoints window. | |||
From this window a post developer can define two types of breakpoints. | |||
===Line Breakpoints=== | |||
Line breakpoints will pause the post execution right before the first command of the selected line is executed. | |||
===State Breakpoints=== | |||
State breakpoints do not define a specific lotion in the post to break on, but a set of conditions. When all the conditions are true, the program will break and allow the developer to inspect the state. The most common condition to use is "Specified text is in output" so developers can easaly learn what part of the post is generating questionable output. | |||
==Step Control== | |||
When the post program is in the break state, GibbsCAM will not process any more commands until instructed to do so by the debugger. Several tools are available to the developer to control how the program will continue from this state. As a program is stepped, the current line will be highlighted with a yellow arrow. The current command will be highlighted with a yellow background. | |||
* Resume. Causes the program to continue as normal and process commands until ether the program ends, or another breakpoint is encountered. | |||
* Step Over. Executes the next command and stops on the next one in the current progsub. If that command is a call to a progsub, then the entire progsub will be executed before control is returned to the next command. | |||
* Step Into. Executes the next command in any progsub. If the next command is a progsub, the program will break at the first command in that progsub. | |||
* Step Out. Runs to the end of the current prog sub and then breaks at the next command in the calling progsub. | |||
* Run to next line. Runs to the first command of the next line in the prog. | |||
* Run to Cursor. Runs to the command where the cursor is in the compost editor window. | |||
==Variables== | |||
The variables window will show all variables that have been defined (set, or used) in the program at the time they are viewed. The variable values will update as they are changed by the prog. Variables commands work in one of 2 scopes, Global or Local. Legacy commands such as [[GetVar]]# and [[Flag]]? all work in the global scope and will appear on the Globals tab. Newer commands such as [[SetLocalVar]]# are local to the current progsub and will appear in the Locals tab. | |||
==Callstack== | |||
the | The callstack window shows what progsubs have been called at the time it is viewed. Each callstack item shows what line it was on when the next progsub was called. | ||
The | ==Watches== | ||
The watches window allows a post developer to inspect data about the current posting program and its state. Each watched item is selected from the pulldown menu at the top, and then added to the watch list using the "+" button. Some watch types require additional information (such as an axis name) that can be entered into the text box next to the pulldown menu. Watch data is only updated when the program is broken for performance reasons. | |||
===Data=== | |||
the current | * CurrentOp, The current operation | ||
the post | * CurrentFeatureNumber, [[FeatNum]]# for the current feature. | ||
* CurrentFeature, Information about the current input feature (type, location, etc...). | |||
* CurrentPart, The current part instance. | |||
* CurrentRepeat, Information on the current repeat status (rotations, origins, repeats) | |||
* CurrentFeedrate, The current feedrate for the current program step | |||
* AxisStatus, The status register value for the specified axis in the current output mode | |||
* CurrentAxisValue, The value of the specified axis for the current program in the current output mode. | |||
* FlowAxisSetName, The current flow axis set name | |||
* FlowAxisSetAxes, The axis names that make up the current flow axis set | |||
* InterpSetAxes, The axis names that make up the current interpolation set | |||
* CurrentModeName, The name of the current output mode | |||
* CurrentTGSpeed, The current toolgroup speed and direction | |||
* CurrentWPSpeed, The current workpeice speed and direction | |||
* CurrentCRC, The current CRC state | |||
* CurrentFlow, the current flow | |||
===Commands=== | |||
Both number and boolean commands can be set as watches. When set the watch window will show the returned value of the command in the watch window as if it had been called at the time when the post execution is broken. Currently commands that take arguments can not be used in the watch window. In order to get the value, the post debugger must actually call the command. This can affect posting performance and possibly have unintended side effects on the state of the post processor, since the commands are being called on every step of the debugger. The debugger automatically suppresses the output and status register updates from watch commands, but due to the large number of legacy commands, there may be other undesired side effects from using watch commands, so post developers should be aware of this fact. | |||
The | ==Output== | ||
The output window shows the last few lines of output as well as the current line being built up by the post. | |||
==Notes on using the debugger== | |||
# Posts can not be edited while they are being debugged. Compost disabled edit,save, and compile while GibbsCAM is posting. It is not possible to change a post while it is being run. | |||
# It is not necessary to stop debugging or detach compost from GibbsCAM when posting has finished. GibbsCAM and compost can stay attached for many postings. The post just can't be edited while posting is actualy happening. After posting ends, edits can be done as normal. | |||
# Breakpoints are cleared when GibbsCAM is disconnected from Compost. This issue will be addressed in future updates. | |||
# The POST version of a post MUST be selected in GibbsCAM. PST files can not be directly debugged. | |||
# Line Numbers can not be used for conditional state breakpoints. Due to the nature of how [[Retag]] works, line numbers are not generated until after the output is complete. | |||
[[Category:Articles]] | |||
Latest revision as of 17:12, 20 September 2017
Overview
Debugging a post processor requires several components.
- A debug enabled post
- A debug tool
- A GibbsCAM session with a part that can run the post
With these components, the debug tool allows the post developer to inspect how the GibbsCAM part uses the post processor as it runs.
Legacy Post Debugger
The legacy post debugger was an experimental tool that was used with some versions of Compost3 to assist developers in debugging post processors. It was de-supported with GibbsCAM V11 and Compost4.
Compost4 Integrated Debugger
Compost4 v 4.3 and later includes an integrated debugger. Beta versions of Compost4 4.2.99.x have been released to allow users to test the post debugger.
File Format
Compost was designed from inception to contain integrated debug services and the POST format has always included debug information. The debugger built into Compost4 works using these features of the POST format, so it can only debug posting sessions that use a POST file. Compost4 always upgrades a PST file into a POST when opened. When using the debugger post developers must use the POST version of the file inside GibbsCAM when debugging.
Features
Debugger Features include
- Breakpoints
- interactive code stepping
- Output inspection (Output Window)
- Variable/Flag inspection (Variables)
- Program State inspection (Watches and Callstack)
Usage
The Compost4 debugger has 3 software components.
- Compost4 v.4.2.99.x or later
- GibbsCAM 11.3.10 or later.
- GibbsCAMCompostDebugAddin (the plug-in that links GibbsCAM and Compost).
The GibbsCAMCompostDebugAddin is shipped with all compatible versions of GibbsCAM, but is disabled by default. Before a post can be debugged, this plug-in must be manually enabled in the plug-in manager.
When enabled, the post developer has 2 choices for how to start a debug session.
Starting from GibbsCAM
When a part is open in GibbsCAM and a post is selected, the Compost Debugger -> Attach to Compost menu item can be used to start a debug session using the current part/post. If there are no compost instances running, GibbsCAM will start a new one and open the selected post. If a single compost instance is already running, it will automatically be used. If there are multiple compost instances running the plugin will show a compost selection dialog to allow the user to pick what compost instance to use.
Starting from Compost
A post developer can trigger a debug session from the debug menu or the debug toolbar button. When started from Compost, a new instance of GibbsCAM is always started.
Connecting GibbsCAM and Compost
Once, the session is started, GibbsCAM and Compost will connect to each other and establish a debug link. When the link is established, Compost will enable a number of debug features that are available from the debug menu.
Some features, such as step control and the output window, will only be functional when GibbsCAM is actually posting. Some common compost features will be disabled while debugging an active posting session, such as compiling and saving.
Breakpoints
A breakpoint is a way to tell GibbsCAM to pause posting at a specific location in the program, or when a specific set of conditions are true. Breakpoints are primarily accessed via the Breakpoints window.
From this window a post developer can define two types of breakpoints.
Line Breakpoints
Line breakpoints will pause the post execution right before the first command of the selected line is executed.
State Breakpoints
State breakpoints do not define a specific lotion in the post to break on, but a set of conditions. When all the conditions are true, the program will break and allow the developer to inspect the state. The most common condition to use is "Specified text is in output" so developers can easaly learn what part of the post is generating questionable output.
Step Control
When the post program is in the break state, GibbsCAM will not process any more commands until instructed to do so by the debugger. Several tools are available to the developer to control how the program will continue from this state. As a program is stepped, the current line will be highlighted with a yellow arrow. The current command will be highlighted with a yellow background.
- Resume. Causes the program to continue as normal and process commands until ether the program ends, or another breakpoint is encountered.
- Step Over. Executes the next command and stops on the next one in the current progsub. If that command is a call to a progsub, then the entire progsub will be executed before control is returned to the next command.
- Step Into. Executes the next command in any progsub. If the next command is a progsub, the program will break at the first command in that progsub.
- Step Out. Runs to the end of the current prog sub and then breaks at the next command in the calling progsub.
- Run to next line. Runs to the first command of the next line in the prog.
- Run to Cursor. Runs to the command where the cursor is in the compost editor window.
Variables
The variables window will show all variables that have been defined (set, or used) in the program at the time they are viewed. The variable values will update as they are changed by the prog. Variables commands work in one of 2 scopes, Global or Local. Legacy commands such as GetVar# and Flag? all work in the global scope and will appear on the Globals tab. Newer commands such as SetLocalVar# are local to the current progsub and will appear in the Locals tab.
Callstack
The callstack window shows what progsubs have been called at the time it is viewed. Each callstack item shows what line it was on when the next progsub was called.
Watches
The watches window allows a post developer to inspect data about the current posting program and its state. Each watched item is selected from the pulldown menu at the top, and then added to the watch list using the "+" button. Some watch types require additional information (such as an axis name) that can be entered into the text box next to the pulldown menu. Watch data is only updated when the program is broken for performance reasons.
Data
- CurrentOp, The current operation
- CurrentFeatureNumber, FeatNum# for the current feature.
- CurrentFeature, Information about the current input feature (type, location, etc...).
- CurrentPart, The current part instance.
- CurrentRepeat, Information on the current repeat status (rotations, origins, repeats)
- CurrentFeedrate, The current feedrate for the current program step
- AxisStatus, The status register value for the specified axis in the current output mode
- CurrentAxisValue, The value of the specified axis for the current program in the current output mode.
- FlowAxisSetName, The current flow axis set name
- FlowAxisSetAxes, The axis names that make up the current flow axis set
- InterpSetAxes, The axis names that make up the current interpolation set
- CurrentModeName, The name of the current output mode
- CurrentTGSpeed, The current toolgroup speed and direction
- CurrentWPSpeed, The current workpeice speed and direction
- CurrentCRC, The current CRC state
- CurrentFlow, the current flow
Commands
Both number and boolean commands can be set as watches. When set the watch window will show the returned value of the command in the watch window as if it had been called at the time when the post execution is broken. Currently commands that take arguments can not be used in the watch window. In order to get the value, the post debugger must actually call the command. This can affect posting performance and possibly have unintended side effects on the state of the post processor, since the commands are being called on every step of the debugger. The debugger automatically suppresses the output and status register updates from watch commands, but due to the large number of legacy commands, there may be other undesired side effects from using watch commands, so post developers should be aware of this fact.
Output
The output window shows the last few lines of output as well as the current line being built up by the post.
Notes on using the debugger
- Posts can not be edited while they are being debugged. Compost disabled edit,save, and compile while GibbsCAM is posting. It is not possible to change a post while it is being run.
- It is not necessary to stop debugging or detach compost from GibbsCAM when posting has finished. GibbsCAM and compost can stay attached for many postings. The post just can't be edited while posting is actualy happening. After posting ends, edits can be done as normal.
- Breakpoints are cleared when GibbsCAM is disconnected from Compost. This issue will be addressed in future updates.
- The POST version of a post MUST be selected in GibbsCAM. PST files can not be directly debugged.
- Line Numbers can not be used for conditional state breakpoints. Due to the nature of how Retag works, line numbers are not generated until after the output is complete.