-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathStackFrame.cs
More file actions
50 lines (45 loc) · 1.24 KB
/
StackFrame.cs
File metadata and controls
50 lines (45 loc) · 1.24 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
using System;
using System.Linq;
using System.Text.RegularExpressions;
namespace PSExt
{
public class StackFrame
{
public StackFrame(ulong returnOffset, ulong instructionOffset, ulong frameOffset, ushort frameNumber, string name,
ulong displacement, DebugThread thread)
{
ReturnOffset = returnOffset;
InstructionOffset = instructionOffset;
FrameOffset = frameOffset;
FrameNumber = frameNumber;
Name = string.Intern(name);
var sep = name.IndexOf('!');
sep = (sep == -1) ? 0 : sep;
Module = string.Intern(name.Substring(0, sep));
Function = name.Substring(sep + 1);
Displacement = displacement;
Thread = thread;
}
public ulong ReturnOffset { get; }
public ulong InstructionOffset { get; }
public ulong FrameOffset { get; }
public string Name { get; }
public string Module { get; }
public string Function { get; }
public ulong Displacement { get; }
public ushort FrameNumber { get; }
public DebugThread Thread { get; }
public bool Matches(string pattern)
{
return Regex.IsMatch(Name, pattern);
}
public bool Contains(string pattern)
{
return Name.IndexOf(pattern, StringComparison.Ordinal) != -1;
}
public override string ToString()
{
return $"{Name}+0x{Displacement:X}";
}
}
}