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