forked from rolandoam/JavaScriptCore
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJSCDebuggerPrivate.h
More file actions
84 lines (71 loc) · 3.17 KB
/
JSCDebuggerPrivate.h
File metadata and controls
84 lines (71 loc) · 3.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
//
// JSCDebugger.h
// TestCocos2dX
//
// Created by Rolando Abarca on 1/26/12.
// Copyright (c) 2012 Zynga Inc. All rights reserved.
//
#ifndef TestCocos2dX_JSCDebugger_h
#define TestCocos2dX_JSCDebugger_h
#include "JavaScriptCallFrame.h"
#include "ScriptBreakpoint.h"
#include "Debugger.h"
class JSCDebuggerDelegate;
namespace JSCDebug {
inline String ustringToString(const JSC::UString& u)
{
return u.impl();
}
inline JSC::UString stringToUString(const String& s)
{
return JSC::UString(s.impl());
}
class JSSimpleAccessors
{
public:
static JSC::JSValue getProperty(JSC::JSObject *obj, JSC::ExecState *state, const char *property);
static void setProperty(JSC::JSObject *obj, const char *property, JSC::JSValue value);
};
class JSCDebugger : public JSC::Debugger
{
protected:
typedef HashMap<long, ScriptBreakpoint> LineToBreakpointMap;
typedef HashMap<intptr_t, LineToBreakpointMap> SourceIdToBreakpointsMap;
JSCDebuggerDelegate* m_delegate;
bool m_shouldPauseOnExceptions;
bool m_pauseOnNextStatement;
bool m_paused;
bool m_breakpointsActivated;
JavaScriptCallFrame* m_pauseOnCallFrame;
WTF::HashMap<intptr_t,JSC::UString> m_sourceMap;
RefPtr<JavaScriptCallFrame> m_currentCallFrame;
SourceIdToBreakpointsMap m_sourceIdToBreakpoints;
JSC::JSGlobalObject* m_currentGlobalObject;
void updateCallFrameAndPauseIfNeeded(const JSC::DebuggerCallFrame&, intptr_t sourceID, int lineNumber);
void createCallFrameAndPauseIfNeeded(const JSC::DebuggerCallFrame&, intptr_t sourceID, int lineNumber);
void pauseIfNeeded(JSC::JSGlobalObject* dynamicGlobalObject);
bool hasBreakpoint(intptr_t sourceID, const TextPosition&) const;
public:
JSCDebugger();
bool isPaused() { return m_paused; };
void setDelegate(JSCDebuggerDelegate *delegate) { m_delegate = delegate; };
void setShouldPause(bool shouldPause) { m_pauseOnNextStatement = shouldPause; };
String setBreakpoint(const String& sourceID, const ScriptBreakpoint& scriptBreakpoint, int* actualLineNumber, int* actualColumnNumber);
void setBreakpointsActivated(bool activated);
// control execution
const unsigned char* evaluateInCurrentFrame(const unsigned char *scriptSource, unsigned *outLen);
void continueProgram();
void stepIntoStatement();
void stepOverStatement();
void stepOutOfFunction();
virtual void sourceParsed(JSC::ExecState*, JSC::SourceProvider* sourceProvider, int errorLineNumber, const JSC::UString& errorMessage);
virtual void exception(const JSC::DebuggerCallFrame& debugFrame, intptr_t sourceID, int lineNumber, bool);
virtual void atStatement(const JSC::DebuggerCallFrame&, intptr_t sourceID, int lineNumber);
virtual void callEvent(const JSC::DebuggerCallFrame&, intptr_t sourceID, int lineNumber);
virtual void returnEvent(const JSC::DebuggerCallFrame&, intptr_t sourceID, int lineNumber);
virtual void willExecuteProgram(const JSC::DebuggerCallFrame&, intptr_t sourceID, int lineNumber);
virtual void didExecuteProgram(const JSC::DebuggerCallFrame&, intptr_t sourceID, int lineNumber);
virtual void didReachBreakpoint(const JSC::DebuggerCallFrame&, intptr_t sourceID, int lineNumber);
};
}
#endif