The debug window provides information about the state of your patch as it is executing. By setting a break watchpoint, you can look at the suspended execution of your patch to learn more information about its behavior.
Suspending execution of a patcher
- Choose Enable Debugging from the Debug menu
- Set a break watchpoint on a patch cord where you want to know about the execution of a patch
- Perform some action so that a message flows through the patch cord.
- As soon as a message is about to travel through the patch cord, Max will stop executing, begin pulsing the patch cord, and open the debug window. At this point you can either step through the patch manually, auto-step through the patch, or continue normal execution.
The debug window toolbar
- Pause lets you pause at any point while you're automatically stepping through a patch.
- Continue will resume normal execution from the point where the patch has been stopped.
- Step steps through your patch by sending a single message through a patch cord.
- Abort stops execution of your patch and returns it to the state where it is waiting for user input.
- Inspect Sender opens the inspector window on the object that is sending a message in the selected line in the debug window's display.
- Show Sender highlights the object that is sending a message in the selected line in the debug window's display.
- Inspect Receiver opens the inspector window on the object that is receiving a message in the selected line in the debug window's display.
- Show Receiver highlights the object that is receiving a message in the selected line in the debug window's display.
Many of the buttons in the toolbar have corresponding menu items in the Debug menu. You may find it easier to use the menu items, particularly the keyboard equivalents.
Understanding the debug window display
Each row in the debug window shows a message being sent from a sending object to receiving object. The sender, receiver, message, and arguments are displayed. The row highlighted in green is the message that will be sent next when you invoke the Step command. The current list of rows in the debug window is an execution stack. In other words, each object is sending a message in the middle of receiving an object.
In the example below, the first thing that happened was that a button object send a message to a trigger object. As a result of receiving the , the trigger sent a message to an uzi. As part of the uzi object's handling of the message it received, it in turn sent a message to another trigger object.
This sequence continues until we get to the current execution point shown, where the pack object is about to send a list to the table object. The patch below shows the breakpoint where this will happen in red.
As you step through the patch, you will observe the execution stack grow and shrink.
When the execution of the patch has reached a point where Max is waiting for user input, there will be nothing left in the debug window display, which means the execution stack is now empty.
If you are in the middle of debugging, you cannot operate your patch. In addition, you cannot close the patcher window being debugged, and you cannot quit Max. If these actions interest you more than the debugging process, choose Abort from the Debug menu, and you will be able to operate Max normally again.