brintos

brintos / llvm-project-archived public Read only

0
0
Text · 23.7 KiB · c6f2e08 Raw
1081 lines · python
1#!/usr/bin/env python2# ===-- x86_64_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-exception7#8# ===----------------------------------------------------------------------===//9 10# ----------------------------------------------------------------------11# DESCRIPTION12#13# This file can be used with the following setting:14#   plugin.process.gdb-remote.target-definition-file15# This setting should be used when you are trying to connect to a16# remote GDB server that doesn't support any of the register discovery17# packets that LLDB normally uses.18#19# Why is this necessary? LLDB doesn't require a new build of LLDB that20# targets each new architecture you will debug with. Instead, all21# architectures are supported and LLDB relies on extra GDB server22# packets to discover the target we are connecting to so that is can23# show the right registers for each target. This allows the GDB server24# to change and add new registers without requiring a new LLDB build25# just so we can see new registers.26#27# This file implements the x86_64 registers for the darwin version of28# GDB and allows you to connect to servers that use this register set.29#30# USAGE31#32# (lldb) settings set plugin.process.gdb-remote.target-definition-file /path/to/x86_64_target_definition.py33# (lldb) gdb-remote other.baz.com:123434#35# The target definition file will get used if and only if the36# qRegisterInfo packets are not supported when connecting to a remote37# GDB server.38# ----------------------------------------------------------------------39from lldb import *40 41# Compiler and DWARF register numbers42name_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 102name_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 178name_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 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_REGNUM195 196 197def 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_REGNUM201 202 203x86_64_register_infos = [204    {205        "name": "rax",206        "set": 0,207        "bitsize": 64,208        "encoding": eEncodingUint,209        "format": eFormatAddressInfo,210    },211    {212        "name": "rbx",213        "set": 0,214        "bitsize": 64,215        "encoding": eEncodingUint,216        "format": eFormatAddressInfo,217    },218    {219        "name": "rcx",220        "set": 0,221        "bitsize": 64,222        "encoding": eEncodingUint,223        "format": eFormatAddressInfo,224        "alt-name": "arg4",225    },226    {227        "name": "rdx",228        "set": 0,229        "bitsize": 64,230        "encoding": eEncodingUint,231        "format": eFormatAddressInfo,232        "alt-name": "arg3",233    },234    {235        "name": "rsi",236        "set": 0,237        "bitsize": 64,238        "encoding": eEncodingUint,239        "format": eFormatAddressInfo,240        "alt-name": "arg2",241    },242    {243        "name": "rdi",244        "set": 0,245        "bitsize": 64,246        "encoding": eEncodingUint,247        "format": eFormatAddressInfo,248        "alt-name": "arg1",249    },250    {251        "name": "rbp",252        "set": 0,253        "bitsize": 64,254        "encoding": eEncodingUint,255        "format": eFormatAddressInfo,256        "alt-name": "fp",257    },258    {259        "name": "rsp",260        "set": 0,261        "bitsize": 64,262        "encoding": eEncodingUint,263        "format": eFormatAddressInfo,264        "alt-name": "sp",265    },266    {267        "name": "r8",268        "set": 0,269        "bitsize": 64,270        "encoding": eEncodingUint,271        "format": eFormatAddressInfo,272        "alt-name": "arg5",273    },274    {275        "name": "r9",276        "set": 0,277        "bitsize": 64,278        "encoding": eEncodingUint,279        "format": eFormatAddressInfo,280        "alt-name": "arg6",281    },282    {283        "name": "r10",284        "set": 0,285        "bitsize": 64,286        "encoding": eEncodingUint,287        "format": eFormatAddressInfo,288    },289    {290        "name": "r11",291        "set": 0,292        "bitsize": 64,293        "encoding": eEncodingUint,294        "format": eFormatAddressInfo,295    },296    {297        "name": "r12",298        "set": 0,299        "bitsize": 64,300        "encoding": eEncodingUint,301        "format": eFormatAddressInfo,302    },303    {304        "name": "r13",305        "set": 0,306        "bitsize": 64,307        "encoding": eEncodingUint,308        "format": eFormatAddressInfo,309    },310    {311        "name": "r14",312        "set": 0,313        "bitsize": 64,314        "encoding": eEncodingUint,315        "format": eFormatAddressInfo,316    },317    {318        "name": "r15",319        "set": 0,320        "bitsize": 64,321        "encoding": eEncodingUint,322        "format": eFormatAddressInfo,323    },324    {325        "name": "rip",326        "set": 0,327        "bitsize": 64,328        "encoding": eEncodingUint,329        "format": eFormatAddressInfo,330        "alt-name": "pc",331    },332    {333        "name": "rflags",334        "set": 0,335        "bitsize": 32,336        "encoding": eEncodingUint,337        "format": eFormatHex,338    },339    {340        "name": "cs",341        "set": 0,342        "bitsize": 32,343        "encoding": eEncodingUint,344        "format": eFormatHex,345    },346    {347        "name": "ss",348        "set": 0,349        "bitsize": 32,350        "encoding": eEncodingUint,351        "format": eFormatHex,352    },353    {354        "name": "ds",355        "set": 0,356        "bitsize": 32,357        "encoding": eEncodingUint,358        "format": eFormatHex,359    },360    {361        "name": "es",362        "set": 0,363        "bitsize": 32,364        "encoding": eEncodingUint,365        "format": eFormatHex,366    },367    {368        "name": "fs",369        "set": 0,370        "bitsize": 32,371        "encoding": eEncodingUint,372        "format": eFormatHex,373    },374    {375        "name": "gs",376        "set": 0,377        "bitsize": 32,378        "encoding": eEncodingUint,379        "format": eFormatHex,380    },381    {382        "name": "stmm0",383        "set": 1,384        "bitsize": 80,385        "encoding": eEncodingVector,386        "format": eFormatVectorOfUInt8,387    },388    {389        "name": "stmm1",390        "set": 1,391        "bitsize": 80,392        "encoding": eEncodingVector,393        "format": eFormatVectorOfUInt8,394    },395    {396        "name": "stmm2",397        "set": 1,398        "bitsize": 80,399        "encoding": eEncodingVector,400        "format": eFormatVectorOfUInt8,401    },402    {403        "name": "stmm3",404        "set": 1,405        "bitsize": 80,406        "encoding": eEncodingVector,407        "format": eFormatVectorOfUInt8,408    },409    {410        "name": "stmm4",411        "set": 1,412        "bitsize": 80,413        "encoding": eEncodingVector,414        "format": eFormatVectorOfUInt8,415    },416    {417        "name": "stmm5",418        "set": 1,419        "bitsize": 80,420        "encoding": eEncodingVector,421        "format": eFormatVectorOfUInt8,422    },423    {424        "name": "stmm6",425        "set": 1,426        "bitsize": 80,427        "encoding": eEncodingVector,428        "format": eFormatVectorOfUInt8,429    },430    {431        "name": "stmm7",432        "set": 1,433        "bitsize": 80,434        "encoding": eEncodingVector,435        "format": eFormatVectorOfUInt8,436    },437    {438        "name": "fctrl",439        "set": 1,440        "bitsize": 32,441        "encoding": eEncodingUint,442        "format": eFormatHex,443    },444    {445        "name": "fstat",446        "set": 1,447        "bitsize": 32,448        "encoding": eEncodingUint,449        "format": eFormatHex,450    },451    {452        "name": "ftag",453        "set": 1,454        "bitsize": 32,455        "encoding": eEncodingUint,456        "format": eFormatHex,457    },458    {459        "name": "fiseg",460        "set": 1,461        "bitsize": 32,462        "encoding": eEncodingUint,463        "format": eFormatHex,464    },465    {466        "name": "fioff",467        "set": 1,468        "bitsize": 32,469        "encoding": eEncodingUint,470        "format": eFormatHex,471    },472    {473        "name": "foseg",474        "set": 1,475        "bitsize": 32,476        "encoding": eEncodingUint,477        "format": eFormatHex,478    },479    {480        "name": "fooff",481        "set": 1,482        "bitsize": 32,483        "encoding": eEncodingUint,484        "format": eFormatHex,485    },486    {487        "name": "fop",488        "set": 1,489        "bitsize": 32,490        "encoding": eEncodingUint,491        "format": eFormatHex,492    },493    {494        "name": "xmm0",495        "set": 1,496        "bitsize": 128,497        "encoding": eEncodingVector,498        "format": eFormatVectorOfUInt8,499    },500    {501        "name": "xmm1",502        "set": 1,503        "bitsize": 128,504        "encoding": eEncodingVector,505        "format": eFormatVectorOfUInt8,506    },507    {508        "name": "xmm2",509        "set": 1,510        "bitsize": 128,511        "encoding": eEncodingVector,512        "format": eFormatVectorOfUInt8,513    },514    {515        "name": "xmm3",516        "set": 1,517        "bitsize": 128,518        "encoding": eEncodingVector,519        "format": eFormatVectorOfUInt8,520    },521    {522        "name": "xmm4",523        "set": 1,524        "bitsize": 128,525        "encoding": eEncodingVector,526        "format": eFormatVectorOfUInt8,527    },528    {529        "name": "xmm5",530        "set": 1,531        "bitsize": 128,532        "encoding": eEncodingVector,533        "format": eFormatVectorOfUInt8,534    },535    {536        "name": "xmm6",537        "set": 1,538        "bitsize": 128,539        "encoding": eEncodingVector,540        "format": eFormatVectorOfUInt8,541    },542    {543        "name": "xmm7",544        "set": 1,545        "bitsize": 128,546        "encoding": eEncodingVector,547        "format": eFormatVectorOfUInt8,548    },549    {550        "name": "xmm8",551        "set": 1,552        "bitsize": 128,553        "encoding": eEncodingVector,554        "format": eFormatVectorOfUInt8,555    },556    {557        "name": "xmm9",558        "set": 1,559        "bitsize": 128,560        "encoding": eEncodingVector,561        "format": eFormatVectorOfUInt8,562    },563    {564        "name": "xmm10",565        "set": 1,566        "bitsize": 128,567        "encoding": eEncodingVector,568        "format": eFormatVectorOfUInt8,569    },570    {571        "name": "xmm11",572        "set": 1,573        "bitsize": 128,574        "encoding": eEncodingVector,575        "format": eFormatVectorOfUInt8,576    },577    {578        "name": "xmm12",579        "set": 1,580        "bitsize": 128,581        "encoding": eEncodingVector,582        "format": eFormatVectorOfUInt8,583    },584    {585        "name": "xmm13",586        "set": 1,587        "bitsize": 128,588        "encoding": eEncodingVector,589        "format": eFormatVectorOfUInt8,590    },591    {592        "name": "xmm14",593        "set": 1,594        "bitsize": 128,595        "encoding": eEncodingVector,596        "format": eFormatVectorOfUInt8,597    },598    {599        "name": "xmm15",600        "set": 1,601        "bitsize": 128,602        "encoding": eEncodingVector,603        "format": eFormatVectorOfUInt8,604    },605    {606        "name": "mxcsr",607        "set": 1,608        "bitsize": 32,609        "encoding": eEncodingUint,610        "format": eFormatHex,611    },612    # Registers that are contained in or composed of one of more other613    # registers614    {615        "name": "eax",616        "set": 0,617        "bitsize": 32,618        "encoding": eEncodingUint,619        "format": eFormatHex,620        "slice": "rax[31:0]",621    },622    {623        "name": "ebx",624        "set": 0,625        "bitsize": 32,626        "encoding": eEncodingUint,627        "format": eFormatHex,628        "slice": "rbx[31:0]",629    },630    {631        "name": "ecx",632        "set": 0,633        "bitsize": 32,634        "encoding": eEncodingUint,635        "format": eFormatHex,636        "slice": "rcx[31:0]",637    },638    {639        "name": "edx",640        "set": 0,641        "bitsize": 32,642        "encoding": eEncodingUint,643        "format": eFormatHex,644        "slice": "rdx[31:0]",645    },646    {647        "name": "edi",648        "set": 0,649        "bitsize": 32,650        "encoding": eEncodingUint,651        "format": eFormatHex,652        "slice": "rdi[31:0]",653    },654    {655        "name": "esi",656        "set": 0,657        "bitsize": 32,658        "encoding": eEncodingUint,659        "format": eFormatHex,660        "slice": "rsi[31:0]",661    },662    {663        "name": "ebp",664        "set": 0,665        "bitsize": 32,666        "encoding": eEncodingUint,667        "format": eFormatHex,668        "slice": "rbp[31:0]",669    },670    {671        "name": "esp",672        "set": 0,673        "bitsize": 32,674        "encoding": eEncodingUint,675        "format": eFormatHex,676        "slice": "rsp[31:0]",677    },678    {679        "name": "r8d",680        "set": 0,681        "bitsize": 32,682        "encoding": eEncodingUint,683        "format": eFormatHex,684        "slice": "r8[31:0]",685    },686    {687        "name": "r9d",688        "set": 0,689        "bitsize": 32,690        "encoding": eEncodingUint,691        "format": eFormatHex,692        "slice": "r9[31:0]",693    },694    {695        "name": "r10d",696        "set": 0,697        "bitsize": 32,698        "encoding": eEncodingUint,699        "format": eFormatHex,700        "slice": "r10[31:0]",701    },702    {703        "name": "r11d",704        "set": 0,705        "bitsize": 32,706        "encoding": eEncodingUint,707        "format": eFormatHex,708        "slice": "r11[31:0]",709    },710    {711        "name": "r12d",712        "set": 0,713        "bitsize": 32,714        "encoding": eEncodingUint,715        "format": eFormatHex,716        "slice": "r12[31:0]",717    },718    {719        "name": "r13d",720        "set": 0,721        "bitsize": 32,722        "encoding": eEncodingUint,723        "format": eFormatHex,724        "slice": "r13[31:0]",725    },726    {727        "name": "r14d",728        "set": 0,729        "bitsize": 32,730        "encoding": eEncodingUint,731        "format": eFormatHex,732        "slice": "r14[31:0]",733    },734    {735        "name": "r15d",736        "set": 0,737        "bitsize": 32,738        "encoding": eEncodingUint,739        "format": eFormatHex,740        "slice": "r15[31:0]",741    },742    {743        "name": "ax",744        "set": 0,745        "bitsize": 16,746        "encoding": eEncodingUint,747        "format": eFormatHex,748        "slice": "rax[15:0]",749    },750    {751        "name": "bx",752        "set": 0,753        "bitsize": 16,754        "encoding": eEncodingUint,755        "format": eFormatHex,756        "slice": "rbx[15:0]",757    },758    {759        "name": "cx",760        "set": 0,761        "bitsize": 16,762        "encoding": eEncodingUint,763        "format": eFormatHex,764        "slice": "rcx[15:0]",765    },766    {767        "name": "dx",768        "set": 0,769        "bitsize": 16,770        "encoding": eEncodingUint,771        "format": eFormatHex,772        "slice": "rdx[15:0]",773    },774    {775        "name": "di",776        "set": 0,777        "bitsize": 16,778        "encoding": eEncodingUint,779        "format": eFormatHex,780        "slice": "rdi[15:0]",781    },782    {783        "name": "si",784        "set": 0,785        "bitsize": 16,786        "encoding": eEncodingUint,787        "format": eFormatHex,788        "slice": "rsi[15:0]",789    },790    {791        "name": "bp",792        "set": 0,793        "bitsize": 16,794        "encoding": eEncodingUint,795        "format": eFormatHex,796        "slice": "rbp[15:0]",797    },798    {799        "name": "sp",800        "set": 0,801        "bitsize": 16,802        "encoding": eEncodingUint,803        "format": eFormatHex,804        "slice": "rsp[15:0]",805    },806    {807        "name": "r8w",808        "set": 0,809        "bitsize": 16,810        "encoding": eEncodingUint,811        "format": eFormatHex,812        "slice": "r8[15:0]",813    },814    {815        "name": "r9w",816        "set": 0,817        "bitsize": 16,818        "encoding": eEncodingUint,819        "format": eFormatHex,820        "slice": "r9[15:0]",821    },822    {823        "name": "r10w",824        "set": 0,825        "bitsize": 16,826        "encoding": eEncodingUint,827        "format": eFormatHex,828        "slice": "r10[15:0]",829    },830    {831        "name": "r11w",832        "set": 0,833        "bitsize": 16,834        "encoding": eEncodingUint,835        "format": eFormatHex,836        "slice": "r11[15:0]",837    },838    {839        "name": "r12w",840        "set": 0,841        "bitsize": 16,842        "encoding": eEncodingUint,843        "format": eFormatHex,844        "slice": "r12[15:0]",845    },846    {847        "name": "r13w",848        "set": 0,849        "bitsize": 16,850        "encoding": eEncodingUint,851        "format": eFormatHex,852        "slice": "r13[15:0]",853    },854    {855        "name": "r14w",856        "set": 0,857        "bitsize": 16,858        "encoding": eEncodingUint,859        "format": eFormatHex,860        "slice": "r14[15:0]",861    },862    {863        "name": "r15w",864        "set": 0,865        "bitsize": 16,866        "encoding": eEncodingUint,867        "format": eFormatHex,868        "slice": "r15[15:0]",869    },870    {871        "name": "ah",872        "set": 0,873        "bitsize": 8,874        "encoding": eEncodingUint,875        "format": eFormatHex,876        "slice": "rax[15:8]",877    },878    {879        "name": "bh",880        "set": 0,881        "bitsize": 8,882        "encoding": eEncodingUint,883        "format": eFormatHex,884        "slice": "rbx[15:8]",885    },886    {887        "name": "ch",888        "set": 0,889        "bitsize": 8,890        "encoding": eEncodingUint,891        "format": eFormatHex,892        "slice": "rcx[15:8]",893    },894    {895        "name": "dh",896        "set": 0,897        "bitsize": 8,898        "encoding": eEncodingUint,899        "format": eFormatHex,900        "slice": "rdx[15:8]",901    },902    {903        "name": "al",904        "set": 0,905        "bitsize": 8,906        "encoding": eEncodingUint,907        "format": eFormatHex,908        "slice": "rax[7:0]",909    },910    {911        "name": "bl",912        "set": 0,913        "bitsize": 8,914        "encoding": eEncodingUint,915        "format": eFormatHex,916        "slice": "rbx[7:0]",917    },918    {919        "name": "cl",920        "set": 0,921        "bitsize": 8,922        "encoding": eEncodingUint,923        "format": eFormatHex,924        "slice": "rcx[7:0]",925    },926    {927        "name": "dl",928        "set": 0,929        "bitsize": 8,930        "encoding": eEncodingUint,931        "format": eFormatHex,932        "slice": "rdx[7:0]",933    },934    {935        "name": "dil",936        "set": 0,937        "bitsize": 8,938        "encoding": eEncodingUint,939        "format": eFormatHex,940        "slice": "rdi[7:0]",941    },942    {943        "name": "sil",944        "set": 0,945        "bitsize": 8,946        "encoding": eEncodingUint,947        "format": eFormatHex,948        "slice": "rsi[7:0]",949    },950    {951        "name": "bpl",952        "set": 0,953        "bitsize": 8,954        "encoding": eEncodingUint,955        "format": eFormatHex,956        "slice": "rbp[7:0]",957    },958    {959        "name": "spl",960        "set": 0,961        "bitsize": 8,962        "encoding": eEncodingUint,963        "format": eFormatHex,964        "slice": "rsp[7:0]",965    },966    {967        "name": "r8l",968        "set": 0,969        "bitsize": 8,970        "encoding": eEncodingUint,971        "format": eFormatHex,972        "slice": "r8[7:0]",973    },974    {975        "name": "r9l",976        "set": 0,977        "bitsize": 8,978        "encoding": eEncodingUint,979        "format": eFormatHex,980        "slice": "r9[7:0]",981    },982    {983        "name": "r10l",984        "set": 0,985        "bitsize": 8,986        "encoding": eEncodingUint,987        "format": eFormatHex,988        "slice": "r10[7:0]",989    },990    {991        "name": "r11l",992        "set": 0,993        "bitsize": 8,994        "encoding": eEncodingUint,995        "format": eFormatHex,996        "slice": "r11[7:0]",997    },998    {999        "name": "r12l",1000        "set": 0,1001        "bitsize": 8,1002        "encoding": eEncodingUint,1003        "format": eFormatHex,1004        "slice": "r12[7:0]",1005    },1006    {1007        "name": "r13l",1008        "set": 0,1009        "bitsize": 8,1010        "encoding": eEncodingUint,1011        "format": eFormatHex,1012        "slice": "r13[7:0]",1013    },1014    {1015        "name": "r14l",1016        "set": 0,1017        "bitsize": 8,1018        "encoding": eEncodingUint,1019        "format": eFormatHex,1020        "slice": "r14[7:0]",1021    },1022    {1023        "name": "r15l",1024        "set": 0,1025        "bitsize": 8,1026        "encoding": eEncodingUint,1027        "format": eFormatHex,1028        "slice": "r15[7:0]",1029    },1030]1031 1032g_target_definition = None1033 1034 1035def get_target_definition():1036    global g_target_definition1037    if g_target_definition is None:1038        g_target_definition = {}1039        offset = 01040        for reg_info in x86_64_register_infos:1041            reg_name = reg_info["name"]1042 1043            # Only fill in the offset if there is no 'slice' in the register1044            # info1045            if "slice" not in reg_info and "composite" not in reg_info:1046                reg_info["offset"] = offset1047                offset += reg_info["bitsize"] // 81048 1049            # Set the GCC/DWARF register number for this register if it has one1050            reg_num = get_reg_num(name_to_gcc_dwarf_regnum, reg_name)1051            if reg_num != LLDB_INVALID_REGNUM:1052                reg_info["gcc"] = reg_num1053                reg_info["dwarf"] = reg_num1054 1055            # Set the generic register number for this register if it has one1056            reg_num = get_reg_num(name_to_generic_regnum, reg_name)1057            if reg_num != LLDB_INVALID_REGNUM:1058                reg_info["generic"] = reg_num1059 1060            # Set the GDB register number for this register if it has one1061            reg_num = get_reg_num(name_to_gdb_regnum, reg_name)1062            if reg_num != LLDB_INVALID_REGNUM:1063                reg_info["gdb"] = reg_num1064 1065        g_target_definition["sets"] = [1066            "General Purpose Registers",1067            "Floating Point Registers",1068        ]1069        g_target_definition["registers"] = x86_64_register_infos1070        g_target_definition["host-info"] = {1071            "triple": "x86_64-apple-macosx",1072            "endian": eByteOrderLittle,1073        }1074        g_target_definition["g-packet-size"] = offset1075    return g_target_definition1076 1077 1078def get_dynamic_setting(target, setting_name):1079    if setting_name == "gdb-server-target-definition":1080        return get_target_definition()1081