forked from chakra-core/ChakraCore
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJsrtDebugManager.h
More file actions
91 lines (71 loc) · 4.35 KB
/
JsrtDebugManager.h
File metadata and controls
91 lines (71 loc) · 4.35 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
85
86
87
88
89
90
91
//-------------------------------------------------------------------------------------------------------
// Copyright (C) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
//-------------------------------------------------------------------------------------------------------
#pragma once
#include "../Runtime/Debug/RuntimeDebugPch.h"
#include "JsrtDebuggerObject.h"
#include "JsrtDebugEventObject.h"
class JsrtDebugManager : public Js::HaltCallback, public Js::DebuggerOptionsCallback, public HostDebugContext
{
public:
JsrtDebugManager(ThreadContext* threadContext);
~JsrtDebugManager();
void SetDebugEventCallback(JsDiagDebugEventCallback debugEventCallback, void* callbackState);
void* GetAndClearCallbackState();
bool IsDebugEventCallbackSet() const;
void ReportScriptCompile(Js::JavascriptFunction* scriptFunction, Js::Utf8SourceInfo* utf8SourceInfo, CompileScriptException* compileException);
void ReportBreak(Js::InterpreterHaltState* haltState);
void ReportExceptionBreak(Js::InterpreterHaltState* haltState);
void HandleResume(Js::InterpreterHaltState* haltState, BREAKRESUMEACTION resumeAction);
void SetResumeType(BREAKRESUMEACTION resumeAction);
bool EnableAsyncBreak(Js::ScriptContext* scriptContext);
void CallDebugEventCallback(JsDiagDebugEvent debugEvent, Js::DynamicObject* eventDataObject, Js::ScriptContext* scriptContext, bool isBreak);
void CallDebugEventCallbackForBreak(JsDiagDebugEvent debugEvent, Js::DynamicObject* eventDataObject, Js::ScriptContext* scriptContext);
Js::JavascriptArray* GetScripts(Js::ScriptContext* scriptContext);
Js::DynamicObject* GetScript(Js::Utf8SourceInfo* utf8SourceInfo);
Js::DynamicObject* GetSource(Js::ScriptContext* scriptContext, uint scriptId);
Js::JavascriptArray* GetStackFrames(Js::ScriptContext* scriptContext);
bool TryGetFrameObjectFromFrameIndex(Js::ScriptContext *scriptContext, uint frameIndex, JsrtDebuggerStackFrame ** debuggerStackFrame);
Js::DynamicObject* SetBreakPoint(Js::ScriptContext* scriptContext, Js::Utf8SourceInfo* utf8SourceInfo, UINT lineNumber, UINT columnNumber);
void GetBreakpoints(Js::JavascriptArray** bpsArray, Js::ScriptContext* scriptContext);
#if ENABLE_TTD
Js::BreakpointProbe* SetBreakpointHelper_TTD(Js::ScriptContext* scriptContext, Js::Utf8SourceInfo* utf8SourceInfo, UINT lineNumber, UINT columnNumber, bool* isNewBP);
#endif
JsrtDebuggerObjectsManager* GetDebuggerObjectsManager();
void ClearDebuggerObjects();
ArenaAllocator* GetDebugObjectArena();
JsrtDebugDocumentManager* GetDebugDocumentManager();
void ClearDebugDocument(Js::ScriptContext* scriptContext);
void ClearBreakpointDebugDocumentDictionary();
bool RemoveBreakpoint(UINT breakpointId);
void SetBreakOnException(JsDiagBreakOnExceptionAttributes exceptionAttributes);
JsDiagBreakOnExceptionAttributes GetBreakOnException();
JsDiagDebugEvent GetDebugEventFromStopType(Js::StopType stopType);
ThreadContext* GetThreadContext() const { return this->threadContext; }
private:
ThreadContext* threadContext;
JsDiagDebugEventCallback debugEventCallback;
void* callbackState;
BREAKRESUMEACTION resumeAction;
ArenaAllocator* debugObjectArena;
JsrtDebuggerObjectsManager* debuggerObjectsManager;
JsrtDebugDocumentManager* debugDocumentManager;
JsrtDebugStackFrames* stackFrames;
JsDiagBreakOnExceptionAttributes breakOnExceptionAttributes;
// Js::HaltCallback overrides
virtual bool CanHalt(Js::InterpreterHaltState* pHaltState);
virtual void DispatchHalt(Js::InterpreterHaltState* pHaltState);
virtual void CleanupHalt() sealed;
virtual bool CanAllowBreakpoints();
virtual bool IsInClosedState();
// Js::DebuggerOptionsCallback overrides
virtual bool IsExceptionReportingEnabled();
virtual bool IsFirstChanceExceptionEnabled();
// HostDebugContext overrides
virtual void Delete() {}
DWORD_PTR GetHostSourceContext(Js::Utf8SourceInfo* sourceInfo) { return Js::Constants::NoHostSourceContext; }
HRESULT SetThreadDescription(__in LPCWSTR url) { return S_OK; }
HRESULT DbgRegisterFunction(Js::ScriptContext* scriptContext, Js::FunctionBody* functionBody, DWORD_PTR dwDebugSourceContext, LPCWSTR title);
void ReParentToCaller(Js::Utf8SourceInfo* sourceInfo) {}
};