IMXSDebugger.h

Go to the documentation of this file.
00001 /*      IMXSDebugger.h - include for MAXScript debugger
00002 *
00003 *           CREATED BY: Larry Minton
00004 *
00005 *>  Copyright (c) 2005, All Rights Reserved.
00006 */
00007 
00008 #pragma once
00009 
00010 #include "..\ScripterExport.h"
00011 #include "..\..\ifnpub.h"
00012 
00013 class IMXSDebugger : public FPStaticInterface
00014 {
00015 public:
00016     ScripterExport static IMXSDebugger* GetInstance(); // return a concrete instance of this class. Will be a singleton. 
00017 
00018     // Open debug dialog. If breakExecution is true, breaks MAX execution. If outString is specified, it is output to the debugger output window
00019     virtual void OpenDialog(BOOL breakExecution, MCHAR* outString = NULL, BOOL setFocus = FALSE) = 0;
00020 
00021     virtual BOOL IsDialogOpen() = 0; // returns true if debug dialog is open
00022 
00023     virtual void CloseDialog() = 0; // closes debug dialog if open, continues MAX execution if broken
00024 
00025     virtual HWND GetDialogHwnd() = 0; // returns HWND of dialog
00026 
00027     // Do a preliminary get of the clipboard data. This will cause the clipboard to contain a copy of the text
00028     // in the desired format. If the owner of the clipboard data is a RichEdit control, that control does the conversion. 
00029     // We want to do do the conversion while running a MAX thread. The debugger suspends all MAX threads and trying to 
00030     // do a paste would cause a hang since the control's thread might be suspended.
00031     virtual void UpdateClipboardData() = 0; 
00032 
00033     virtual void WriteString(MCHAR* str) = 0; // output string to output window
00034     virtual void WriteLine(MCHAR* str) = 0; // output string to output window, appends \n if needed.
00035 
00036     // Break MAX execution if not already broken. If outString is specified, it is output to the debugger output window
00037     virtual void BreakExecution(MCHAR* outString = NULL) = 0;
00038 
00039     virtual void ContinueExecution() = 0; // continues MAX execution if broken
00040 
00041     virtual BOOL IsExecutionBroken() = 0; // returns true if execution is broken
00042 
00043     enum state  {   idle, 
00044                     getvar_getvar, getvar_getval, 
00045                     setvar_getvar, setvar_eval_compile, setvar_eval, setvar_setval, 
00046                     eval_compile, eval,
00047                     attempting_break
00048                 }; // the possible debugger states
00049     virtual state GetState() = 0; // returns state debugger is in
00050 
00051     virtual DWORD GetThreadID() const = 0; // returns thread ID debugger is running in
00052 
00053     // get/set whether MXS script throws are allowed to break execution. If true, throws can break MAX execution. Whether it will
00054     // depends on whether noDebugBreak:<bool> is specified on the throw, and if not the value from GetDefaultBreakOnThrow() 
00055     virtual BOOL GetAllowBreakOnThrow() = 0; 
00056     virtual BOOL SetAllowBreakOnThrow(BOOL breakExecution) = 0; // returns previous value
00057 
00058     // get/set whether MXS errors break execution. 
00059     virtual BOOL GetBreakOnError() = 0; 
00060     virtual BOOL SetBreakOnError(BOOL breakExecution) = 0; // returns previous value
00061 
00062     // get/set whether exceptions break execution. 
00063     virtual BOOL GetBreakOnException() = 0;
00064     virtual BOOL SetBreakOnException(BOOL breakExecution) = 0; // returns previous value
00065 
00066     // get/set whether MXS script throws w/o noDebugBreak:<bool> break execution
00067     virtual BOOL GetDefaultBreakOnThrow() = 0;
00068     virtual BOOL SetDefaultBreakOnThrow(BOOL breakExecution) = 0; // returns previous value
00069 
00070     // get/set whether MXS script throws within a catch are ignored
00071     virtual BOOL GetIgnoreCaughtThrows() = 0;
00072     virtual BOOL SetIgnoreCaughtThrows(BOOL ignore) = 0; // returns previous value
00073 
00074     // get/set whether errors within a catch are ignored
00075     virtual BOOL GetIgnoreCaughtErrors() = 0;
00076     virtual BOOL SetIgnoreCaughtErrors(BOOL ignore) = 0; // returns previous value
00077 
00078     // get/set whether exceptions within a catch are ignored
00079     virtual BOOL GetIgnoreCaughtExceptions() = 0;
00080     virtual BOOL SetIgnoreCaughtExceptions(BOOL ignore) = 0; // returns previous value
00081 
00082     // get/set whether can break into the debugger while MAX's quietmode is true
00083     virtual BOOL GetEnabledInQuietMode() = 0;
00084     virtual BOOL SetEnabledInQuietMode(BOOL ignore) = 0; // returns previous value
00085 
00086     // get/set whether can break into the debugger while net rendering
00087     virtual BOOL GetEnabledInNetRender() = 0;
00088     virtual BOOL SetEnabledInNetRender(BOOL ignore) = 0; // returns previous value
00089 
00090     // get/set whether debug dialog is set to topmost
00091     virtual BOOL GetStayOnTop() = 0;
00092     virtual BOOL SetStayOnTop(BOOL ignore) = 0; // returns previous value
00093 
00094     // get/set the # milliseconds allowed for a debugger command before automatically resuming MAX execution
00095     virtual DWORD GetCommandTimeoutPeriod() = 0; 
00096     virtual DWORD SetCommandTimeoutPeriod(DWORD millisecs) = 0; // returns previous value
00097 
00098     // get/set the # milliseconds allowed for a break attempt before automatically resuming MAX execution and trying to break again
00099     virtual DWORD GetBreakTimeoutPeriod() = 0; 
00100     virtual DWORD SetBreakTimeoutPeriod(DWORD millisecs) = 0; // returns previous value
00101 
00102     // get/set the # milliseconds allowed for garbage collection occurring in a break attempt before automatically resuming MAX execution and trying to break again
00103     virtual DWORD GetGCTimeoutPeriod() = 0; 
00104     virtual DWORD SetGCTimeoutPeriod(DWORD millisecs) = 0; // returns previous value
00105 
00106     // get/set the # milliseconds between break attempts
00107     virtual DWORD GetBreakCyclePeriod() = 0; 
00108     virtual DWORD SetBreakCyclePeriod(DWORD millisecs) = 0; // returns previous value
00109 
00110     // get/set whether global constants are displayed in stack dump
00111     virtual BOOL GetShowGlobalConstants() = 0;
00112     virtual BOOL SetShowGlobalConstants(BOOL ignore) = 0; // returns previous value
00113 
00114     // get/set whether to show only first frame in stack dump
00115     virtual BOOL GetShowFirstFrameOnly() = 0;
00116     virtual BOOL SetShowFirstFrameOnly(BOOL firstOnly) = 0; // returns previous value
00117 
00118     // get/set whether to allow potentially unsafe methods to be called from debugger. 
00119     virtual BOOL GetAllowUnsafeMethods() const = 0;
00120     virtual BOOL SetAllowUnsafeMethods(BOOL allowUnsafe) = 0; // returns previous value
00121 
00122     // controls whether to clear the output window when the debugger breaks.
00123     virtual BOOL GetClearOutputOnOpen() const = 0; // CPJ added Apr 10 2006
00124     virtual BOOL SetClearOutputOnOpen(BOOL doClear) = 0; // returns previous value
00125 };
00126