Post Debugger: Difference between revisions

From Compost Wiki
Jump to navigation Jump to search
JeffM (talk | contribs)
No edit summary
JeffM (talk | contribs)
No edit summary
Line 27: Line 27:
  * Both the prog and form (pst and txt) file must be in the same folder.
  * Both the prog and form (pst and txt) file must be in the same folder.


The debugger will look for a .txt file with the same name as the .pst file
The debugger will look for a .txt file with the same name as the .pst file when it loads. It will use the txt file that has the same name as the currently runing post processor and load it for the prog. If this file is not current there can be problems.


The Debugger dialog is divided into 3 sections. The top section is used to control
===Interface===
The Debugger interface is divided into 3 sections. The top section is used to control
the debugger, the middle section shows the source of the post (with line numbers)
the debugger, the middle section shows the source of the post (with line numbers)
and the lower section shows the output code.
and the lower section shows the output code.
Line 42: Line 43:
Unchecking this will suppress the updating of the Post section of the dialog.
Unchecking this will suppress the updating of the Post section of the dialog.


You can run the post until a break point is reached, by pressing the "Run" button.
The post can be run until a break point is reached, by pressing the "Run" button.
There are 5 types of break point available:


"Break At Op Num", check this option and enter an op number in the box. Execution
===Breakpoints===
There are a number of types of break point available. These allow the user to control when the debuggers stops the execution of the posted program.
 
''Break At Op Num''
This option requires an operation number to be entered into the corresponding field. Execution
will stop when the given op number is reached. The box next to the op number will
will stop when the given op number is reached. The box next to the op number will
be updated during posting to indicate the current op number.
be updated during posting to indicate the current op number.


"Break At Tool Num", similar to "Break At Op Num" but break at a given tool number.
''Break At Tool Num"''
This is similar to "Break At Op Num" but will break on a given tool number.


"Break At NC Code" is used to break when a block of code contains the given text.
''Break At NC Cod''
The check for text is not case dependant.
This breakpoint is used to stop the execution when a block of code contains the given text.
The check for text is not case sensitive.


When processing is stopped due to one of these 3 break conditions, the box containing
When processing is stopped due to one of these break conditions, the box containing
the Op number, Tool number or NC text will change to red to highlight the break.
the Op number, Tool number or NC text will change to red to highlight the break.


The fourth method of breaking is to stop at a particular line in the post. If you click
The fourth method of breaking is to stop at a particular line in the post. When clicking
on a line of text in the post display section, that line will change to yellow to show
on a line of text in the post display section, that line will change to yellow to show
that you have added a break point at that line. Click it again to remove the break.
that it has been added as break point on that line. If the line is clicked again the breakpoint will be removed.


When posting stops due to a break, you can use the "Back" button to step backwards from
When posting stops due to a break, the "Back" button can be used to step backwards from
the current line in the post, one line at a time to help to identify the path through
the current line in the post, one line at a time to help to identify the path through
the post to the current line. The "Fwd" button takes you in the opposite direction.
the post to the current state. The "Fwd" button takes you in the opposite direction.


The "Watch" button provides a method to check the status of some variables and
The "Watch" button provides a method to check the status of some variables and

Revision as of 23:46, 6 March 2008

Overview

The post debugger is a tool that can be used by post developers to view the output and logic flow of a running post processor

Components

The post debugger requires 3 separate components to be run properly.

Post Debugger Plug-in

The plug-in provides the interactive interface to the post debugger and allows developers to view the posting process as it runs.

Installation

Copy the plug in PostDebug.dll into the Plugins folder

Compile

The post debugger requires the Compost3 compiler version 1.3.5 or later. This version contains an option in its Preferences dialog that allows for the generation of debug information (near the lower right corner of the dialog box ).

GibbsCAM

The post debugger also requires a running copy of GibbsCAM, and a part with valid operations.

Usage

When posting the user will see the Post Debugger dialog if the following conditions are met:

* The PostDebug.dll is in the Plugins folder
* The Post processor must have compiled with the "Generate Debug" option selected
* Both the prog and form (pst and txt) file must be in the same folder.

The debugger will look for a .txt file with the same name as the .pst file when it loads. It will use the txt file that has the same name as the currently runing post processor and load it for the prog. If this file is not current there can be problems.

Interface

The Debugger interface is divided into 3 sections. The top section is used to control the debugger, the middle section shows the source of the post (with line numbers) and the lower section shows the output code.

The top right of the control section provides buttons to control the posting. "Next Op", "Next Tool", "Next Flow" will post until the next op, tool or flow is reached. "Next NC" line will run until a new line of code is created. "Next Post Line" is used to show the execution of the post one line at a time.

Whilst the post is running, you can show each line of the post being executed but this can take some considerable time, so there is the "Display Post" option. Unchecking this will suppress the updating of the Post section of the dialog.

The post can be run until a break point is reached, by pressing the "Run" button.

Breakpoints

There are a number of types of break point available. These allow the user to control when the debuggers stops the execution of the posted program.

Break At Op Num This option requires an operation number to be entered into the corresponding field. Execution will stop when the given op number is reached. The box next to the op number will be updated during posting to indicate the current op number.

Break At Tool Num" This is similar to "Break At Op Num" but will break on a given tool number.

Break At NC Cod This breakpoint is used to stop the execution when a block of code contains the given text. The check for text is not case sensitive.

When processing is stopped due to one of these break conditions, the box containing the Op number, Tool number or NC text will change to red to highlight the break.

The fourth method of breaking is to stop at a particular line in the post. When clicking on a line of text in the post display section, that line will change to yellow to show that it has been added as break point on that line. If the line is clicked again the breakpoint will be removed.

When posting stops due to a break, the "Back" button can be used to step backwards from the current line in the post, one line at a time to help to identify the path through the post to the current state. The "Fwd" button takes you in the opposite direction.

The "Watch" button provides a method to check the status of some variables and internal post registers. Click on the "Watch" button to show the "Watch Variables" dialog. The "Add Watch" button will show a list of Number variables, Flags and Internal Registers. You can simply watch the value, break when the value changes, or break when it changes to to a given value. This is the fifth type of break point available.

Select one of these from the drop down menus, select the Watch action from the 3 radio buttons and press the button next to the drop down menu to add it to the watch list.

When you close the Post Debugger dialog, posting will continue as usual until it is completed.

Notes

When compiling with the "Generate Debug" option, Compost3 will add information to the .pst file that relates to the line numbers in the post. It will not include any of the source code itself. This means that the size of the compiled post will not be significantly increased, but it also means that you must have both .pst and .txt files in the same folder to use the debugger.

You should always remove the debug information (compile with "Generate Debug" unchecked) before send a .pst file to a customer. However, if you do forget to do this, the customer will not see the debug information, even if they get hold of a copy of the PostDebug plugin (unless you also send them a copy of the .txt file).