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