forked from dotnet/runtime
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdebuginfo.h
138 lines (111 loc) · 3.26 KB
/
debuginfo.h
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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
#ifndef _DEBUGINFO_H_
#define _DEBUGINFO_H_
#include "jit.h"
class InlineContext;
// Represents information about the location of an IL instruction.
class ILLocation
{
public:
ILLocation() : m_offset(BAD_IL_OFFSET), m_isStackEmpty(false), m_isCall(false)
{
}
ILLocation(IL_OFFSET offset, bool isStackEmpty, bool isCall)
: m_offset(offset), m_isStackEmpty(isStackEmpty), m_isCall(isCall)
{
}
IL_OFFSET GetOffset() const
{
return m_offset;
}
// Is this source location at a stack empty point? We need to be able to
// report this information back to the debugger since we only allow EnC
// transitions at stack empty points.
bool IsStackEmpty() const
{
return m_isStackEmpty;
}
// Is this a call instruction? Used for managed return values.
bool IsCall() const
{
return m_isCall;
}
bool IsValid() const
{
return m_offset != BAD_IL_OFFSET;
}
inline bool operator==(const ILLocation& other) const
{
return (m_offset == other.m_offset) && (m_isStackEmpty == other.m_isStackEmpty) && (m_isCall == other.m_isCall);
}
inline bool operator!=(const ILLocation& other) const
{
return !(*this == other);
}
ICorDebugInfo::SourceTypes EncodeSourceTypes() const;
#ifdef DEBUG
// Dump textual representation of this ILLocation to jitstdout.
void Dump() const;
#endif
private:
IL_OFFSET m_offset;
bool m_isStackEmpty : 1;
bool m_isCall : 1;
};
// Represents debug information about a statement.
class DebugInfo
{
public:
DebugInfo() : m_inlineContext(nullptr)
{
}
DebugInfo(InlineContext* inlineContext, ILLocation loc) : m_inlineContext(inlineContext), m_location(loc)
{
}
InlineContext* GetInlineContext() const
{
return m_inlineContext;
}
ILLocation GetLocation() const
{
return m_location;
}
// Retrieve information about the location that inlined this statement.
// Note that there can be associated parent information even when IsValid
// below returns false.
bool GetParent(DebugInfo* parent) const;
// Get debug info in the root. If this debug info is in the root, then
// returns *this. Otherwise returns information of the call in the root
// that eventually produced this statement through inlines.
DebugInfo GetRoot() const;
#ifdef DEBUG
void Validate() const;
#else
void Validate() const
{
}
#endif
#ifdef DEBUG
// Dump textual representation of this DebugInfo to jitstdout.
void Dump(bool recurse) const;
#endif
// Check if this debug info has both a valid inline context and valid
// location.
bool IsValid() const
{
return m_inlineContext != nullptr && m_location.IsValid();
}
inline bool operator==(const DebugInfo& other) const
{
return (m_inlineContext == other.m_inlineContext) && (m_location == other.m_location);
}
inline bool operator!=(const DebugInfo& other) const
{
return !(*this == other);
}
private:
InlineContext* m_inlineContext;
ILLocation m_location;
};
#endif