summaryrefslogtreecommitdiff
path: root/Source/JavaScriptCore/debugger/Debugger.h
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@lorry>2016-05-24 08:28:08 +0000
committerLorry Tar Creator <lorry-tar-importer@lorry>2016-05-24 08:28:08 +0000
commita4e969f4965059196ca948db781e52f7cfebf19e (patch)
tree6ca352808c8fdc52006a0f33f6ae3c593b23867d /Source/JavaScriptCore/debugger/Debugger.h
parent41386e9cb918eed93b3f13648cbef387e371e451 (diff)
downloadWebKitGtk-tarball-a4e969f4965059196ca948db781e52f7cfebf19e.tar.gz
webkitgtk-2.12.3webkitgtk-2.12.3
Diffstat (limited to 'Source/JavaScriptCore/debugger/Debugger.h')
-rw-r--r--Source/JavaScriptCore/debugger/Debugger.h82
1 files changed, 54 insertions, 28 deletions
diff --git a/Source/JavaScriptCore/debugger/Debugger.h b/Source/JavaScriptCore/debugger/Debugger.h
index f7b734f37..2e91aafbe 100644
--- a/Source/JavaScriptCore/debugger/Debugger.h
+++ b/Source/JavaScriptCore/debugger/Debugger.h
@@ -23,17 +23,19 @@
#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;
@@ -43,9 +45,11 @@ typedef ExecState CallFrame;
class JS_EXPORT_PRIVATE Debugger {
public:
- Debugger(bool isInWorkerThread = false);
+ Debugger(VM&);
virtual ~Debugger();
+ VM& vm() { return m_vm; }
+
JSC::DebuggerCallFrame* currentDebuggerCallFrame() const;
bool hasHandlerForExceptionCallback() const
{
@@ -60,12 +64,13 @@ public:
bool needsExceptionCallbacks() const { return m_pauseOnExceptionsState != DontPauseOnExceptions; }
- void attach(JSGlobalObject*);
enum ReasonForDetach {
TerminatingDebuggingSession,
GlobalObjectIsDestructing
};
- virtual void detach(JSGlobalObject*, ReasonForDetach);
+ void attach(JSGlobalObject*);
+ void detach(JSGlobalObject*, ReasonForDetach);
+ bool isAttached(JSGlobalObject*);
BreakpointID setBreakpoint(Breakpoint, unsigned& actualLine, unsigned& actualColumn);
void removeBreakpoint(BreakpointID);
@@ -82,6 +87,20 @@ 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();
@@ -89,12 +108,15 @@ public:
void stepOverStatement();
void stepOutOfFunction();
- bool isPaused() { return m_isPaused; }
+ bool isPaused() const { 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 hasHandler);
+ void exception(CallFrame*, JSValue exceptionValue, bool hasCatchHandler);
void atStatement(CallFrame*);
void callEvent(CallFrame*);
void returnEvent(CallFrame*);
@@ -102,34 +124,35 @@ public:
void didExecuteProgram(CallFrame*);
void didReachBreakpoint(CallFrame*);
- void recompileAllJSFunctions(VM*);
+ virtual void recompileAllJSFunctions();
void registerCodeBlock(CodeBlock*);
-protected:
- virtual bool needPauseHandling(JSGlobalObject*) { return false; }
- 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
+ class ProfilingClient {
+ public:
+ virtual ~ProfilingClient() { }
+ virtual bool isAlreadyProfiling() const = 0;
+ virtual double willEvaluateScript() = 0;
+ virtual void didEvaluateScript(double startTime, ProfilingReason) = 0;
};
- virtual void handlePause(ReasonForPause, JSGlobalObject*) { }
+ 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 notifyDoneProcessingDebuggerEvents() { }
private:
typedef HashMap<BreakpointID, Breakpoint*> BreakpointIDToBreakpointMap;
- typedef Vector<Breakpoint> BreakpointsInLine;
- typedef HashMap<unsigned, BreakpointsInLine, WTF::IntHash<int>, WTF::UnsignedWithZeroKeyHashTraits<int>> LineToBreakpointsMap;
+ typedef HashMap<unsigned, RefPtr<BreakpointsList>, WTF::IntHash<int>, WTF::UnsignedWithZeroKeyHashTraits<int>> LineToBreakpointsMap;
typedef HashMap<SourceID, LineToBreakpointsMap, WTF::IntHash<SourceID>, WTF::UnsignedWithZeroKeyHashTraits<SourceID>> SourceIDToBreakpointsMap;
class ClearCodeBlockDebuggerRequestsFunctor;
@@ -182,7 +205,7 @@ private:
void clearDebuggerRequests(JSGlobalObject*);
- VM* m_vm;
+ VM& m_vm;
HashSet<JSGlobalObject*> m_globalObjects;
PauseOnExceptionsState m_pauseOnExceptionsState;
@@ -190,8 +213,8 @@ private:
bool m_isPaused : 1;
bool m_breakpointsActivated : 1;
bool m_hasHandlerForExceptionCallback : 1;
- bool m_isInWorkerThread : 1;
- SteppingMode m_steppingMode : 1;
+ bool m_suppressAllPauses : 1;
+ unsigned m_steppingMode : 1; // SteppingMode
ReasonForPause m_reasonForPause;
JSValue m_currentException;
@@ -201,12 +224,15 @@ private:
SourceID m_lastExecutedSourceID;
BreakpointID m_topBreakpointID;
+ BreakpointID m_pausingBreakpointID;
BreakpointIDToBreakpointMap m_breakpointIDToBreakpoint;
SourceIDToBreakpointsMap m_sourceIDToBreakpoints;
RefPtr<JSC::DebuggerCallFrame> m_currentDebuggerCallFrame;
- friend class DebuggerCallFrameScope;
+ ProfilingClient* m_profilingClient { nullptr };
+
+ friend class DebuggerPausedScope;
friend class TemporaryPausedState;
friend class LLIntOffsetsExtractor;
};