+typedef ExecState CallFrame;
+
+class JS_EXPORT_PRIVATE Debugger {
+public:
+ Debugger(bool isInWorkerThread = false);
+ virtual ~Debugger();
+
+ JSC::DebuggerCallFrame* currentDebuggerCallFrame() const;
+ bool hasHandlerForExceptionCallback() const
+ {
+ ASSERT(m_reasonForPause == PausedForException);
+ return m_hasHandlerForExceptionCallback;
+ }
+ JSValue currentException()
+ {
+ ASSERT(m_reasonForPause == PausedForException);
+ return m_currentException;
+ }
+
+ bool needsExceptionCallbacks() const { return m_pauseOnExceptionsState != DontPauseOnExceptions; }
+
+ enum ReasonForDetach {
+ TerminatingDebuggingSession,
+ GlobalObjectIsDestructing
+ };
+ void attach(JSGlobalObject*);
+ void detach(JSGlobalObject*, ReasonForDetach);
+ bool isAttached(JSGlobalObject*);
+
+ BreakpointID setBreakpoint(Breakpoint, unsigned& actualLine, unsigned& actualColumn);
+ void removeBreakpoint(BreakpointID);
+ void clearBreakpoints();
+ void setBreakpointsActivated(bool);
+ void activateBreakpoints() { setBreakpointsActivated(true); }
+ void deactivateBreakpoints() { setBreakpointsActivated(false); }
+
+ enum PauseOnExceptionsState {
+ DontPauseOnExceptions,
+ PauseOnAllExceptions,
+ PauseOnUncaughtExceptions
+ };
+ PauseOnExceptionsState pauseOnExceptionsState() const { return m_pauseOnExceptionsState; }
+ void setPauseOnExceptionsState(PauseOnExceptionsState);
+
+ enum ReasonForPause {
+ NotPaused,
+ PausedForException,
+ PausedAtStatement,
+ PausedAfterCall,
+ PausedBeforeReturn,
+ PausedAtStartOfProgram,
+ PausedAtEndOfProgram,
+ PausedForBreakpoint,
+ PausedForDebuggerStatement,
+ };
+ ReasonForPause reasonForPause() const { return m_reasonForPause; }
+ BreakpointID pausingBreakpointID() const { return m_pausingBreakpointID; }
+
+ void setPauseOnNextStatement(bool);
+ void breakProgram();
+ void continueProgram();
+ void stepIntoStatement();
+ void stepOverStatement();
+ void stepOutOfFunction();
+
+ bool isPaused() const { return m_isPaused; }
+ bool isStepping() const { return m_steppingMode == SteppingModeEnabled; }
+
+ virtual void sourceParsed(ExecState*, SourceProvider*, int errorLineNumber, const WTF::String& errorMessage) = 0;
+
+ void exception(CallFrame*, JSValue exceptionValue, bool hasCatchHandler);
+ void atStatement(CallFrame*);
+ void callEvent(CallFrame*);
+ void returnEvent(CallFrame*);
+ void willExecuteProgram(CallFrame*);
+ void didExecuteProgram(CallFrame*);
+ void didReachBreakpoint(CallFrame*);
+
+ void recompileAllJSFunctions(VM*);
+
+ void registerCodeBlock(CodeBlock*);