OLD | NEW |
| (Empty) |
1 // Copyright 2010 The Native Client Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can | |
3 // be found in the LICENSE file. | |
4 using System; | |
5 using System.Collections.Generic; | |
6 using Google.MsAd7.BaseImpl.Interfaces.SimpleSymbolTypes; | |
7 | |
8 namespace Google.MsAd7.BaseImpl.Interfaces { | |
9 namespace SimpleSymbolTypes { | |
10 /// <summary> | |
11 /// An enumeration of BaseTypes that this SymbolProvider currently supports. | |
12 /// </summary> | |
13 public enum BaseType { | |
14 Unknown = 0, | |
15 Pointer, | |
16 Struct, | |
17 Bool, | |
18 Char, | |
19 Int, | |
20 UInt, | |
21 Float | |
22 } ; | |
23 | |
24 /// <summary> | |
25 /// A symbol's type, as represented by ISimpleDebugger. | |
26 /// </summary> | |
27 public struct SymbolType { | |
28 public ulong Key; | |
29 public string Name; | |
30 public uint SizeOf; | |
31 public BaseType TypeOf; | |
32 } | |
33 | |
34 /// <summary> | |
35 /// A symbol, as represented by ISimpleDebugger. | |
36 /// </summary> | |
37 public struct Symbol { | |
38 public ulong Key; | |
39 public SymbolType TypeOf; | |
40 public string Name; | |
41 public UInt64 Offset; | |
42 } | |
43 | |
44 /// <summary> | |
45 /// A function, as represented by ISimpleDebugger. | |
46 /// </summary> | |
47 public struct Function { | |
48 public string Name; | |
49 public UInt64 Id; | |
50 } | |
51 | |
52 /// <summary> | |
53 /// A function's signature, as represented by ISimpleDebugger. | |
54 /// </summary> | |
55 public struct FunctionDetails { | |
56 public SymbolType ReturnType; | |
57 public Symbol[] Parameters; | |
58 public Symbol[] Locals; | |
59 } | |
60 } | |
61 | |
62 /// <summary> | |
63 /// A class may implement this interface to become a symbol provider for ISimp
leDebugger. | |
64 /// </summary> | |
65 public interface ISimpleSymbolProvider { | |
66 /// <summary> | |
67 /// Converts code locations to memory addresses. | |
68 /// </summary> | |
69 /// <param name="pos">|pos| represents the location in the code.</param> | |
70 /// <returns>A memory address if one can be found that exactly occurs at |po
s|.</returns> | |
71 IEnumerable<ulong> AddressesFromPosition(DocumentPosition pos); | |
72 /// <summary> | |
73 /// Converts memory addresses to code locations. | |
74 /// </summary> | |
75 /// <param name="address">The memory address.</param> | |
76 /// <returns>A position in the code that corresponds to address.</returns> | |
77 DocumentPosition PositionFromAddress(UInt64 address); | |
78 /// <summary> | |
79 /// Call this function to get a class that knows how to perform functions th
at are specific to | |
80 /// the task of setting breakpoints. | |
81 /// </summary> | |
82 /// <returns>An implementation of IBreakpointInfo.</returns> | |
83 IBreakpointInfo GetBreakpointInfo(); | |
84 /// <summary> | |
85 /// Called to get the memory offset of the code module served by this | |
86 /// ISimpleSymbolProvider. | |
87 /// </summary> | |
88 /// <returns>The memory offset for this ISimpleSymbolProvider's code module.
</returns> | |
89 ulong GetBaseAddress(); | |
90 | |
91 /// <summary> | |
92 /// All symbols in the same scope as |programCounter|. | |
93 /// </summary> | |
94 /// <param name="instructionAddress">The address of any entity in the progra
m being debugged. | |
95 /// </param> | |
96 /// <returns>All symbols in the same scope as |programCounter|</returns> | |
97 IEnumerable<Symbol> GetSymbolsInScope(UInt64 instructionAddress); | |
98 /// <summary> | |
99 /// All addresses in the same scope as |programCounter|. | |
100 /// </summary> | |
101 /// <param name="programCounter">The address of any entity in the program be
ing debugged. | |
102 /// </param> | |
103 /// <returns>All addresses in the same scope as |programCounter|</returns> | |
104 IEnumerable<UInt64> GetAddressesInScope(UInt64 programCounter); | |
105 /// <summary> | |
106 /// This can be used to turn symbol information into a human-readable repres
entation. | |
107 /// </summary> | |
108 /// <param name="key">A symbol type's integral value.</param> | |
109 /// <param name="arrBytes">The raw data contained by the symbol.</param> | |
110 /// <returns>A human readable representation</returns> | |
111 String SymbolValueToString(ulong key, ArraySegment<Byte> arrBytes); | |
112 | |
113 /// <summary> | |
114 /// This can be used to look up a function's representation. | |
115 /// </summary> | |
116 /// <param name="address">The desired function's address.</param> | |
117 /// <returns>The Function defined at |address|</returns> | |
118 Function FunctionFromAddress(UInt64 address); | |
119 /// <summary> | |
120 /// This can be used to look up a function's signature. | |
121 /// </summary> | |
122 /// <param name="fn">The function whose signature is desired.</param> | |
123 /// <returns>The signature of |fn|</returns> | |
124 FunctionDetails GetFunctionDetails(Function fn); | |
125 | |
126 /// <summary> | |
127 /// Loads a code module into this ISimpleSymbolProvider. | |
128 /// </summary> | |
129 /// <param name="path">The path to the code module.</param> | |
130 /// <param name="loadOffset">The offset of the module's code in memory.</par
am> | |
131 /// <param name="status">The status which is mostly interesting if the modul
e failed to load. | |
132 /// </param> | |
133 /// <returns>true if and only if the module was loaded successfully</returns
> | |
134 bool LoadModule(string path, UInt64 loadOffset, out string status); | |
135 /// <summary> | |
136 /// Gets the next location after whatever is at |address| that corresponds t
o a valid address. | |
137 /// </summary> | |
138 /// <param name="addr">An address to start searching from</param> | |
139 /// <returns>The next code location after |addr|</returns> | |
140 UInt64 GetNextLocation(UInt64 addr); | |
141 } | |
142 } | |
OLD | NEW |