Revert "[clang-repl] Implement partial translation units and error recovery."
[llvm-project.git] / lldb / examples / python / x86_64_target_definition.py
blob533cafca4007faf6435a91c121cc1f1f239cf3ac
1 #!/usr/bin/env python
2 #===-- x86_64_target_definition.py -----------------------------*- C++ -*-===//
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
8 #===----------------------------------------------------------------------===//
10 #----------------------------------------------------------------------
11 # DESCRIPTION
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.
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 GDB server
24 # to change and add new registers without requiring a new LLDB build
25 # just so we can see new registers.
27 # This file implements the x86_64 registers for the darwin version of
28 # GDB and allows you to connect to servers that use this register set.
30 # USAGE
32 # (lldb) settings set plugin.process.gdb-remote.target-definition-file /path/to/x86_64_target_definition.py
33 # (lldb) gdb-remote other.baz.com:1234
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 server.
38 #----------------------------------------------------------------------
39 from lldb import *
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
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
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
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
197 def get_reg_num(reg_num_dict, reg_name):
198 if reg_name in reg_num_dict:
199 return reg_num_dict[reg_name]
200 return LLDB_INVALID_REGNUM
202 x86_64_register_infos = [
203 {'name': 'rax',
204 'set': 0,
205 'bitsize': 64,
206 'encoding': eEncodingUint,
207 'format': eFormatAddressInfo},
208 {'name': 'rbx',
209 'set': 0,
210 'bitsize': 64,
211 'encoding': eEncodingUint,
212 'format': eFormatAddressInfo},
213 {'name': 'rcx', 'set': 0, 'bitsize': 64, 'encoding': eEncodingUint,
214 'format': eFormatAddressInfo, 'alt-name': 'arg4'},
215 {'name': 'rdx', 'set': 0, 'bitsize': 64, 'encoding': eEncodingUint,
216 'format': eFormatAddressInfo, 'alt-name': 'arg3'},
217 {'name': 'rsi', 'set': 0, 'bitsize': 64, 'encoding': eEncodingUint,
218 'format': eFormatAddressInfo, 'alt-name': 'arg2'},
219 {'name': 'rdi', 'set': 0, 'bitsize': 64, 'encoding': eEncodingUint,
220 'format': eFormatAddressInfo, 'alt-name': 'arg1'},
221 {'name': 'rbp', 'set': 0, 'bitsize': 64, 'encoding': eEncodingUint,
222 'format': eFormatAddressInfo, 'alt-name': 'fp'},
223 {'name': 'rsp', 'set': 0, 'bitsize': 64, 'encoding': eEncodingUint,
224 'format': eFormatAddressInfo, 'alt-name': 'sp'},
225 {'name': 'r8', 'set': 0, 'bitsize': 64, 'encoding': eEncodingUint,
226 'format': eFormatAddressInfo, 'alt-name': 'arg5'},
227 {'name': 'r9', 'set': 0, 'bitsize': 64, 'encoding': eEncodingUint,
228 'format': eFormatAddressInfo, 'alt-name': 'arg6'},
229 {'name': 'r10',
230 'set': 0,
231 'bitsize': 64,
232 'encoding': eEncodingUint,
233 'format': eFormatAddressInfo},
234 {'name': 'r11',
235 'set': 0,
236 'bitsize': 64,
237 'encoding': eEncodingUint,
238 'format': eFormatAddressInfo},
239 {'name': 'r12',
240 'set': 0,
241 'bitsize': 64,
242 'encoding': eEncodingUint,
243 'format': eFormatAddressInfo},
244 {'name': 'r13',
245 'set': 0,
246 'bitsize': 64,
247 'encoding': eEncodingUint,
248 'format': eFormatAddressInfo},
249 {'name': 'r14',
250 'set': 0,
251 'bitsize': 64,
252 'encoding': eEncodingUint,
253 'format': eFormatAddressInfo},
254 {'name': 'r15',
255 'set': 0,
256 'bitsize': 64,
257 'encoding': eEncodingUint,
258 'format': eFormatAddressInfo},
259 {'name': 'rip', 'set': 0, 'bitsize': 64, 'encoding': eEncodingUint,
260 'format': eFormatAddressInfo, 'alt-name': 'pc'},
261 {'name': 'rflags', 'set': 0, 'bitsize': 32,
262 'encoding': eEncodingUint, 'format': eFormatHex},
263 {'name': 'cs', 'set': 0, 'bitsize': 32,
264 'encoding': eEncodingUint, 'format': eFormatHex},
265 {'name': 'ss', 'set': 0, 'bitsize': 32,
266 'encoding': eEncodingUint, 'format': eFormatHex},
267 {'name': 'ds', 'set': 0, 'bitsize': 32,
268 'encoding': eEncodingUint, 'format': eFormatHex},
269 {'name': 'es', 'set': 0, 'bitsize': 32,
270 'encoding': eEncodingUint, 'format': eFormatHex},
271 {'name': 'fs', 'set': 0, 'bitsize': 32,
272 'encoding': eEncodingUint, 'format': eFormatHex},
273 {'name': 'gs', 'set': 0, 'bitsize': 32,
274 'encoding': eEncodingUint, 'format': eFormatHex},
275 {'name': 'stmm0',
276 'set': 1,
277 'bitsize': 80,
278 'encoding': eEncodingVector,
279 'format': eFormatVectorOfUInt8},
280 {'name': 'stmm1',
281 'set': 1,
282 'bitsize': 80,
283 'encoding': eEncodingVector,
284 'format': eFormatVectorOfUInt8},
285 {'name': 'stmm2',
286 'set': 1,
287 'bitsize': 80,
288 'encoding': eEncodingVector,
289 'format': eFormatVectorOfUInt8},
290 {'name': 'stmm3',
291 'set': 1,
292 'bitsize': 80,
293 'encoding': eEncodingVector,
294 'format': eFormatVectorOfUInt8},
295 {'name': 'stmm4',
296 'set': 1,
297 'bitsize': 80,
298 'encoding': eEncodingVector,
299 'format': eFormatVectorOfUInt8},
300 {'name': 'stmm5',
301 'set': 1,
302 'bitsize': 80,
303 'encoding': eEncodingVector,
304 'format': eFormatVectorOfUInt8},
305 {'name': 'stmm6',
306 'set': 1,
307 'bitsize': 80,
308 'encoding': eEncodingVector,
309 'format': eFormatVectorOfUInt8},
310 {'name': 'stmm7',
311 'set': 1,
312 'bitsize': 80,
313 'encoding': eEncodingVector,
314 'format': eFormatVectorOfUInt8},
315 {'name': 'fctrl', 'set': 1, 'bitsize': 32,
316 'encoding': eEncodingUint, 'format': eFormatHex},
317 {'name': 'fstat', 'set': 1, 'bitsize': 32,
318 'encoding': eEncodingUint, 'format': eFormatHex},
319 {'name': 'ftag', 'set': 1, 'bitsize': 32,
320 'encoding': eEncodingUint, 'format': eFormatHex},
321 {'name': 'fiseg', 'set': 1, 'bitsize': 32,
322 'encoding': eEncodingUint, 'format': eFormatHex},
323 {'name': 'fioff', 'set': 1, 'bitsize': 32,
324 'encoding': eEncodingUint, 'format': eFormatHex},
325 {'name': 'foseg', 'set': 1, 'bitsize': 32,
326 'encoding': eEncodingUint, 'format': eFormatHex},
327 {'name': 'fooff', 'set': 1, 'bitsize': 32,
328 'encoding': eEncodingUint, 'format': eFormatHex},
329 {'name': 'fop', 'set': 1, 'bitsize': 32,
330 'encoding': eEncodingUint, 'format': eFormatHex},
331 {'name': 'xmm0',
332 'set': 1,
333 'bitsize': 128,
334 'encoding': eEncodingVector,
335 'format': eFormatVectorOfUInt8},
336 {'name': 'xmm1',
337 'set': 1,
338 'bitsize': 128,
339 'encoding': eEncodingVector,
340 'format': eFormatVectorOfUInt8},
341 {'name': 'xmm2',
342 'set': 1,
343 'bitsize': 128,
344 'encoding': eEncodingVector,
345 'format': eFormatVectorOfUInt8},
346 {'name': 'xmm3',
347 'set': 1,
348 'bitsize': 128,
349 'encoding': eEncodingVector,
350 'format': eFormatVectorOfUInt8},
351 {'name': 'xmm4',
352 'set': 1,
353 'bitsize': 128,
354 'encoding': eEncodingVector,
355 'format': eFormatVectorOfUInt8},
356 {'name': 'xmm5',
357 'set': 1,
358 'bitsize': 128,
359 'encoding': eEncodingVector,
360 'format': eFormatVectorOfUInt8},
361 {'name': 'xmm6',
362 'set': 1,
363 'bitsize': 128,
364 'encoding': eEncodingVector,
365 'format': eFormatVectorOfUInt8},
366 {'name': 'xmm7',
367 'set': 1,
368 'bitsize': 128,
369 'encoding': eEncodingVector,
370 'format': eFormatVectorOfUInt8},
371 {'name': 'xmm8',
372 'set': 1,
373 'bitsize': 128,
374 'encoding': eEncodingVector,
375 'format': eFormatVectorOfUInt8},
376 {'name': 'xmm9',
377 'set': 1,
378 'bitsize': 128,
379 'encoding': eEncodingVector,
380 'format': eFormatVectorOfUInt8},
381 {'name': 'xmm10',
382 'set': 1,
383 'bitsize': 128,
384 'encoding': eEncodingVector,
385 'format': eFormatVectorOfUInt8},
386 {'name': 'xmm11',
387 'set': 1,
388 'bitsize': 128,
389 'encoding': eEncodingVector,
390 'format': eFormatVectorOfUInt8},
391 {'name': 'xmm12',
392 'set': 1,
393 'bitsize': 128,
394 'encoding': eEncodingVector,
395 'format': eFormatVectorOfUInt8},
396 {'name': 'xmm13',
397 'set': 1,
398 'bitsize': 128,
399 'encoding': eEncodingVector,
400 'format': eFormatVectorOfUInt8},
401 {'name': 'xmm14',
402 'set': 1,
403 'bitsize': 128,
404 'encoding': eEncodingVector,
405 'format': eFormatVectorOfUInt8},
406 {'name': 'xmm15',
407 'set': 1,
408 'bitsize': 128,
409 'encoding': eEncodingVector,
410 'format': eFormatVectorOfUInt8},
411 {'name': 'mxcsr', 'set': 1, 'bitsize': 32,
412 'encoding': eEncodingUint, 'format': eFormatHex},
413 # Registers that are contained in or composed of one of more other
414 # registers
415 {'name': 'eax',
416 'set': 0,
417 'bitsize': 32,
418 'encoding': eEncodingUint,
419 'format': eFormatHex,
420 'slice': 'rax[31:0]'},
421 {'name': 'ebx',
422 'set': 0,
423 'bitsize': 32,
424 'encoding': eEncodingUint,
425 'format': eFormatHex,
426 'slice': 'rbx[31:0]'},
427 {'name': 'ecx',
428 'set': 0,
429 'bitsize': 32,
430 'encoding': eEncodingUint,
431 'format': eFormatHex,
432 'slice': 'rcx[31:0]'},
433 {'name': 'edx',
434 'set': 0,
435 'bitsize': 32,
436 'encoding': eEncodingUint,
437 'format': eFormatHex,
438 'slice': 'rdx[31:0]'},
439 {'name': 'edi',
440 'set': 0,
441 'bitsize': 32,
442 'encoding': eEncodingUint,
443 'format': eFormatHex,
444 'slice': 'rdi[31:0]'},
445 {'name': 'esi',
446 'set': 0,
447 'bitsize': 32,
448 'encoding': eEncodingUint,
449 'format': eFormatHex,
450 'slice': 'rsi[31:0]'},
451 {'name': 'ebp',
452 'set': 0,
453 'bitsize': 32,
454 'encoding': eEncodingUint,
455 'format': eFormatHex,
456 'slice': 'rbp[31:0]'},
457 {'name': 'esp',
458 'set': 0,
459 'bitsize': 32,
460 'encoding': eEncodingUint,
461 'format': eFormatHex,
462 'slice': 'rsp[31:0]'},
463 {'name': 'r8d',
464 'set': 0,
465 'bitsize': 32,
466 'encoding': eEncodingUint,
467 'format': eFormatHex,
468 'slice': 'r8[31:0]'},
469 {'name': 'r9d',
470 'set': 0,
471 'bitsize': 32,
472 'encoding': eEncodingUint,
473 'format': eFormatHex,
474 'slice': 'r9[31:0]'},
475 {'name': 'r10d',
476 'set': 0,
477 'bitsize': 32,
478 'encoding': eEncodingUint,
479 'format': eFormatHex,
480 'slice': 'r10[31:0]'},
481 {'name': 'r11d',
482 'set': 0,
483 'bitsize': 32,
484 'encoding': eEncodingUint,
485 'format': eFormatHex,
486 'slice': 'r11[31:0]'},
487 {'name': 'r12d',
488 'set': 0,
489 'bitsize': 32,
490 'encoding': eEncodingUint,
491 'format': eFormatHex,
492 'slice': 'r12[31:0]'},
493 {'name': 'r13d',
494 'set': 0,
495 'bitsize': 32,
496 'encoding': eEncodingUint,
497 'format': eFormatHex,
498 'slice': 'r13[31:0]'},
499 {'name': 'r14d',
500 'set': 0,
501 'bitsize': 32,
502 'encoding': eEncodingUint,
503 'format': eFormatHex,
504 'slice': 'r14[31:0]'},
505 {'name': 'r15d',
506 'set': 0,
507 'bitsize': 32,
508 'encoding': eEncodingUint,
509 'format': eFormatHex,
510 'slice': 'r15[31:0]'},
512 {'name': 'ax',
513 'set': 0,
514 'bitsize': 16,
515 'encoding': eEncodingUint,
516 'format': eFormatHex,
517 'slice': 'rax[15:0]'},
518 {'name': 'bx',
519 'set': 0,
520 'bitsize': 16,
521 'encoding': eEncodingUint,
522 'format': eFormatHex,
523 'slice': 'rbx[15:0]'},
524 {'name': 'cx',
525 'set': 0,
526 'bitsize': 16,
527 'encoding': eEncodingUint,
528 'format': eFormatHex,
529 'slice': 'rcx[15:0]'},
530 {'name': 'dx',
531 'set': 0,
532 'bitsize': 16,
533 'encoding': eEncodingUint,
534 'format': eFormatHex,
535 'slice': 'rdx[15:0]'},
536 {'name': 'di',
537 'set': 0,
538 'bitsize': 16,
539 'encoding': eEncodingUint,
540 'format': eFormatHex,
541 'slice': 'rdi[15:0]'},
542 {'name': 'si',
543 'set': 0,
544 'bitsize': 16,
545 'encoding': eEncodingUint,
546 'format': eFormatHex,
547 'slice': 'rsi[15:0]'},
548 {'name': 'bp',
549 'set': 0,
550 'bitsize': 16,
551 'encoding': eEncodingUint,
552 'format': eFormatHex,
553 'slice': 'rbp[15:0]'},
554 {'name': 'sp',
555 'set': 0,
556 'bitsize': 16,
557 'encoding': eEncodingUint,
558 'format': eFormatHex,
559 'slice': 'rsp[15:0]'},
560 {'name': 'r8w',
561 'set': 0,
562 'bitsize': 16,
563 'encoding': eEncodingUint,
564 'format': eFormatHex,
565 'slice': 'r8[15:0]'},
566 {'name': 'r9w',
567 'set': 0,
568 'bitsize': 16,
569 'encoding': eEncodingUint,
570 'format': eFormatHex,
571 'slice': 'r9[15:0]'},
572 {'name': 'r10w',
573 'set': 0,
574 'bitsize': 16,
575 'encoding': eEncodingUint,
576 'format': eFormatHex,
577 'slice': 'r10[15:0]'},
578 {'name': 'r11w',
579 'set': 0,
580 'bitsize': 16,
581 'encoding': eEncodingUint,
582 'format': eFormatHex,
583 'slice': 'r11[15:0]'},
584 {'name': 'r12w',
585 'set': 0,
586 'bitsize': 16,
587 'encoding': eEncodingUint,
588 'format': eFormatHex,
589 'slice': 'r12[15:0]'},
590 {'name': 'r13w',
591 'set': 0,
592 'bitsize': 16,
593 'encoding': eEncodingUint,
594 'format': eFormatHex,
595 'slice': 'r13[15:0]'},
596 {'name': 'r14w',
597 'set': 0,
598 'bitsize': 16,
599 'encoding': eEncodingUint,
600 'format': eFormatHex,
601 'slice': 'r14[15:0]'},
602 {'name': 'r15w',
603 'set': 0,
604 'bitsize': 16,
605 'encoding': eEncodingUint,
606 'format': eFormatHex,
607 'slice': 'r15[15:0]'},
609 {'name': 'ah',
610 'set': 0,
611 'bitsize': 8,
612 'encoding': eEncodingUint,
613 'format': eFormatHex,
614 'slice': 'rax[15:8]'},
615 {'name': 'bh',
616 'set': 0,
617 'bitsize': 8,
618 'encoding': eEncodingUint,
619 'format': eFormatHex,
620 'slice': 'rbx[15:8]'},
621 {'name': 'ch',
622 'set': 0,
623 'bitsize': 8,
624 'encoding': eEncodingUint,
625 'format': eFormatHex,
626 'slice': 'rcx[15:8]'},
627 {'name': 'dh',
628 'set': 0,
629 'bitsize': 8,
630 'encoding': eEncodingUint,
631 'format': eFormatHex,
632 'slice': 'rdx[15:8]'},
634 {'name': 'al',
635 'set': 0,
636 'bitsize': 8,
637 'encoding': eEncodingUint,
638 'format': eFormatHex,
639 'slice': 'rax[7:0]'},
640 {'name': 'bl',
641 'set': 0,
642 'bitsize': 8,
643 'encoding': eEncodingUint,
644 'format': eFormatHex,
645 'slice': 'rbx[7:0]'},
646 {'name': 'cl',
647 'set': 0,
648 'bitsize': 8,
649 'encoding': eEncodingUint,
650 'format': eFormatHex,
651 'slice': 'rcx[7:0]'},
652 {'name': 'dl',
653 'set': 0,
654 'bitsize': 8,
655 'encoding': eEncodingUint,
656 'format': eFormatHex,
657 'slice': 'rdx[7:0]'},
658 {'name': 'dil',
659 'set': 0,
660 'bitsize': 8,
661 'encoding': eEncodingUint,
662 'format': eFormatHex,
663 'slice': 'rdi[7:0]'},
664 {'name': 'sil',
665 'set': 0,
666 'bitsize': 8,
667 'encoding': eEncodingUint,
668 'format': eFormatHex,
669 'slice': 'rsi[7:0]'},
670 {'name': 'bpl',
671 'set': 0,
672 'bitsize': 8,
673 'encoding': eEncodingUint,
674 'format': eFormatHex,
675 'slice': 'rbp[7:0]'},
676 {'name': 'spl',
677 'set': 0,
678 'bitsize': 8,
679 'encoding': eEncodingUint,
680 'format': eFormatHex,
681 'slice': 'rsp[7:0]'},
682 {'name': 'r8l',
683 'set': 0,
684 'bitsize': 8,
685 'encoding': eEncodingUint,
686 'format': eFormatHex,
687 'slice': 'r8[7:0]'},
688 {'name': 'r9l',
689 'set': 0,
690 'bitsize': 8,
691 'encoding': eEncodingUint,
692 'format': eFormatHex,
693 'slice': 'r9[7:0]'},
694 {'name': 'r10l',
695 'set': 0,
696 'bitsize': 8,
697 'encoding': eEncodingUint,
698 'format': eFormatHex,
699 'slice': 'r10[7:0]'},
700 {'name': 'r11l',
701 'set': 0,
702 'bitsize': 8,
703 'encoding': eEncodingUint,
704 'format': eFormatHex,
705 'slice': 'r11[7:0]'},
706 {'name': 'r12l',
707 'set': 0,
708 'bitsize': 8,
709 'encoding': eEncodingUint,
710 'format': eFormatHex,
711 'slice': 'r12[7:0]'},
712 {'name': 'r13l',
713 'set': 0,
714 'bitsize': 8,
715 'encoding': eEncodingUint,
716 'format': eFormatHex,
717 'slice': 'r13[7:0]'},
718 {'name': 'r14l',
719 'set': 0,
720 'bitsize': 8,
721 'encoding': eEncodingUint,
722 'format': eFormatHex,
723 'slice': 'r14[7:0]'},
724 {'name': 'r15l',
725 'set': 0,
726 'bitsize': 8,
727 'encoding': eEncodingUint,
728 'format': eFormatHex,
729 'slice': 'r15[7:0]'},
732 g_target_definition = None
735 def get_target_definition():
736 global g_target_definition
737 if g_target_definition is None:
738 g_target_definition = {}
739 offset = 0
740 for reg_info in x86_64_register_infos:
741 reg_name = reg_info['name']
743 # Only fill in the offset if there is no 'slice' in the register
744 # info
745 if 'slice' not in reg_info and 'composite' not in reg_info:
746 reg_info['offset'] = offset
747 offset += reg_info['bitsize'] // 8
749 # Set the GCC/DWARF register number for this register if it has one
750 reg_num = get_reg_num(name_to_gcc_dwarf_regnum, reg_name)
751 if reg_num != LLDB_INVALID_REGNUM:
752 reg_info['gcc'] = reg_num
753 reg_info['dwarf'] = reg_num
755 # Set the generic register number for this register if it has one
756 reg_num = get_reg_num(name_to_generic_regnum, reg_name)
757 if reg_num != LLDB_INVALID_REGNUM:
758 reg_info['generic'] = reg_num
760 # Set the GDB register number for this register if it has one
761 reg_num = get_reg_num(name_to_gdb_regnum, reg_name)
762 if reg_num != LLDB_INVALID_REGNUM:
763 reg_info['gdb'] = reg_num
765 g_target_definition['sets'] = [
766 'General Purpose Registers',
767 'Floating Point Registers']
768 g_target_definition['registers'] = x86_64_register_infos
769 g_target_definition[
770 'host-info'] = {'triple': 'x86_64-apple-macosx', 'endian': eByteOrderLittle}
771 g_target_definition['g-packet-size'] = offset
772 return g_target_definition
775 def get_dynamic_setting(target, setting_name):
776 if setting_name == 'gdb-server-target-definition':
777 return get_target_definition()