forked from chakra-core/ChakraCore
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDiagStackFrame.h
More file actions
118 lines (102 loc) · 4.75 KB
/
DiagStackFrame.h
File metadata and controls
118 lines (102 loc) · 4.75 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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
//-------------------------------------------------------------------------------------------------------
// 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
namespace Js
{
class DiagNativeStackFrame;
//
// Unified stack frame used by debugger (F12, inside VS)
// -- interpreter or native stack frame.
//
class DiagStackFrame
{
public:
virtual ~DiagStackFrame() {}
virtual JavascriptFunction* GetJavascriptFunction() = 0;
virtual int GetByteCodeOffset() = 0;
virtual DWORD_PTR GetStackAddress() = 0;
virtual Var GetRegValue(RegSlot slotId, bool allowTemp = false) = 0;
virtual Var GetNonVarRegValue(RegSlot slotId) = 0;
virtual void SetRegValue(RegSlot slotId, Var value) = 0;
virtual Var GetArgumentsObject() = 0;
virtual Var CreateHeapArguments() = 0;
virtual ScriptContext* GetScriptContext();
virtual PCWSTR GetDisplayName();
virtual bool IsInterpreterFrame();
virtual InterpreterStackFrame* AsInterpreterFrame();
virtual ArenaAllocator * GetArena();
virtual FrameDisplay * GetFrameDisplay();
virtual Var GetScopeObjectFromFrameDisplay(uint index);
virtual Var GetRootObject();
virtual Var GetInnerScopeFromRegSlot(RegSlot location);
bool IsTopFrame();
ScriptFunction* GetScriptFunction();
FunctionBody* GetFunction();
protected:
DiagStackFrame(int frameIndex);
private:
int frameIndex;
};
class DiagInterpreterStackFrame : public DiagStackFrame
{
InterpreterStackFrame* m_interpreterFrame;
public:
DiagInterpreterStackFrame(InterpreterStackFrame* frame, int frameIndex);
virtual JavascriptFunction* GetJavascriptFunction() override;
virtual ScriptContext* GetScriptContext() override;
virtual int GetByteCodeOffset() override;
virtual DWORD_PTR GetStackAddress() override;
virtual bool IsInterpreterFrame() override;
virtual InterpreterStackFrame* AsInterpreterFrame() override;
virtual Var GetRegValue(RegSlot slotId, bool allowTemp = false) override;
virtual Var GetNonVarRegValue(RegSlot slotId) override;
virtual void SetRegValue(RegSlot slotId, Var value) override;
virtual Var GetArgumentsObject() override;
virtual Var CreateHeapArguments() override;
virtual FrameDisplay * GetFrameDisplay() override;
virtual Var GetInnerScopeFromRegSlot(RegSlot location) override;
};
#if ENABLE_NATIVE_CODEGEN
class DiagNativeStackFrame : public DiagStackFrame
{
ScriptFunction* m_function;
int m_byteCodeOffset;
void* m_stackAddr;
int32 m_localVarSlotsOffset; // the offset on the native stack frame where the locals are residing.
int32 m_localVarChangedOffset; // The offset which stores if any locals is changed from the debugger.
static const int32 InvalidOffset = -1;
public:
DiagNativeStackFrame(ScriptFunction* function, int byteCodeOffset, void* stackAddr, void *codeAddr, int frameIndex);
virtual JavascriptFunction* GetJavascriptFunction() override;
virtual ScriptContext* GetScriptContext() override;
virtual int GetByteCodeOffset() override;
virtual DWORD_PTR GetStackAddress() override;
virtual Var GetRegValue(RegSlot slotId, bool allowTemp = false) override;
virtual Var GetNonVarRegValue(RegSlot slotId) override;
virtual void SetRegValue(RegSlot slotId, Var value) override;
virtual Var GetArgumentsObject() override;
virtual Var CreateHeapArguments() override;
private:
Var * GetSlotOffsetLocation(RegSlot slotId, bool allowTemp = false);
};
#endif
class DiagRuntimeStackFrame : public DiagStackFrame
{
JavascriptFunction* m_function;
PCWSTR m_displayName;
void* m_stackAddr;
public:
DiagRuntimeStackFrame(JavascriptFunction* function, PCWSTR displayName, void* stackAddr, int frameIndex);
virtual JavascriptFunction* GetJavascriptFunction() override;
virtual int GetByteCodeOffset() override;
virtual DWORD_PTR GetStackAddress() override;
virtual Var GetRegValue(RegSlot slotId, bool allowTemp = false) override;
virtual Var GetNonVarRegValue(RegSlot slotId) override;
virtual void SetRegValue(RegSlot slotId, Var value) override;
virtual Var GetArgumentsObject() override;
virtual Var CreateHeapArguments() override;
virtual PCWSTR GetDisplayName() override;
};
}