207
|
1 #!/usr/bin/env python
|
150
|
2 #===-- x86_64_qemu_target_definition.py -----------------------------*- C++ -*-===//
|
|
3 #
|
|
4 # Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
5 # See https://llvm.org/LICENSE.txt for license information.
|
|
6 # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
7 #
|
|
8 #===----------------------------------------------------------------------===//
|
|
9
|
|
10 #----------------------------------------------------------------------
|
|
11 # DESCRIPTION
|
|
12 #
|
|
13 # This file can be used with the following setting:
|
|
14 # plugin.process.gdb-remote.target-definition-file
|
|
15 # This setting should be used when you are trying to connect to a
|
|
16 # remote GDB server that doesn't support any of the register discovery
|
|
17 # packets that LLDB normally uses.
|
|
18 #
|
|
19 # Why is this necessary? LLDB doesn't require a new build of LLDB that
|
|
20 # targets each new architecture you will debug with. Instead, all
|
|
21 # architectures are supported and LLDB relies on extra GDB server
|
|
22 # packets to discover the target we are connecting to so that is can
|
|
23 # show the right registers for each target. This allows the remote stub
|
|
24 # to change and add new registers without requiring a new LLDB build
|
|
25 # just so we can see new registers.
|
|
26 #
|
|
27 # This file implements the x86_64 registers for the user mode qemu on linux.
|
|
28 # The only difference with the Linux file is the absense of orig_rax register.
|
|
29 #
|
|
30 # USAGE
|
|
31 #
|
|
32 # (lldb) settings set plugin.process.gdb-remote.target-definition-file /path/to/x86_64_qemu_target_definition.py
|
|
33 # (lldb) gdb-remote other.baz.com:1234
|
|
34 #
|
|
35 # The target definition file will get used if and only if the
|
|
36 # qRegisterInfo packets are not supported when connecting to a remote
|
|
37 # GDB stub.
|
|
38 #----------------------------------------------------------------------
|
|
39 from lldb import *
|
|
40
|
|
41 # Compiler and DWARF register numbers
|
|
42 name_to_gcc_dwarf_regnum = {
|
|
43 'rax': 0,
|
|
44 'rdx': 1,
|
|
45 'rcx': 2,
|
|
46 'rbx': 3,
|
|
47 'rsi': 4,
|
|
48 'rdi': 5,
|
|
49 'rbp': 6,
|
|
50 'rsp': 7,
|
|
51 'r8': 8,
|
|
52 'r9': 9,
|
|
53 'r10': 10,
|
|
54 'r11': 11,
|
|
55 'r12': 12,
|
|
56 'r13': 13,
|
|
57 'r14': 14,
|
|
58 'r15': 15,
|
|
59 'rip': 16,
|
|
60 'xmm0': 17,
|
|
61 'xmm1': 18,
|
|
62 'xmm2': 19,
|
|
63 'xmm3': 20,
|
|
64 'xmm4': 21,
|
|
65 'xmm5': 22,
|
|
66 'xmm6': 23,
|
|
67 'xmm7': 24,
|
|
68 'xmm8': 25,
|
|
69 'xmm9': 26,
|
|
70 'xmm10': 27,
|
|
71 'xmm11': 28,
|
|
72 'xmm12': 29,
|
|
73 'xmm13': 30,
|
|
74 'xmm14': 31,
|
|
75 'xmm15': 32,
|
|
76 'stmm0': 33,
|
|
77 'stmm1': 34,
|
|
78 'stmm2': 35,
|
|
79 'stmm3': 36,
|
|
80 'stmm4': 37,
|
|
81 'stmm5': 38,
|
|
82 'stmm6': 39,
|
|
83 'stmm7': 30,
|
|
84 'ymm0': 41,
|
|
85 'ymm1': 42,
|
|
86 'ymm2': 43,
|
|
87 'ymm3': 44,
|
|
88 'ymm4': 45,
|
|
89 'ymm5': 46,
|
|
90 'ymm6': 47,
|
|
91 'ymm7': 48,
|
|
92 'ymm8': 49,
|
|
93 'ymm9': 40,
|
|
94 'ymm10': 41,
|
|
95 'ymm11': 42,
|
|
96 'ymm12': 43,
|
|
97 'ymm13': 44,
|
|
98 'ymm14': 45,
|
|
99 'ymm15': 46
|
|
100 }
|
|
101
|
|
102 name_to_gdb_regnum = {
|
|
103 'rax': 0,
|
|
104 'rbx': 1,
|
|
105 'rcx': 2,
|
|
106 'rdx': 3,
|
|
107 'rsi': 4,
|
|
108 'rdi': 5,
|
|
109 'rbp': 6,
|
|
110 'rsp': 7,
|
|
111 'r8': 8,
|
|
112 'r9': 9,
|
|
113 'r10': 10,
|
|
114 'r11': 11,
|
|
115 'r12': 12,
|
|
116 'r13': 13,
|
|
117 'r14': 14,
|
|
118 'r15': 15,
|
|
119 'rip': 16,
|
|
120 'rflags': 17,
|
|
121 'cs': 18,
|
|
122 'ss': 19,
|
|
123 'ds': 20,
|
|
124 'es': 21,
|
|
125 'fs': 22,
|
|
126 'gs': 23,
|
|
127 'stmm0': 24,
|
|
128 'stmm1': 25,
|
|
129 'stmm2': 26,
|
|
130 'stmm3': 27,
|
|
131 'stmm4': 28,
|
|
132 'stmm5': 29,
|
|
133 'stmm6': 30,
|
|
134 'stmm7': 31,
|
|
135 'fctrl': 32,
|
|
136 'fstat': 33,
|
|
137 'ftag': 34,
|
|
138 'fiseg': 35,
|
|
139 'fioff': 36,
|
|
140 'foseg': 37,
|
|
141 'fooff': 38,
|
|
142 'fop': 39,
|
|
143 'xmm0': 40,
|
|
144 'xmm1': 41,
|
|
145 'xmm2': 42,
|
|
146 'xmm3': 43,
|
|
147 'xmm4': 44,
|
|
148 'xmm5': 45,
|
|
149 'xmm6': 46,
|
|
150 'xmm7': 47,
|
|
151 'xmm8': 48,
|
|
152 'xmm9': 49,
|
|
153 'xmm10': 50,
|
|
154 'xmm11': 51,
|
|
155 'xmm12': 52,
|
|
156 'xmm13': 53,
|
|
157 'xmm14': 54,
|
|
158 'xmm15': 55,
|
|
159 'mxcsr': 56,
|
|
160 'ymm0': 57,
|
|
161 'ymm1': 58,
|
|
162 'ymm2': 59,
|
|
163 'ymm3': 60,
|
|
164 'ymm4': 61,
|
|
165 'ymm5': 62,
|
|
166 'ymm6': 63,
|
|
167 'ymm7': 64,
|
|
168 'ymm8': 65,
|
|
169 'ymm9': 66,
|
|
170 'ymm10': 67,
|
|
171 'ymm11': 68,
|
|
172 'ymm12': 69,
|
|
173 'ymm13': 70,
|
|
174 'ymm14': 71,
|
|
175 'ymm15': 72
|
|
176 }
|
|
177
|
|
178 name_to_generic_regnum = {
|
|
179 'rip': LLDB_REGNUM_GENERIC_PC,
|
|
180 'rsp': LLDB_REGNUM_GENERIC_SP,
|
|
181 'rbp': LLDB_REGNUM_GENERIC_FP,
|
|
182 'rdi': LLDB_REGNUM_GENERIC_ARG1,
|
|
183 'rsi': LLDB_REGNUM_GENERIC_ARG2,
|
|
184 'rdx': LLDB_REGNUM_GENERIC_ARG3,
|
|
185 'rcx': LLDB_REGNUM_GENERIC_ARG4,
|
|
186 'r8': LLDB_REGNUM_GENERIC_ARG5,
|
|
187 'r9': LLDB_REGNUM_GENERIC_ARG6
|
|
188 }
|
|
189
|
|
190
|
|
191 def get_reg_num(reg_num_dict, reg_name):
|
|
192 if reg_name in reg_num_dict:
|
|
193 return reg_num_dict[reg_name]
|
|
194 return LLDB_INVALID_REGNUM
|
|
195
|
|
196 x86_64_register_infos = [
|
|
197 {'name': 'rax',
|
|
198 'set': 0,
|
|
199 'bitsize': 64,
|
|
200 'encoding': eEncodingUint,
|
|
201 'format': eFormatAddressInfo},
|
|
202 {'name': 'rbx',
|
|
203 'set': 0,
|
|
204 'bitsize': 64,
|
|
205 'encoding': eEncodingUint,
|
|
206 'format': eFormatAddressInfo},
|
|
207 {'name': 'rcx', 'set': 0, 'bitsize': 64, 'encoding': eEncodingUint,
|
|
208 'format': eFormatAddressInfo, 'alt-name': 'arg4'},
|
|
209 {'name': 'rdx', 'set': 0, 'bitsize': 64, 'encoding': eEncodingUint,
|
|
210 'format': eFormatAddressInfo, 'alt-name': 'arg3'},
|
|
211 {'name': 'rsi', 'set': 0, 'bitsize': 64, 'encoding': eEncodingUint,
|
|
212 'format': eFormatAddressInfo, 'alt-name': 'arg2'},
|
|
213 {'name': 'rdi', 'set': 0, 'bitsize': 64, 'encoding': eEncodingUint,
|
|
214 'format': eFormatAddressInfo, 'alt-name': 'arg1'},
|
|
215 {'name': 'rbp', 'set': 0, 'bitsize': 64, 'encoding': eEncodingUint,
|
|
216 'format': eFormatAddressInfo, 'alt-name': 'fp'},
|
|
217 {'name': 'rsp', 'set': 0, 'bitsize': 64, 'encoding': eEncodingUint,
|
|
218 'format': eFormatAddressInfo, 'alt-name': 'sp'},
|
|
219 {'name': 'r8', 'set': 0, 'bitsize': 64, 'encoding': eEncodingUint,
|
|
220 'format': eFormatAddressInfo, 'alt-name': 'arg5'},
|
|
221 {'name': 'r9', 'set': 0, 'bitsize': 64, 'encoding': eEncodingUint,
|
|
222 'format': eFormatAddressInfo, 'alt-name': 'arg6'},
|
|
223 {'name': 'r10',
|
|
224 'set': 0,
|
|
225 'bitsize': 64,
|
|
226 'encoding': eEncodingUint,
|
|
227 'format': eFormatAddressInfo},
|
|
228 {'name': 'r11',
|
|
229 'set': 0,
|
|
230 'bitsize': 64,
|
|
231 'encoding': eEncodingUint,
|
|
232 'format': eFormatAddressInfo},
|
|
233 {'name': 'r12',
|
|
234 'set': 0,
|
|
235 'bitsize': 64,
|
|
236 'encoding': eEncodingUint,
|
|
237 'format': eFormatAddressInfo},
|
|
238 {'name': 'r13',
|
|
239 'set': 0,
|
|
240 'bitsize': 64,
|
|
241 'encoding': eEncodingUint,
|
|
242 'format': eFormatAddressInfo},
|
|
243 {'name': 'r14',
|
|
244 'set': 0,
|
|
245 'bitsize': 64,
|
|
246 'encoding': eEncodingUint,
|
|
247 'format': eFormatAddressInfo},
|
|
248 {'name': 'r15',
|
|
249 'set': 0,
|
|
250 'bitsize': 64,
|
|
251 'encoding': eEncodingUint,
|
|
252 'format': eFormatAddressInfo},
|
|
253 {'name': 'rip', 'set': 0, 'bitsize': 64, 'encoding': eEncodingUint,
|
|
254 'format': eFormatAddressInfo, 'alt-name': 'pc'},
|
|
255 {'name': 'rflags', 'set': 0, 'bitsize': 32,
|
|
256 'encoding': eEncodingUint, 'format': eFormatHex},
|
|
257 {'name': 'cs', 'set': 0, 'bitsize': 32,
|
|
258 'encoding': eEncodingUint, 'format': eFormatHex},
|
|
259 {'name': 'ss', 'set': 0, 'bitsize': 32,
|
|
260 'encoding': eEncodingUint, 'format': eFormatHex},
|
|
261 {'name': 'ds', 'set': 0, 'bitsize': 32,
|
|
262 'encoding': eEncodingUint, 'format': eFormatHex},
|
|
263 {'name': 'es', 'set': 0, 'bitsize': 32,
|
|
264 'encoding': eEncodingUint, 'format': eFormatHex},
|
|
265 {'name': 'fs', 'set': 0, 'bitsize': 32,
|
|
266 'encoding': eEncodingUint, 'format': eFormatHex},
|
|
267 {'name': 'gs', 'set': 0, 'bitsize': 32,
|
|
268 'encoding': eEncodingUint, 'format': eFormatHex},
|
|
269 {'name': 'stmm0',
|
|
270 'set': 1,
|
|
271 'bitsize': 80,
|
|
272 'encoding': eEncodingVector,
|
|
273 'format': eFormatVectorOfUInt8},
|
|
274 {'name': 'stmm1',
|
|
275 'set': 1,
|
|
276 'bitsize': 80,
|
|
277 'encoding': eEncodingVector,
|
|
278 'format': eFormatVectorOfUInt8},
|
|
279 {'name': 'stmm2',
|
|
280 'set': 1,
|
|
281 'bitsize': 80,
|
|
282 'encoding': eEncodingVector,
|
|
283 'format': eFormatVectorOfUInt8},
|
|
284 {'name': 'stmm3',
|
|
285 'set': 1,
|
|
286 'bitsize': 80,
|
|
287 'encoding': eEncodingVector,
|
|
288 'format': eFormatVectorOfUInt8},
|
|
289 {'name': 'stmm4',
|
|
290 'set': 1,
|
|
291 'bitsize': 80,
|
|
292 'encoding': eEncodingVector,
|
|
293 'format': eFormatVectorOfUInt8},
|
|
294 {'name': 'stmm5',
|
|
295 'set': 1,
|
|
296 'bitsize': 80,
|
|
297 'encoding': eEncodingVector,
|
|
298 'format': eFormatVectorOfUInt8},
|
|
299 {'name': 'stmm6',
|
|
300 'set': 1,
|
|
301 'bitsize': 80,
|
|
302 'encoding': eEncodingVector,
|
|
303 'format': eFormatVectorOfUInt8},
|
|
304 {'name': 'stmm7',
|
|
305 'set': 1,
|
|
306 'bitsize': 80,
|
|
307 'encoding': eEncodingVector,
|
|
308 'format': eFormatVectorOfUInt8},
|
|
309 {'name': 'fctrl', 'set': 1, 'bitsize': 32,
|
|
310 'encoding': eEncodingUint, 'format': eFormatHex},
|
|
311 {'name': 'fstat', 'set': 1, 'bitsize': 32,
|
|
312 'encoding': eEncodingUint, 'format': eFormatHex},
|
|
313 {'name': 'ftag', 'set': 1, 'bitsize': 32,
|
|
314 'encoding': eEncodingUint, 'format': eFormatHex},
|
|
315 {'name': 'fiseg', 'set': 1, 'bitsize': 32,
|
|
316 'encoding': eEncodingUint, 'format': eFormatHex},
|
|
317 {'name': 'fioff', 'set': 1, 'bitsize': 32,
|
|
318 'encoding': eEncodingUint, 'format': eFormatHex},
|
|
319 {'name': 'foseg', 'set': 1, 'bitsize': 32,
|
|
320 'encoding': eEncodingUint, 'format': eFormatHex},
|
|
321 {'name': 'fooff', 'set': 1, 'bitsize': 32,
|
|
322 'encoding': eEncodingUint, 'format': eFormatHex},
|
|
323 {'name': 'fop', 'set': 1, 'bitsize': 32,
|
|
324 'encoding': eEncodingUint, 'format': eFormatHex},
|
|
325 {'name': 'xmm0',
|
|
326 'set': 1,
|
|
327 'bitsize': 128,
|
|
328 'encoding': eEncodingVector,
|
|
329 'format': eFormatVectorOfUInt8},
|
|
330 {'name': 'xmm1',
|
|
331 'set': 1,
|
|
332 'bitsize': 128,
|
|
333 'encoding': eEncodingVector,
|
|
334 'format': eFormatVectorOfUInt8},
|
|
335 {'name': 'xmm2',
|
|
336 'set': 1,
|
|
337 'bitsize': 128,
|
|
338 'encoding': eEncodingVector,
|
|
339 'format': eFormatVectorOfUInt8},
|
|
340 {'name': 'xmm3',
|
|
341 'set': 1,
|
|
342 'bitsize': 128,
|
|
343 'encoding': eEncodingVector,
|
|
344 'format': eFormatVectorOfUInt8},
|
|
345 {'name': 'xmm4',
|
|
346 'set': 1,
|
|
347 'bitsize': 128,
|
|
348 'encoding': eEncodingVector,
|
|
349 'format': eFormatVectorOfUInt8},
|
|
350 {'name': 'xmm5',
|
|
351 'set': 1,
|
|
352 'bitsize': 128,
|
|
353 'encoding': eEncodingVector,
|
|
354 'format': eFormatVectorOfUInt8},
|
|
355 {'name': 'xmm6',
|
|
356 'set': 1,
|
|
357 'bitsize': 128,
|
|
358 'encoding': eEncodingVector,
|
|
359 'format': eFormatVectorOfUInt8},
|
|
360 {'name': 'xmm7',
|
|
361 'set': 1,
|
|
362 'bitsize': 128,
|
|
363 'encoding': eEncodingVector,
|
|
364 'format': eFormatVectorOfUInt8},
|
|
365 {'name': 'xmm8',
|
|
366 'set': 1,
|
|
367 'bitsize': 128,
|
|
368 'encoding': eEncodingVector,
|
|
369 'format': eFormatVectorOfUInt8},
|
|
370 {'name': 'xmm9',
|
|
371 'set': 1,
|
|
372 'bitsize': 128,
|
|
373 'encoding': eEncodingVector,
|
|
374 'format': eFormatVectorOfUInt8},
|
|
375 {'name': 'xmm10',
|
|
376 'set': 1,
|
|
377 'bitsize': 128,
|
|
378 'encoding': eEncodingVector,
|
|
379 'format': eFormatVectorOfUInt8},
|
|
380 {'name': 'xmm11',
|
|
381 'set': 1,
|
|
382 'bitsize': 128,
|
|
383 'encoding': eEncodingVector,
|
|
384 'format': eFormatVectorOfUInt8},
|
|
385 {'name': 'xmm12',
|
|
386 'set': 1,
|
|
387 'bitsize': 128,
|
|
388 'encoding': eEncodingVector,
|
|
389 'format': eFormatVectorOfUInt8},
|
|
390 {'name': 'xmm13',
|
|
391 'set': 1,
|
|
392 'bitsize': 128,
|
|
393 'encoding': eEncodingVector,
|
|
394 'format': eFormatVectorOfUInt8},
|
|
395 {'name': 'xmm14',
|
|
396 'set': 1,
|
|
397 'bitsize': 128,
|
|
398 'encoding': eEncodingVector,
|
|
399 'format': eFormatVectorOfUInt8},
|
|
400 {'name': 'xmm15',
|
|
401 'set': 1,
|
|
402 'bitsize': 128,
|
|
403 'encoding': eEncodingVector,
|
|
404 'format': eFormatVectorOfUInt8},
|
|
405 {'name': 'mxcsr', 'set': 1, 'bitsize': 32,
|
|
406 'encoding': eEncodingUint, 'format': eFormatHex},
|
|
407 # Registers that are contained in or composed of one of more other
|
|
408 # registers
|
|
409 {'name': 'eax',
|
|
410 'set': 0,
|
|
411 'bitsize': 32,
|
|
412 'encoding': eEncodingUint,
|
|
413 'format': eFormatHex,
|
|
414 'slice': 'rax[31:0]'},
|
|
415 {'name': 'ebx',
|
|
416 'set': 0,
|
|
417 'bitsize': 32,
|
|
418 'encoding': eEncodingUint,
|
|
419 'format': eFormatHex,
|
|
420 'slice': 'rbx[31:0]'},
|
|
421 {'name': 'ecx',
|
|
422 'set': 0,
|
|
423 'bitsize': 32,
|
|
424 'encoding': eEncodingUint,
|
|
425 'format': eFormatHex,
|
|
426 'slice': 'rcx[31:0]'},
|
|
427 {'name': 'edx',
|
|
428 'set': 0,
|
|
429 'bitsize': 32,
|
|
430 'encoding': eEncodingUint,
|
|
431 'format': eFormatHex,
|
|
432 'slice': 'rdx[31:0]'},
|
|
433 {'name': 'edi',
|
|
434 'set': 0,
|
|
435 'bitsize': 32,
|
|
436 'encoding': eEncodingUint,
|
|
437 'format': eFormatHex,
|
|
438 'slice': 'rdi[31:0]'},
|
|
439 {'name': 'esi',
|
|
440 'set': 0,
|
|
441 'bitsize': 32,
|
|
442 'encoding': eEncodingUint,
|
|
443 'format': eFormatHex,
|
|
444 'slice': 'rsi[31:0]'},
|
|
445 {'name': 'ebp',
|
|
446 'set': 0,
|
|
447 'bitsize': 32,
|
|
448 'encoding': eEncodingUint,
|
|
449 'format': eFormatHex,
|
|
450 'slice': 'rbp[31:0]'},
|
|
451 {'name': 'esp',
|
|
452 'set': 0,
|
|
453 'bitsize': 32,
|
|
454 'encoding': eEncodingUint,
|
|
455 'format': eFormatHex,
|
|
456 'slice': 'rsp[31:0]'},
|
|
457 {'name': 'r8d',
|
|
458 'set': 0,
|
|
459 'bitsize': 32,
|
|
460 'encoding': eEncodingUint,
|
|
461 'format': eFormatHex,
|
|
462 'slice': 'r8[31:0]'},
|
|
463 {'name': 'r9d',
|
|
464 'set': 0,
|
|
465 'bitsize': 32,
|
|
466 'encoding': eEncodingUint,
|
|
467 'format': eFormatHex,
|
|
468 'slice': 'r9[31:0]'},
|
|
469 {'name': 'r10d',
|
|
470 'set': 0,
|
|
471 'bitsize': 32,
|
|
472 'encoding': eEncodingUint,
|
|
473 'format': eFormatHex,
|
|
474 'slice': 'r10[31:0]'},
|
|
475 {'name': 'r11d',
|
|
476 'set': 0,
|
|
477 'bitsize': 32,
|
|
478 'encoding': eEncodingUint,
|
|
479 'format': eFormatHex,
|
|
480 'slice': 'r11[31:0]'},
|
|
481 {'name': 'r12d',
|
|
482 'set': 0,
|
|
483 'bitsize': 32,
|
|
484 'encoding': eEncodingUint,
|
|
485 'format': eFormatHex,
|
|
486 'slice': 'r12[31:0]'},
|
|
487 {'name': 'r13d',
|
|
488 'set': 0,
|
|
489 'bitsize': 32,
|
|
490 'encoding': eEncodingUint,
|
|
491 'format': eFormatHex,
|
|
492 'slice': 'r13[31:0]'},
|
|
493 {'name': 'r14d',
|
|
494 'set': 0,
|
|
495 'bitsize': 32,
|
|
496 'encoding': eEncodingUint,
|
|
497 'format': eFormatHex,
|
|
498 'slice': 'r14[31:0]'},
|
|
499 {'name': 'r15d',
|
|
500 'set': 0,
|
|
501 'bitsize': 32,
|
|
502 'encoding': eEncodingUint,
|
|
503 'format': eFormatHex,
|
|
504 'slice': 'r15[31:0]'},
|
|
505
|
|
506 {'name': 'ax',
|
|
507 'set': 0,
|
|
508 'bitsize': 16,
|
|
509 'encoding': eEncodingUint,
|
|
510 'format': eFormatHex,
|
|
511 'slice': 'rax[15:0]'},
|
|
512 {'name': 'bx',
|
|
513 'set': 0,
|
|
514 'bitsize': 16,
|
|
515 'encoding': eEncodingUint,
|
|
516 'format': eFormatHex,
|
|
517 'slice': 'rbx[15:0]'},
|
|
518 {'name': 'cx',
|
|
519 'set': 0,
|
|
520 'bitsize': 16,
|
|
521 'encoding': eEncodingUint,
|
|
522 'format': eFormatHex,
|
|
523 'slice': 'rcx[15:0]'},
|
|
524 {'name': 'dx',
|
|
525 'set': 0,
|
|
526 'bitsize': 16,
|
|
527 'encoding': eEncodingUint,
|
|
528 'format': eFormatHex,
|
|
529 'slice': 'rdx[15:0]'},
|
|
530 {'name': 'di',
|
|
531 'set': 0,
|
|
532 'bitsize': 16,
|
|
533 'encoding': eEncodingUint,
|
|
534 'format': eFormatHex,
|
|
535 'slice': 'rdi[15:0]'},
|
|
536 {'name': 'si',
|
|
537 'set': 0,
|
|
538 'bitsize': 16,
|
|
539 'encoding': eEncodingUint,
|
|
540 'format': eFormatHex,
|
|
541 'slice': 'rsi[15:0]'},
|
|
542 {'name': 'bp',
|
|
543 'set': 0,
|
|
544 'bitsize': 16,
|
|
545 'encoding': eEncodingUint,
|
|
546 'format': eFormatHex,
|
|
547 'slice': 'rbp[15:0]'},
|
|
548 {'name': 'sp',
|
|
549 'set': 0,
|
|
550 'bitsize': 16,
|
|
551 'encoding': eEncodingUint,
|
|
552 'format': eFormatHex,
|
|
553 'slice': 'rsp[15:0]'},
|
|
554 {'name': 'r8w',
|
|
555 'set': 0,
|
|
556 'bitsize': 16,
|
|
557 'encoding': eEncodingUint,
|
|
558 'format': eFormatHex,
|
|
559 'slice': 'r8[15:0]'},
|
|
560 {'name': 'r9w',
|
|
561 'set': 0,
|
|
562 'bitsize': 16,
|
|
563 'encoding': eEncodingUint,
|
|
564 'format': eFormatHex,
|
|
565 'slice': 'r9[15:0]'},
|
|
566 {'name': 'r10w',
|
|
567 'set': 0,
|
|
568 'bitsize': 16,
|
|
569 'encoding': eEncodingUint,
|
|
570 'format': eFormatHex,
|
|
571 'slice': 'r10[15:0]'},
|
|
572 {'name': 'r11w',
|
|
573 'set': 0,
|
|
574 'bitsize': 16,
|
|
575 'encoding': eEncodingUint,
|
|
576 'format': eFormatHex,
|
|
577 'slice': 'r11[15:0]'},
|
|
578 {'name': 'r12w',
|
|
579 'set': 0,
|
|
580 'bitsize': 16,
|
|
581 'encoding': eEncodingUint,
|
|
582 'format': eFormatHex,
|
|
583 'slice': 'r12[15:0]'},
|
|
584 {'name': 'r13w',
|
|
585 'set': 0,
|
|
586 'bitsize': 16,
|
|
587 'encoding': eEncodingUint,
|
|
588 'format': eFormatHex,
|
|
589 'slice': 'r13[15:0]'},
|
|
590 {'name': 'r14w',
|
|
591 'set': 0,
|
|
592 'bitsize': 16,
|
|
593 'encoding': eEncodingUint,
|
|
594 'format': eFormatHex,
|
|
595 'slice': 'r14[15:0]'},
|
|
596 {'name': 'r15w',
|
|
597 'set': 0,
|
|
598 'bitsize': 16,
|
|
599 'encoding': eEncodingUint,
|
|
600 'format': eFormatHex,
|
|
601 'slice': 'r15[15:0]'},
|
|
602
|
|
603 {'name': 'ah',
|
|
604 'set': 0,
|
|
605 'bitsize': 8,
|
|
606 'encoding': eEncodingUint,
|
|
607 'format': eFormatHex,
|
|
608 'slice': 'rax[15:8]'},
|
|
609 {'name': 'bh',
|
|
610 'set': 0,
|
|
611 'bitsize': 8,
|
|
612 'encoding': eEncodingUint,
|
|
613 'format': eFormatHex,
|
|
614 'slice': 'rbx[15:8]'},
|
|
615 {'name': 'ch',
|
|
616 'set': 0,
|
|
617 'bitsize': 8,
|
|
618 'encoding': eEncodingUint,
|
|
619 'format': eFormatHex,
|
|
620 'slice': 'rcx[15:8]'},
|
|
621 {'name': 'dh',
|
|
622 'set': 0,
|
|
623 'bitsize': 8,
|
|
624 'encoding': eEncodingUint,
|
|
625 'format': eFormatHex,
|
|
626 'slice': 'rdx[15:8]'},
|
|
627
|
|
628 {'name': 'al',
|
|
629 'set': 0,
|
|
630 'bitsize': 8,
|
|
631 'encoding': eEncodingUint,
|
|
632 'format': eFormatHex,
|
|
633 'slice': 'rax[7:0]'},
|
|
634 {'name': 'bl',
|
|
635 'set': 0,
|
|
636 'bitsize': 8,
|
|
637 'encoding': eEncodingUint,
|
|
638 'format': eFormatHex,
|
|
639 'slice': 'rbx[7:0]'},
|
|
640 {'name': 'cl',
|
|
641 'set': 0,
|
|
642 'bitsize': 8,
|
|
643 'encoding': eEncodingUint,
|
|
644 'format': eFormatHex,
|
|
645 'slice': 'rcx[7:0]'},
|
|
646 {'name': 'dl',
|
|
647 'set': 0,
|
|
648 'bitsize': 8,
|
|
649 'encoding': eEncodingUint,
|
|
650 'format': eFormatHex,
|
|
651 'slice': 'rdx[7:0]'},
|
|
652 {'name': 'dil',
|
|
653 'set': 0,
|
|
654 'bitsize': 8,
|
|
655 'encoding': eEncodingUint,
|
|
656 'format': eFormatHex,
|
|
657 'slice': 'rdi[7:0]'},
|
|
658 {'name': 'sil',
|
|
659 'set': 0,
|
|
660 'bitsize': 8,
|
|
661 'encoding': eEncodingUint,
|
|
662 'format': eFormatHex,
|
|
663 'slice': 'rsi[7:0]'},
|
|
664 {'name': 'bpl',
|
|
665 'set': 0,
|
|
666 'bitsize': 8,
|
|
667 'encoding': eEncodingUint,
|
|
668 'format': eFormatHex,
|
|
669 'slice': 'rbp[7:0]'},
|
|
670 {'name': 'spl',
|
|
671 'set': 0,
|
|
672 'bitsize': 8,
|
|
673 'encoding': eEncodingUint,
|
|
674 'format': eFormatHex,
|
|
675 'slice': 'rsp[7:0]'},
|
|
676 {'name': 'r8l',
|
|
677 'set': 0,
|
|
678 'bitsize': 8,
|
|
679 'encoding': eEncodingUint,
|
|
680 'format': eFormatHex,
|
|
681 'slice': 'r8[7:0]'},
|
|
682 {'name': 'r9l',
|
|
683 'set': 0,
|
|
684 'bitsize': 8,
|
|
685 'encoding': eEncodingUint,
|
|
686 'format': eFormatHex,
|
|
687 'slice': 'r9[7:0]'},
|
|
688 {'name': 'r10l',
|
|
689 'set': 0,
|
|
690 'bitsize': 8,
|
|
691 'encoding': eEncodingUint,
|
|
692 'format': eFormatHex,
|
|
693 'slice': 'r10[7:0]'},
|
|
694 {'name': 'r11l',
|
|
695 'set': 0,
|
|
696 'bitsize': 8,
|
|
697 'encoding': eEncodingUint,
|
|
698 'format': eFormatHex,
|
|
699 'slice': 'r11[7:0]'},
|
|
700 {'name': 'r12l',
|
|
701 'set': 0,
|
|
702 'bitsize': 8,
|
|
703 'encoding': eEncodingUint,
|
|
704 'format': eFormatHex,
|
|
705 'slice': 'r12[7:0]'},
|
|
706 {'name': 'r13l',
|
|
707 'set': 0,
|
|
708 'bitsize': 8,
|
|
709 'encoding': eEncodingUint,
|
|
710 'format': eFormatHex,
|
|
711 'slice': 'r13[7:0]'},
|
|
712 {'name': 'r14l',
|
|
713 'set': 0,
|
|
714 'bitsize': 8,
|
|
715 'encoding': eEncodingUint,
|
|
716 'format': eFormatHex,
|
|
717 'slice': 'r14[7:0]'},
|
|
718 {'name': 'r15l',
|
|
719 'set': 0,
|
|
720 'bitsize': 8,
|
|
721 'encoding': eEncodingUint,
|
|
722 'format': eFormatHex,
|
|
723 'slice': 'r15[7:0]'},
|
|
724 ]
|
|
725
|
|
726 g_target_definition = None
|
|
727
|
|
728
|
|
729 def get_target_definition():
|
|
730 global g_target_definition
|
|
731 if g_target_definition is None:
|
|
732 g_target_definition = {}
|
|
733 offset = 0
|
|
734 for reg_info in x86_64_register_infos:
|
|
735 reg_name = reg_info['name']
|
|
736
|
|
737 # Only fill in the offset if there is no 'slice' in the register
|
|
738 # info
|
|
739 if 'slice' not in reg_info and 'composite' not in reg_info:
|
|
740 reg_info['offset'] = offset
|
|
741 offset += reg_info['bitsize'] // 8
|
|
742
|
|
743 # Set the GCC/DWARF register number for this register if it has one
|
|
744 reg_num = get_reg_num(name_to_gcc_dwarf_regnum, reg_name)
|
|
745 if reg_num != LLDB_INVALID_REGNUM:
|
|
746 reg_info['gcc'] = reg_num
|
|
747 reg_info['dwarf'] = reg_num
|
|
748
|
|
749 # Set the generic register number for this register if it has one
|
|
750 reg_num = get_reg_num(name_to_generic_regnum, reg_name)
|
|
751 if reg_num != LLDB_INVALID_REGNUM:
|
|
752 reg_info['generic'] = reg_num
|
|
753
|
|
754 # Set the GDB register number for this register if it has one
|
|
755 reg_num = get_reg_num(name_to_gdb_regnum, reg_name)
|
|
756 if reg_num != LLDB_INVALID_REGNUM:
|
|
757 reg_info['gdb'] = reg_num
|
|
758
|
|
759 g_target_definition['sets'] = [
|
|
760 'General Purpose Registers',
|
|
761 'Floating Point Registers']
|
|
762 g_target_definition['registers'] = x86_64_register_infos
|
|
763 g_target_definition[
|
|
764 'host-info'] = {'triple': 'x86_64-*-linux', 'endian': eByteOrderLittle}
|
|
765 g_target_definition['g-packet-size'] = offset
|
|
766 g_target_definition['breakpoint-pc-offset'] = -1
|
|
767 return g_target_definition
|
|
768
|
|
769
|
|
770 def get_dynamic_setting(target, setting_name):
|
|
771 if setting_name == 'gdb-server-target-definition':
|
|
772 return get_target_definition()
|