diff options
Diffstat (limited to 'Source/JavaScriptCore/debugger/Debugger.h')
-rw-r--r-- | Source/JavaScriptCore/debugger/Debugger.h | 82 |
1 files changed, 28 insertions, 54 deletions
diff --git a/Source/JavaScriptCore/debugger/Debugger.h b/Source/JavaScriptCore/debugger/Debugger.h index 2e91aafbe..f7b734f37 100644 --- a/Source/JavaScriptCore/debugger/Debugger.h +++ b/Source/JavaScriptCore/debugger/Debugger.h @@ -23,19 +23,17 @@ #define Debugger_h #include "Breakpoint.h" -#include "CallData.h" #include "DebuggerCallFrame.h" #include "DebuggerPrimitives.h" #include "JSCJSValue.h" #include <wtf/HashMap.h> #include <wtf/HashSet.h> #include <wtf/RefPtr.h> +#include <wtf/Vector.h> #include <wtf/text/TextPosition.h> namespace JSC { -class CodeBlock; -class Exception; class ExecState; class JSGlobalObject; class SourceProvider; @@ -45,11 +43,9 @@ typedef ExecState CallFrame; class JS_EXPORT_PRIVATE Debugger { public: - Debugger(VM&); + Debugger(bool isInWorkerThread = false); virtual ~Debugger(); - VM& vm() { return m_vm; } - JSC::DebuggerCallFrame* currentDebuggerCallFrame() const; bool hasHandlerForExceptionCallback() const { @@ -64,13 +60,12 @@ public: bool needsExceptionCallbacks() const { return m_pauseOnExceptionsState != DontPauseOnExceptions; } + void attach(JSGlobalObject*); enum ReasonForDetach { TerminatingDebuggingSession, GlobalObjectIsDestructing }; - void attach(JSGlobalObject*); - void detach(JSGlobalObject*, ReasonForDetach); - bool isAttached(JSGlobalObject*); + virtual void detach(JSGlobalObject*, ReasonForDetach); BreakpointID setBreakpoint(Breakpoint, unsigned& actualLine, unsigned& actualColumn); void removeBreakpoint(BreakpointID); @@ -87,20 +82,6 @@ public: 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(); @@ -108,15 +89,12 @@ public: void stepOverStatement(); void stepOutOfFunction(); - bool isPaused() const { return m_isPaused; } + bool isPaused() { return m_isPaused; } bool isStepping() const { return m_steppingMode == SteppingModeEnabled; } - bool suppressAllPauses() const { return m_suppressAllPauses; } - void setSuppressAllPauses(bool suppress) { m_suppressAllPauses = suppress; } - virtual void sourceParsed(ExecState*, SourceProvider*, int errorLineNumber, const WTF::String& errorMessage) = 0; - void exception(CallFrame*, JSValue exceptionValue, bool hasCatchHandler); + void exception(CallFrame*, JSValue exceptionValue, bool hasHandler); void atStatement(CallFrame*); void callEvent(CallFrame*); void returnEvent(CallFrame*); @@ -124,35 +102,34 @@ public: void didExecuteProgram(CallFrame*); void didReachBreakpoint(CallFrame*); - virtual void recompileAllJSFunctions(); + void recompileAllJSFunctions(VM*); void registerCodeBlock(CodeBlock*); - class ProfilingClient { - public: - virtual ~ProfilingClient() { } - virtual bool isAlreadyProfiling() const = 0; - virtual double willEvaluateScript() = 0; - virtual void didEvaluateScript(double startTime, ProfilingReason) = 0; - }; - - void setProfilingClient(ProfilingClient*); - bool hasProfilingClient() const { return m_profilingClient != nullptr; } - bool isAlreadyProfiling() const { return m_profilingClient && m_profilingClient->isAlreadyProfiling(); } - double willEvaluateScript(); - void didEvaluateScript(double startTime, ProfilingReason); - protected: virtual bool needPauseHandling(JSGlobalObject*) { return false; } - virtual void handleBreakpointHit(JSGlobalObject*, const Breakpoint&) { } - virtual void handleExceptionInBreakpointCondition(ExecState*, Exception*) const { } - virtual void handlePause(JSGlobalObject*, ReasonForPause) { } + virtual void handleBreakpointHit(const Breakpoint&) { } + virtual void handleExceptionInBreakpointCondition(ExecState*, JSValue exception) const { UNUSED_PARAM(exception); } + + enum ReasonForPause { + NotPaused, + PausedForException, + PausedAtStatement, + PausedAfterCall, + PausedBeforeReturn, + PausedAtStartOfProgram, + PausedAtEndOfProgram, + PausedForBreakpoint + }; + + virtual void handlePause(ReasonForPause, JSGlobalObject*) { } virtual void notifyDoneProcessingDebuggerEvents() { } private: typedef HashMap<BreakpointID, Breakpoint*> BreakpointIDToBreakpointMap; - typedef HashMap<unsigned, RefPtr<BreakpointsList>, WTF::IntHash<int>, WTF::UnsignedWithZeroKeyHashTraits<int>> LineToBreakpointsMap; + typedef Vector<Breakpoint> BreakpointsInLine; + typedef HashMap<unsigned, BreakpointsInLine, WTF::IntHash<int>, WTF::UnsignedWithZeroKeyHashTraits<int>> LineToBreakpointsMap; typedef HashMap<SourceID, LineToBreakpointsMap, WTF::IntHash<SourceID>, WTF::UnsignedWithZeroKeyHashTraits<SourceID>> SourceIDToBreakpointsMap; class ClearCodeBlockDebuggerRequestsFunctor; @@ -205,7 +182,7 @@ private: void clearDebuggerRequests(JSGlobalObject*); - VM& m_vm; + VM* m_vm; HashSet<JSGlobalObject*> m_globalObjects; PauseOnExceptionsState m_pauseOnExceptionsState; @@ -213,8 +190,8 @@ private: bool m_isPaused : 1; bool m_breakpointsActivated : 1; bool m_hasHandlerForExceptionCallback : 1; - bool m_suppressAllPauses : 1; - unsigned m_steppingMode : 1; // SteppingMode + bool m_isInWorkerThread : 1; + SteppingMode m_steppingMode : 1; ReasonForPause m_reasonForPause; JSValue m_currentException; @@ -224,15 +201,12 @@ private: SourceID m_lastExecutedSourceID; BreakpointID m_topBreakpointID; - BreakpointID m_pausingBreakpointID; BreakpointIDToBreakpointMap m_breakpointIDToBreakpoint; SourceIDToBreakpointsMap m_sourceIDToBreakpoints; RefPtr<JSC::DebuggerCallFrame> m_currentDebuggerCallFrame; - ProfilingClient* m_profilingClient { nullptr }; - - friend class DebuggerPausedScope; + friend class DebuggerCallFrameScope; friend class TemporaryPausedState; friend class LLIntOffsetsExtractor; }; |