-
Notifications
You must be signed in to change notification settings - Fork 4.5k
/
DebugInfoTypes.cs
138 lines (127 loc) · 3.86 KB
/
DebugInfoTypes.cs
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.
using System;
using System.Collections.Generic;
namespace ILCompiler.Reflection.ReadyToRun
{
public struct DebugInfoBoundsEntry
{
public uint NativeOffset;
public uint ILOffset;
public SourceTypes SourceTypes;
}
public struct NativeVarInfo
{
public uint StartOffset;
public uint EndOffset;
// TODO: Eliminate this
public uint VariableNumber;
public Variable Variable { get; internal set; }
public VarLoc VariableLocation;
}
public enum VariableType
{
Parameter,
Local,
// TODO: Special
}
public class Variable
{
public VariableType Type { get; internal set; }
public int Index { get; internal set; }
}
[Flags]
public enum SourceTypes
{
/// <summary>
/// Indicates that no other options apply
/// </summary>
SourceTypeInvalid = 0x00,
/// <summary>
/// The debugger asked for it
/// </summary>
SequencePoint = 0x01,
/// <summary>
/// The stack is empty here
/// </summary>
StackEmpty = 0x02,
/// <summary>
/// This is a call site
/// </summary>
CallSite = 0x04,
/// <summary>
/// Indicate an epilog endpoint
/// </summary>
NativeEndOffsetUnknown = 0x08,
/// <summary>
/// The actual instruction of a call
/// </summary>
CallInstruction = 0x10
}
public enum DebugInfoBoundsType : uint
{
NoMapping = 0xffffffff,
Prolog = 0xfffffffe,
Epilog = 0xfffffffd,
MaxMappingValue = Epilog
}
public enum ImplicitILArguments
{
VarArgsHandle = -1,
ReturnBuffer = -2,
TypeContext = -3,
Unknown = -4,
Max = Unknown
}
public enum VarLocType
{
VLT_REG, // variable is in a register
VLT_REG_BYREF, // address of the variable is in a register
VLT_REG_FP, // variable is in an fp register
VLT_STK, // variable is on the stack (memory addressed relative to the frame-pointer)
VLT_STK_BYREF, // address of the variable is on the stack (memory addressed relative to the frame-pointer)
VLT_REG_REG, // variable lives in two registers
VLT_REG_STK, // variable lives partly in a register and partly on the stack
VLT_STK_REG, // reverse of VLT_REG_STK
VLT_STK2, // variable lives in two slots on the stack
VLT_FPSTK, // variable lives on the floating-point stack
VLT_FIXED_VA, // variable is a fixed argument in a varargs function (relative to VARARGS_HANDLE)
VLT_COUNT,
VLT_INVALID,
}
public struct VarLoc
{
public VarLocType VarLocType;
// What's stored in the Data# fields changes based on VarLocType and will be
// interpreted accordingly when the variable location information is dumped.
public int Data1;
public int Data2;
public int Data3;
}
public class NativeVarInfoComparer : IComparer<NativeVarInfo>
{
public int Compare(NativeVarInfo left, NativeVarInfo right)
{
if (left.VariableNumber < right.VariableNumber)
{
return -1;
}
else if (left.VariableNumber > right.VariableNumber)
{
return 1;
}
else if (left.StartOffset < right.StartOffset)
{
return -1;
}
else if (left.StartOffset > right.StartOffset)
{
return 1;
}
else
{
return 0;
}
}
}
}