-
Notifications
You must be signed in to change notification settings - Fork 27
/
IDwarfImage.cs
126 lines (108 loc) · 3.64 KB
/
IDwarfImage.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
using SharpUtilities;
using System;
using System.Collections.Generic;
using static CxxDemangler.CxxDemangler;
namespace SharpDebug.DwarfSymbolProvider
{
/// <summary>
/// Public symbol defined in image container (<see cref="IDwarfImage"/>).
/// </summary>
public class PublicSymbol
{
/// <summary>
/// The demangled name cache
/// </summary>
private SimpleCache<string> demangledName;
/// <summary>
/// Initializes a new instance of the <see cref="PublicSymbol"/> class.
/// </summary>
/// <param name="name">The symbol name.</param>
/// <param name="address">The address.</param>
public PublicSymbol(string name, ulong address)
{
Name = name;
Address = address;
demangledName = SimpleCache.Create(() => Demangle(name));
}
/// <summary>
/// Gets the public symbol name.
/// </summary>
public string Name { get; private set; }
/// <summary>
/// Gets the public symbol address.
/// </summary>
public ulong Address { get; private set; }
/// <summary>
/// Gets the demangled name using <see cref="CxxDemangler.CxxDemangler.Demangle(string, bool)"/>.
/// </summary>
public string DemangledName
{
get
{
return demangledName.Value;
}
}
}
/// <summary>
/// Interface that defines image format that contains DWARF data.
/// </summary>
internal interface IDwarfImage : IDisposable
{
/// <summary>
/// Gets the debug data.
/// </summary>
byte[] DebugData { get; }
/// <summary>
/// Gets the debug data description.
/// </summary>
byte[] DebugDataDescription { get; }
/// <summary>
/// Gets the debug data strings.
/// </summary>
byte[] DebugDataStrings { get; }
/// <summary>
/// Gets the debug line.
/// </summary>
byte[] DebugLine { get; }
/// <summary>
/// Gets the debug frame.
/// </summary>
byte[] DebugFrame { get; }
/// <summary>
/// Gets the exception handling frames used for unwinding (generated by usually GCC compiler).
/// </summary>
byte[] EhFrame { get; }
/// <summary>
/// Gets the code segment offset.
/// </summary>
ulong CodeSegmentOffset { get; }
/// <summary>
/// Gets the address of exception handling frames stream after loading into memory.
/// </summary>
ulong EhFrameAddress { get; }
/// <summary>
/// Gets the address of text section after loading into memory.
/// </summary>
ulong TextSectionAddress { get; }
/// <summary>
/// Gets the address of data section after loading into memory.
/// </summary>
ulong DataSectionAddress { get; }
/// <summary>
/// Gets the public symbols.
/// </summary>
IReadOnlyList<PublicSymbol> PublicSymbols { get; }
/// <summary>
/// Gets a value indicating whether this <see cref="IDwarfImage"/> is 64 bit image.
/// </summary>
/// <value>
/// <c>true</c> if is 64 bit image; otherwise, <c>false</c>.
/// </value>
bool Is64bit { get; }
/// <summary>
/// Gets address offset within module when it is loaded.
/// </summary>
/// <param name="address">Virtual address that points where something should be loaded.</param>
ulong NormalizeAddress(ulong address);
}
}