]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - examples/python/x86_64_target_definition.py
Vendor import of lldb trunk r256945:
[FreeBSD/FreeBSD.git] / examples / python / x86_64_target_definition.py
1 #!/usr/bin/python
2 #===-- x86_64_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 GDB server
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 darwin version of
29 # GDB and allows you to connect to servers that use this register set. 
30
31 # USAGE
32 #
33 # (lldb) settings set plugin.process.gdb-remote.target-definition-file /path/to/x86_64_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 server.
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 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
201     
202 x86_64_register_infos = [
203 { 'name':'rax'   , 'set':0, 'bitsize':64 , 'encoding':eEncodingUint  , 'format':eFormatAddressInfo   },
204 { 'name':'rbx'   , 'set':0, 'bitsize':64 , 'encoding':eEncodingUint  , 'format':eFormatAddressInfo   },
205 { 'name':'rcx'   , 'set':0, 'bitsize':64 , 'encoding':eEncodingUint  , 'format':eFormatAddressInfo, 'alt-name':'arg4' },
206 { 'name':'rdx'   , 'set':0, 'bitsize':64 , 'encoding':eEncodingUint  , 'format':eFormatAddressInfo, 'alt-name':'arg3' },
207 { 'name':'rsi'   , 'set':0, 'bitsize':64 , 'encoding':eEncodingUint  , 'format':eFormatAddressInfo, 'alt-name':'arg2' },
208 { 'name':'rdi'   , 'set':0, 'bitsize':64 , 'encoding':eEncodingUint  , 'format':eFormatAddressInfo, 'alt-name':'arg1' },
209 { 'name':'rbp'   , 'set':0, 'bitsize':64 , 'encoding':eEncodingUint  , 'format':eFormatAddressInfo, 'alt-name':'fp' },
210 { 'name':'rsp'   , 'set':0, 'bitsize':64 , 'encoding':eEncodingUint  , 'format':eFormatAddressInfo, 'alt-name':'sp' },
211 { 'name':'r8'    , 'set':0, 'bitsize':64 , 'encoding':eEncodingUint  , 'format':eFormatAddressInfo, 'alt-name':'arg5' },
212 { 'name':'r9'    , 'set':0, 'bitsize':64 , 'encoding':eEncodingUint  , 'format':eFormatAddressInfo, 'alt-name':'arg6' },
213 { 'name':'r10'   , 'set':0, 'bitsize':64 , 'encoding':eEncodingUint  , 'format':eFormatAddressInfo   },
214 { 'name':'r11'   , 'set':0, 'bitsize':64 , 'encoding':eEncodingUint  , 'format':eFormatAddressInfo   },
215 { 'name':'r12'   , 'set':0, 'bitsize':64 , 'encoding':eEncodingUint  , 'format':eFormatAddressInfo   },
216 { 'name':'r13'   , 'set':0, 'bitsize':64 , 'encoding':eEncodingUint  , 'format':eFormatAddressInfo   },
217 { 'name':'r14'   , 'set':0, 'bitsize':64 , 'encoding':eEncodingUint  , 'format':eFormatAddressInfo   },
218 { 'name':'r15'   , 'set':0, 'bitsize':64 , 'encoding':eEncodingUint  , 'format':eFormatAddressInfo   },
219 { 'name':'rip'   , 'set':0, 'bitsize':64 , 'encoding':eEncodingUint  , 'format':eFormatAddressInfo, 'alt-name':'pc' },
220 { 'name':'rflags', 'set':0, 'bitsize':32 , 'encoding':eEncodingUint  , 'format':eFormatHex           },
221 { 'name':'cs'    , 'set':0, 'bitsize':32 , 'encoding':eEncodingUint  , 'format':eFormatHex           },
222 { 'name':'ss'    , 'set':0, 'bitsize':32 , 'encoding':eEncodingUint  , 'format':eFormatHex           },
223 { 'name':'ds'    , 'set':0, 'bitsize':32 , 'encoding':eEncodingUint  , 'format':eFormatHex           },
224 { 'name':'es'    , 'set':0, 'bitsize':32 , 'encoding':eEncodingUint  , 'format':eFormatHex           },
225 { 'name':'fs'    , 'set':0, 'bitsize':32 , 'encoding':eEncodingUint  , 'format':eFormatHex           },
226 { 'name':'gs'    , 'set':0, 'bitsize':32 , 'encoding':eEncodingUint  , 'format':eFormatHex           },
227 { 'name':'stmm0' , 'set':1, 'bitsize':80 , 'encoding':eEncodingVector, 'format':eFormatVectorOfUInt8 },
228 { 'name':'stmm1' , 'set':1, 'bitsize':80 , 'encoding':eEncodingVector, 'format':eFormatVectorOfUInt8 },
229 { 'name':'stmm2' , 'set':1, 'bitsize':80 , 'encoding':eEncodingVector, 'format':eFormatVectorOfUInt8 },
230 { 'name':'stmm3' , 'set':1, 'bitsize':80 , 'encoding':eEncodingVector, 'format':eFormatVectorOfUInt8 },
231 { 'name':'stmm4' , 'set':1, 'bitsize':80 , 'encoding':eEncodingVector, 'format':eFormatVectorOfUInt8 },
232 { 'name':'stmm5' , 'set':1, 'bitsize':80 , 'encoding':eEncodingVector, 'format':eFormatVectorOfUInt8 },
233 { 'name':'stmm6' , 'set':1, 'bitsize':80 , 'encoding':eEncodingVector, 'format':eFormatVectorOfUInt8 },
234 { 'name':'stmm7' , 'set':1, 'bitsize':80 , 'encoding':eEncodingVector, 'format':eFormatVectorOfUInt8 },
235 { 'name':'fctrl' , 'set':1, 'bitsize':32 , 'encoding':eEncodingUint  , 'format':eFormatHex           },
236 { 'name':'fstat' , 'set':1, 'bitsize':32 , 'encoding':eEncodingUint  , 'format':eFormatHex           },
237 { 'name':'ftag'  , 'set':1, 'bitsize':32 , 'encoding':eEncodingUint  , 'format':eFormatHex           },
238 { 'name':'fiseg' , 'set':1, 'bitsize':32 , 'encoding':eEncodingUint  , 'format':eFormatHex           },
239 { 'name':'fioff' , 'set':1, 'bitsize':32 , 'encoding':eEncodingUint  , 'format':eFormatHex           },
240 { 'name':'foseg' , 'set':1, 'bitsize':32 , 'encoding':eEncodingUint  , 'format':eFormatHex           },
241 { 'name':'fooff' , 'set':1, 'bitsize':32 , 'encoding':eEncodingUint  , 'format':eFormatHex           },
242 { 'name':'fop'   , 'set':1, 'bitsize':32 , 'encoding':eEncodingUint  , 'format':eFormatHex           },
243 { 'name':'xmm0'  , 'set':1, 'bitsize':128, 'encoding':eEncodingVector, 'format':eFormatVectorOfUInt8 },
244 { 'name':'xmm1'  , 'set':1, 'bitsize':128, 'encoding':eEncodingVector, 'format':eFormatVectorOfUInt8 },
245 { 'name':'xmm2'  , 'set':1, 'bitsize':128, 'encoding':eEncodingVector, 'format':eFormatVectorOfUInt8 },
246 { 'name':'xmm3'  , 'set':1, 'bitsize':128, 'encoding':eEncodingVector, 'format':eFormatVectorOfUInt8 },
247 { 'name':'xmm4'  , 'set':1, 'bitsize':128, 'encoding':eEncodingVector, 'format':eFormatVectorOfUInt8 },
248 { 'name':'xmm5'  , 'set':1, 'bitsize':128, 'encoding':eEncodingVector, 'format':eFormatVectorOfUInt8 },
249 { 'name':'xmm6'  , 'set':1, 'bitsize':128, 'encoding':eEncodingVector, 'format':eFormatVectorOfUInt8 },
250 { 'name':'xmm7'  , 'set':1, 'bitsize':128, 'encoding':eEncodingVector, 'format':eFormatVectorOfUInt8 },
251 { 'name':'xmm8'  , 'set':1, 'bitsize':128, 'encoding':eEncodingVector, 'format':eFormatVectorOfUInt8 },
252 { 'name':'xmm9'  , 'set':1, 'bitsize':128, 'encoding':eEncodingVector, 'format':eFormatVectorOfUInt8 },
253 { 'name':'xmm10' , 'set':1, 'bitsize':128, 'encoding':eEncodingVector, 'format':eFormatVectorOfUInt8 },
254 { 'name':'xmm11' , 'set':1, 'bitsize':128, 'encoding':eEncodingVector, 'format':eFormatVectorOfUInt8 },
255 { 'name':'xmm12' , 'set':1, 'bitsize':128, 'encoding':eEncodingVector, 'format':eFormatVectorOfUInt8 },
256 { 'name':'xmm13' , 'set':1, 'bitsize':128, 'encoding':eEncodingVector, 'format':eFormatVectorOfUInt8 },
257 { 'name':'xmm14' , 'set':1, 'bitsize':128, 'encoding':eEncodingVector, 'format':eFormatVectorOfUInt8 },
258 { 'name':'xmm15' , 'set':1, 'bitsize':128, 'encoding':eEncodingVector, 'format':eFormatVectorOfUInt8 },
259 { 'name':'mxcsr' , 'set':1, 'bitsize':32 , 'encoding':eEncodingUint  , 'format':eFormatHex           },
260 # Registers that are contained in or composed of one of more other registers
261 { 'name':'eax'   , 'set':0, 'bitsize':32 , 'encoding':eEncodingUint  , 'format':eFormatHex          , 'slice': 'rax[31:0]' },
262 { 'name':'ebx'   , 'set':0, 'bitsize':32 , 'encoding':eEncodingUint  , 'format':eFormatHex          , 'slice': 'rbx[31:0]' },
263 { 'name':'ecx'   , 'set':0, 'bitsize':32 , 'encoding':eEncodingUint  , 'format':eFormatHex          , 'slice': 'rcx[31:0]' },
264 { 'name':'edx'   , 'set':0, 'bitsize':32 , 'encoding':eEncodingUint  , 'format':eFormatHex          , 'slice': 'rdx[31:0]' },
265 { 'name':'edi'   , 'set':0, 'bitsize':32 , 'encoding':eEncodingUint  , 'format':eFormatHex          , 'slice': 'rdi[31:0]' },
266 { 'name':'esi'   , 'set':0, 'bitsize':32 , 'encoding':eEncodingUint  , 'format':eFormatHex          , 'slice': 'rsi[31:0]' },
267 { 'name':'ebp'   , 'set':0, 'bitsize':32 , 'encoding':eEncodingUint  , 'format':eFormatHex          , 'slice': 'rbp[31:0]' },
268 { 'name':'esp'   , 'set':0, 'bitsize':32 , 'encoding':eEncodingUint  , 'format':eFormatHex          , 'slice': 'rsp[31:0]' },
269 { 'name':'r8d'   , 'set':0, 'bitsize':32 , 'encoding':eEncodingUint  , 'format':eFormatHex          , 'slice':  'r8[31:0]' },
270 { 'name':'r9d'   , 'set':0, 'bitsize':32 , 'encoding':eEncodingUint  , 'format':eFormatHex          , 'slice':  'r9[31:0]' },
271 { 'name':'r10d'  , 'set':0, 'bitsize':32 , 'encoding':eEncodingUint  , 'format':eFormatHex          , 'slice': 'r10[31:0]' },
272 { 'name':'r11d'  , 'set':0, 'bitsize':32 , 'encoding':eEncodingUint  , 'format':eFormatHex          , 'slice': 'r11[31:0]' },
273 { 'name':'r12d'  , 'set':0, 'bitsize':32 , 'encoding':eEncodingUint  , 'format':eFormatHex          , 'slice': 'r12[31:0]' },
274 { 'name':'r13d'  , 'set':0, 'bitsize':32 , 'encoding':eEncodingUint  , 'format':eFormatHex          , 'slice': 'r13[31:0]' },
275 { 'name':'r14d'  , 'set':0, 'bitsize':32 , 'encoding':eEncodingUint  , 'format':eFormatHex          , 'slice': 'r14[31:0]' },
276 { 'name':'r15d'  , 'set':0, 'bitsize':32 , 'encoding':eEncodingUint  , 'format':eFormatHex          , 'slice': 'r15[31:0]' },
277                                                                                                     
278 { 'name':'ax'    , 'set':0, 'bitsize':16 , 'encoding':eEncodingUint  , 'format':eFormatHex          , 'slice': 'rax[15:0]' },
279 { 'name':'bx'    , 'set':0, 'bitsize':16 , 'encoding':eEncodingUint  , 'format':eFormatHex          , 'slice': 'rbx[15:0]' },
280 { 'name':'cx'    , 'set':0, 'bitsize':16 , 'encoding':eEncodingUint  , 'format':eFormatHex          , 'slice': 'rcx[15:0]' },
281 { 'name':'dx'    , 'set':0, 'bitsize':16 , 'encoding':eEncodingUint  , 'format':eFormatHex          , 'slice': 'rdx[15:0]' },
282 { 'name':'di'    , 'set':0, 'bitsize':16 , 'encoding':eEncodingUint  , 'format':eFormatHex          , 'slice': 'rdi[15:0]' },
283 { 'name':'si'    , 'set':0, 'bitsize':16 , 'encoding':eEncodingUint  , 'format':eFormatHex          , 'slice': 'rsi[15:0]' },
284 { 'name':'bp'    , 'set':0, 'bitsize':16 , 'encoding':eEncodingUint  , 'format':eFormatHex          , 'slice': 'rbp[15:0]' },
285 { 'name':'sp'    , 'set':0, 'bitsize':16 , 'encoding':eEncodingUint  , 'format':eFormatHex          , 'slice': 'rsp[15:0]' },
286 { 'name':'r8w'   , 'set':0, 'bitsize':16 , 'encoding':eEncodingUint  , 'format':eFormatHex          , 'slice':  'r8[15:0]' },
287 { 'name':'r9w'   , 'set':0, 'bitsize':16 , 'encoding':eEncodingUint  , 'format':eFormatHex          , 'slice':  'r9[15:0]' },
288 { 'name':'r10w'  , 'set':0, 'bitsize':16 , 'encoding':eEncodingUint  , 'format':eFormatHex          , 'slice': 'r10[15:0]' },
289 { 'name':'r11w'  , 'set':0, 'bitsize':16 , 'encoding':eEncodingUint  , 'format':eFormatHex          , 'slice': 'r11[15:0]' },
290 { 'name':'r12w'  , 'set':0, 'bitsize':16 , 'encoding':eEncodingUint  , 'format':eFormatHex          , 'slice': 'r12[15:0]' },
291 { 'name':'r13w'  , 'set':0, 'bitsize':16 , 'encoding':eEncodingUint  , 'format':eFormatHex          , 'slice': 'r13[15:0]' },
292 { 'name':'r14w'  , 'set':0, 'bitsize':16 , 'encoding':eEncodingUint  , 'format':eFormatHex          , 'slice': 'r14[15:0]' },
293 { 'name':'r15w'  , 'set':0, 'bitsize':16 , 'encoding':eEncodingUint  , 'format':eFormatHex          , 'slice': 'r15[15:0]' },
294                                                                                                     
295 { 'name':'ah'    , 'set':0, 'bitsize':8  , 'encoding':eEncodingUint  , 'format':eFormatHex          , 'slice': 'rax[15:8]' },
296 { 'name':'bh'    , 'set':0, 'bitsize':8  , 'encoding':eEncodingUint  , 'format':eFormatHex          , 'slice': 'rbx[15:8]' },
297 { 'name':'ch'    , 'set':0, 'bitsize':8  , 'encoding':eEncodingUint  , 'format':eFormatHex          , 'slice': 'rcx[15:8]' },
298 { 'name':'dh'    , 'set':0, 'bitsize':8  , 'encoding':eEncodingUint  , 'format':eFormatHex          , 'slice': 'rdx[15:8]' },
299                                                                                                     
300 { 'name':'al'    , 'set':0, 'bitsize':8  , 'encoding':eEncodingUint  , 'format':eFormatHex          , 'slice': 'rax[7:0]'  },
301 { 'name':'bl'    , 'set':0, 'bitsize':8  , 'encoding':eEncodingUint  , 'format':eFormatHex          , 'slice': 'rbx[7:0]'  },
302 { 'name':'cl'    , 'set':0, 'bitsize':8  , 'encoding':eEncodingUint  , 'format':eFormatHex          , 'slice': 'rcx[7:0]'  },
303 { 'name':'dl'    , 'set':0, 'bitsize':8  , 'encoding':eEncodingUint  , 'format':eFormatHex          , 'slice': 'rdx[7:0]'  },
304 { 'name':'dil'   , 'set':0, 'bitsize':8  , 'encoding':eEncodingUint  , 'format':eFormatHex          , 'slice': 'rdi[7:0]'  },
305 { 'name':'sil'   , 'set':0, 'bitsize':8  , 'encoding':eEncodingUint  , 'format':eFormatHex          , 'slice': 'rsi[7:0]'  },
306 { 'name':'bpl'   , 'set':0, 'bitsize':8  , 'encoding':eEncodingUint  , 'format':eFormatHex          , 'slice': 'rbp[7:0]'  },
307 { 'name':'spl'   , 'set':0, 'bitsize':8  , 'encoding':eEncodingUint  , 'format':eFormatHex          , 'slice': 'rsp[7:0]'  },
308 { 'name':'r8l'   , 'set':0, 'bitsize':8  , 'encoding':eEncodingUint  , 'format':eFormatHex          , 'slice':  'r8[7:0]'  },
309 { 'name':'r9l'   , 'set':0, 'bitsize':8  , 'encoding':eEncodingUint  , 'format':eFormatHex          , 'slice':  'r9[7:0]'  },
310 { 'name':'r10l'  , 'set':0, 'bitsize':8  , 'encoding':eEncodingUint  , 'format':eFormatHex          , 'slice': 'r10[7:0]'  },
311 { 'name':'r11l'  , 'set':0, 'bitsize':8  , 'encoding':eEncodingUint  , 'format':eFormatHex          , 'slice': 'r11[7:0]'  },
312 { 'name':'r12l'  , 'set':0, 'bitsize':8  , 'encoding':eEncodingUint  , 'format':eFormatHex          , 'slice': 'r12[7:0]'  },
313 { 'name':'r13l'  , 'set':0, 'bitsize':8  , 'encoding':eEncodingUint  , 'format':eFormatHex          , 'slice': 'r13[7:0]'  },
314 { 'name':'r14l'  , 'set':0, 'bitsize':8  , 'encoding':eEncodingUint  , 'format':eFormatHex          , 'slice': 'r14[7:0]'  },
315 { 'name':'r15l'  , 'set':0, 'bitsize':8  , 'encoding':eEncodingUint  , 'format':eFormatHex          , 'slice': 'r15[7:0]'  },
316 ];
317
318 g_target_definition = None
319
320 def get_target_definition ():
321     global g_target_definition
322     if g_target_definition == None:
323         g_target_definition = {}
324         offset = 0
325         for reg_info in x86_64_register_infos:
326             reg_name = reg_info['name']
327             
328             # Only fill in the offset if there is no 'slice' in the register info
329             if 'slice' not in reg_info and 'composite' not in reg_info:
330                 reg_info['offset'] = offset
331                 offset += reg_info['bitsize']/8
332             
333             # Set the GCC/DWARF register number for this register if it has one    
334             reg_num = get_reg_num(name_to_gcc_dwarf_regnum, reg_name)
335             if reg_num != LLDB_INVALID_REGNUM:
336                 reg_info['gcc'] = reg_num
337                 reg_info['dwarf'] = reg_num
338             
339             # Set the generic register number for this register if it has one    
340             reg_num = get_reg_num(name_to_generic_regnum, reg_name)
341             if reg_num != LLDB_INVALID_REGNUM:
342                 reg_info['generic'] = reg_num
343
344             # Set the GDB register number for this register if it has one    
345             reg_num = get_reg_num(name_to_gdb_regnum, reg_name)
346             if reg_num != LLDB_INVALID_REGNUM:
347                 reg_info['gdb'] = reg_num
348
349         g_target_definition['sets'] = ['General Purpose Registers', 'Floating Point Registers']
350         g_target_definition['registers'] = x86_64_register_infos
351         g_target_definition['host-info'] = { 'triple'   : 'x86_64-apple-macosx', 'endian': eByteOrderLittle }
352         g_target_definition['g-packet-size'] = offset
353     return g_target_definition
354
355 def get_dynamic_setting(target, setting_name):
356     if setting_name == 'gdb-server-target-definition':
357         return get_target_definition()