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