DebugServer2
Loading...
Searching...
No Matches
RegisterLayout.h
1//
2// Copyright (c) 2014-present, Facebook, Inc.
3// All rights reserved.
4//
5// This source code is licensed under the University of Illinois/NCSA Open
6// Source License found in the LICENSE file in the root directory of this
7// source tree. An additional grant of patent rights can be found in the
8// PATENTS file in the same directory.
9//
10
11#pragma once
12
13#include "DebugServer2/Base.h"
14#include "DebugServer2/Types.h"
15
16#include <map>
17
18namespace ds2 {
19namespace Architecture {
20
21enum Encoding {
22 kEncodingNone,
23 kEncodingUInteger,
24 kEncodingSInteger,
25 kEncodingIEEESingle,
26 kEncodingIEEEDouble,
27 kEncodingIEEEExtended
28};
29
30enum Format {
31 kFormatNone,
32 kFormatBinary,
33 kFormatDecimal,
34 kFormatHexadecimal,
35 kFormatFloat,
36 kFormatVector
37};
38
39enum GDBEncoding {
40 kGDBEncodingNone,
41 kGDBEncodingInteger,
42 kGDBEncodingSizedInteger,
43 kGDBEncodingUInt128,
44 kGDBEncodingDataPointer,
45 kGDBEncodingCodePointer,
46 kGDBEncodingX87Extension,
47 kGDBEncodingIEEESingle,
48 kGDBEncodingIEEEDouble,
49 kGDBEncodingCustom,
50 kGDBEncodingUnknown
51};
52
53enum GDBFeatureEntryType {
54 kGDBFeatureTypeNone,
55 kGDBFeatureTypeRegister,
56 kGDBFeatureTypeVector,
57 kGDBFeatureTypeFlags,
58 kGDBFeatureTypeUnion
59};
60
61enum LLDBVectorFormat {
62 kLLDBVectorFormatNone,
63 kLLDBVectorFormatUInt8,
64 kLLDBVectorFormatSInt8,
65 kLLDBVectorFormatUInt16,
66 kLLDBVectorFormatSInt16,
67 kLLDBVectorFormatUInt32,
68 kLLDBVectorFormatSInt32,
69 kLLDBVectorFormatUInt64,
70 kLLDBVectorFormatSInt64,
71 kLLDBVectorFormatUInt128,
72 kLLDBVectorFormatFloat32
73};
74
75enum /*RegisterDefFlags*/ { kRegisterDefNoGDBRegisterNumber = (1 << 0) };
76
78 char const *Name;
79 char const *LLDBName;
80 char const *AlternateName;
81 char const *GenericName;
82 char const *GDBGroupName;
83 ssize_t BitSize;
84 int32_t DWARFRegisterNumber;
85 int32_t GDBRegisterNumber;
86 int32_t EHFrameRegisterNumber;
87 int32_t LLDBRegisterNumber;
88 ssize_t LLDBOffset;
89 Architecture::LLDBVectorFormat LLDBVectorFormat;
90 Architecture::Encoding Encoding;
91 Architecture::Format Format;
92 struct {
93 Architecture::GDBEncoding Encoding;
94 char const *Name;
95 } GDBEncoding;
96 uint32_t Flags;
97 RegisterDef const *const *InvalidatedRegisters;
98 RegisterDef const *const *ContainerRegisters;
99};
100
101struct FlagDef {
102 char const *Name;
103 size_t Start;
104 size_t Length;
105};
106
107struct FlagSet {
108 char const *Name;
109 size_t BitSize;
110 size_t Count;
111 FlagDef const *Defs;
112};
113
115 char const *Name;
116 size_t BitSize;
117 ssize_t ElementBitSize;
118 GDBEncoding Encoding;
119};
120
122 char const *Name;
123 GDBEncoding Encoding;
124 GDBVectorDef const *Def;
125};
126
128 char const *Name;
129 size_t Count;
130 GDBVectorUnionField const *Fields;
131};
132
134 GDBFeatureEntryType Type;
135 void const *Data;
136};
137
139 char const *Identifier;
140 char const *FileName;
141 size_t Count;
142 GDBFeatureEntry const *Entries;
143};
144
146 char const *Name;
147 size_t Count;
148 RegisterDef const *const *Defs;
149};
150
152 char const *Architecture;
153 char const *OSABI;
154 size_t Count;
155 GDBFeature const *const *Features;
156};
157
159 size_t Count;
160 LLDBRegisterSet const *const *Sets;
161};
162
163//
164// Public APIs
165//
166
168 size_t size;
169 uint64_t value;
170};
171
172typedef std::map<size_t, GPRegisterValue> GPRegisterStopMap;
173typedef std::vector<GPRegisterValue> GPRegisterValueVector;
174
175//
176// XML Generation Functions
177//
178
179std::string GenerateXMLHeader();
180
181std::string GDBGenerateXMLMain(GDBDescriptor const &desc);
182
183std::string GDBGenerateXMLFeatureByIndex(GDBDescriptor const &desc,
184 size_t index);
185
186std::string GDBGenerateXMLFeatureByFileName(GDBDescriptor const &desc,
187 std::string const &filename);
188
189std::string GDBGenerateXMLFeatureByIdentifier(GDBDescriptor const &desc,
190 std::string const &ident);
191
192std::string LLDBGenerateXMLMain(LLDBDescriptor const &lldbDesc);
193
194//
195// LLDB Register Information Functions
196//
197
199 char const *SetName;
200 RegisterDef const *Def;
201};
202
203bool LLDBGetRegisterInfo(LLDBDescriptor const &desc, size_t index,
204 LLDBRegisterInfo &info);
205
206bool LLDBGetRegisterInfo(LLDBDescriptor const &desc, std::string const &name,
207 LLDBRegisterInfo &info);
208} // namespace Architecture
209} // namespace ds2
Definition RegisterLayout.h:101
Definition RegisterLayout.h:107
Definition RegisterLayout.h:151
Definition RegisterLayout.h:133
Definition RegisterLayout.h:138
Definition RegisterLayout.h:114
Definition RegisterLayout.h:121
Definition RegisterLayout.h:127
Definition RegisterLayout.h:167
Definition RegisterLayout.h:158
Definition RegisterLayout.h:198
Definition RegisterLayout.h:145
Definition RegisterLayout.h:77