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 191 192def 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 197x86_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 {'name': 'orig_rax', 'set': 1, 'bitsize': 64, 409 'encoding': eEncodingUint, 'format': eFormatHex}, 410 # Registers that are contained in or composed of one of more other 411 # registers 412 {'name': 'eax', 413 'set': 0, 414 'bitsize': 32, 415 'encoding': eEncodingUint, 416 'format': eFormatHex, 417 'slice': 'rax[31:0]'}, 418 {'name': 'ebx', 419 'set': 0, 420 'bitsize': 32, 421 'encoding': eEncodingUint, 422 'format': eFormatHex, 423 'slice': 'rbx[31:0]'}, 424 {'name': 'ecx', 425 'set': 0, 426 'bitsize': 32, 427 'encoding': eEncodingUint, 428 'format': eFormatHex, 429 'slice': 'rcx[31:0]'}, 430 {'name': 'edx', 431 'set': 0, 432 'bitsize': 32, 433 'encoding': eEncodingUint, 434 'format': eFormatHex, 435 'slice': 'rdx[31:0]'}, 436 {'name': 'edi', 437 'set': 0, 438 'bitsize': 32, 439 'encoding': eEncodingUint, 440 'format': eFormatHex, 441 'slice': 'rdi[31:0]'}, 442 {'name': 'esi', 443 'set': 0, 444 'bitsize': 32, 445 'encoding': eEncodingUint, 446 'format': eFormatHex, 447 'slice': 'rsi[31:0]'}, 448 {'name': 'ebp', 449 'set': 0, 450 'bitsize': 32, 451 'encoding': eEncodingUint, 452 'format': eFormatHex, 453 'slice': 'rbp[31:0]'}, 454 {'name': 'esp', 455 'set': 0, 456 'bitsize': 32, 457 'encoding': eEncodingUint, 458 'format': eFormatHex, 459 'slice': 'rsp[31:0]'}, 460 {'name': 'r8d', 461 'set': 0, 462 'bitsize': 32, 463 'encoding': eEncodingUint, 464 'format': eFormatHex, 465 'slice': 'r8[31:0]'}, 466 {'name': 'r9d', 467 'set': 0, 468 'bitsize': 32, 469 'encoding': eEncodingUint, 470 'format': eFormatHex, 471 'slice': 'r9[31:0]'}, 472 {'name': 'r10d', 473 'set': 0, 474 'bitsize': 32, 475 'encoding': eEncodingUint, 476 'format': eFormatHex, 477 'slice': 'r10[31:0]'}, 478 {'name': 'r11d', 479 'set': 0, 480 'bitsize': 32, 481 'encoding': eEncodingUint, 482 'format': eFormatHex, 483 'slice': 'r11[31:0]'}, 484 {'name': 'r12d', 485 'set': 0, 486 'bitsize': 32, 487 'encoding': eEncodingUint, 488 'format': eFormatHex, 489 'slice': 'r12[31:0]'}, 490 {'name': 'r13d', 491 'set': 0, 492 'bitsize': 32, 493 'encoding': eEncodingUint, 494 'format': eFormatHex, 495 'slice': 'r13[31:0]'}, 496 {'name': 'r14d', 497 'set': 0, 498 'bitsize': 32, 499 'encoding': eEncodingUint, 500 'format': eFormatHex, 501 'slice': 'r14[31:0]'}, 502 {'name': 'r15d', 503 'set': 0, 504 'bitsize': 32, 505 'encoding': eEncodingUint, 506 'format': eFormatHex, 507 'slice': 'r15[31:0]'}, 508 509 {'name': 'ax', 510 'set': 0, 511 'bitsize': 16, 512 'encoding': eEncodingUint, 513 'format': eFormatHex, 514 'slice': 'rax[15:0]'}, 515 {'name': 'bx', 516 'set': 0, 517 'bitsize': 16, 518 'encoding': eEncodingUint, 519 'format': eFormatHex, 520 'slice': 'rbx[15:0]'}, 521 {'name': 'cx', 522 'set': 0, 523 'bitsize': 16, 524 'encoding': eEncodingUint, 525 'format': eFormatHex, 526 'slice': 'rcx[15:0]'}, 527 {'name': 'dx', 528 'set': 0, 529 'bitsize': 16, 530 'encoding': eEncodingUint, 531 'format': eFormatHex, 532 'slice': 'rdx[15:0]'}, 533 {'name': 'di', 534 'set': 0, 535 'bitsize': 16, 536 'encoding': eEncodingUint, 537 'format': eFormatHex, 538 'slice': 'rdi[15:0]'}, 539 {'name': 'si', 540 'set': 0, 541 'bitsize': 16, 542 'encoding': eEncodingUint, 543 'format': eFormatHex, 544 'slice': 'rsi[15:0]'}, 545 {'name': 'bp', 546 'set': 0, 547 'bitsize': 16, 548 'encoding': eEncodingUint, 549 'format': eFormatHex, 550 'slice': 'rbp[15:0]'}, 551 {'name': 'sp', 552 'set': 0, 553 'bitsize': 16, 554 'encoding': eEncodingUint, 555 'format': eFormatHex, 556 'slice': 'rsp[15:0]'}, 557 {'name': 'r8w', 558 'set': 0, 559 'bitsize': 16, 560 'encoding': eEncodingUint, 561 'format': eFormatHex, 562 'slice': 'r8[15:0]'}, 563 {'name': 'r9w', 564 'set': 0, 565 'bitsize': 16, 566 'encoding': eEncodingUint, 567 'format': eFormatHex, 568 'slice': 'r9[15:0]'}, 569 {'name': 'r10w', 570 'set': 0, 571 'bitsize': 16, 572 'encoding': eEncodingUint, 573 'format': eFormatHex, 574 'slice': 'r10[15:0]'}, 575 {'name': 'r11w', 576 'set': 0, 577 'bitsize': 16, 578 'encoding': eEncodingUint, 579 'format': eFormatHex, 580 'slice': 'r11[15:0]'}, 581 {'name': 'r12w', 582 'set': 0, 583 'bitsize': 16, 584 'encoding': eEncodingUint, 585 'format': eFormatHex, 586 'slice': 'r12[15:0]'}, 587 {'name': 'r13w', 588 'set': 0, 589 'bitsize': 16, 590 'encoding': eEncodingUint, 591 'format': eFormatHex, 592 'slice': 'r13[15:0]'}, 593 {'name': 'r14w', 594 'set': 0, 595 'bitsize': 16, 596 'encoding': eEncodingUint, 597 'format': eFormatHex, 598 'slice': 'r14[15:0]'}, 599 {'name': 'r15w', 600 'set': 0, 601 'bitsize': 16, 602 'encoding': eEncodingUint, 603 'format': eFormatHex, 604 'slice': 'r15[15:0]'}, 605 606 {'name': 'ah', 607 'set': 0, 608 'bitsize': 8, 609 'encoding': eEncodingUint, 610 'format': eFormatHex, 611 'slice': 'rax[15:8]'}, 612 {'name': 'bh', 613 'set': 0, 614 'bitsize': 8, 615 'encoding': eEncodingUint, 616 'format': eFormatHex, 617 'slice': 'rbx[15:8]'}, 618 {'name': 'ch', 619 'set': 0, 620 'bitsize': 8, 621 'encoding': eEncodingUint, 622 'format': eFormatHex, 623 'slice': 'rcx[15:8]'}, 624 {'name': 'dh', 625 'set': 0, 626 'bitsize': 8, 627 'encoding': eEncodingUint, 628 'format': eFormatHex, 629 'slice': 'rdx[15:8]'}, 630 631 {'name': 'al', 632 'set': 0, 633 'bitsize': 8, 634 'encoding': eEncodingUint, 635 'format': eFormatHex, 636 'slice': 'rax[7:0]'}, 637 {'name': 'bl', 638 'set': 0, 639 'bitsize': 8, 640 'encoding': eEncodingUint, 641 'format': eFormatHex, 642 'slice': 'rbx[7:0]'}, 643 {'name': 'cl', 644 'set': 0, 645 'bitsize': 8, 646 'encoding': eEncodingUint, 647 'format': eFormatHex, 648 'slice': 'rcx[7:0]'}, 649 {'name': 'dl', 650 'set': 0, 651 'bitsize': 8, 652 'encoding': eEncodingUint, 653 'format': eFormatHex, 654 'slice': 'rdx[7:0]'}, 655 {'name': 'dil', 656 'set': 0, 657 'bitsize': 8, 658 'encoding': eEncodingUint, 659 'format': eFormatHex, 660 'slice': 'rdi[7:0]'}, 661 {'name': 'sil', 662 'set': 0, 663 'bitsize': 8, 664 'encoding': eEncodingUint, 665 'format': eFormatHex, 666 'slice': 'rsi[7:0]'}, 667 {'name': 'bpl', 668 'set': 0, 669 'bitsize': 8, 670 'encoding': eEncodingUint, 671 'format': eFormatHex, 672 'slice': 'rbp[7:0]'}, 673 {'name': 'spl', 674 'set': 0, 675 'bitsize': 8, 676 'encoding': eEncodingUint, 677 'format': eFormatHex, 678 'slice': 'rsp[7:0]'}, 679 {'name': 'r8l', 680 'set': 0, 681 'bitsize': 8, 682 'encoding': eEncodingUint, 683 'format': eFormatHex, 684 'slice': 'r8[7:0]'}, 685 {'name': 'r9l', 686 'set': 0, 687 'bitsize': 8, 688 'encoding': eEncodingUint, 689 'format': eFormatHex, 690 'slice': 'r9[7:0]'}, 691 {'name': 'r10l', 692 'set': 0, 693 'bitsize': 8, 694 'encoding': eEncodingUint, 695 'format': eFormatHex, 696 'slice': 'r10[7:0]'}, 697 {'name': 'r11l', 698 'set': 0, 699 'bitsize': 8, 700 'encoding': eEncodingUint, 701 'format': eFormatHex, 702 'slice': 'r11[7:0]'}, 703 {'name': 'r12l', 704 'set': 0, 705 'bitsize': 8, 706 'encoding': eEncodingUint, 707 'format': eFormatHex, 708 'slice': 'r12[7:0]'}, 709 {'name': 'r13l', 710 'set': 0, 711 'bitsize': 8, 712 'encoding': eEncodingUint, 713 'format': eFormatHex, 714 'slice': 'r13[7:0]'}, 715 {'name': 'r14l', 716 'set': 0, 717 'bitsize': 8, 718 'encoding': eEncodingUint, 719 'format': eFormatHex, 720 'slice': 'r14[7:0]'}, 721 {'name': 'r15l', 722 'set': 0, 723 'bitsize': 8, 724 'encoding': eEncodingUint, 725 'format': eFormatHex, 726 'slice': 'r15[7:0]'}, 727] 728 729g_target_definition = None 730 731 732def get_target_definition(): 733 global g_target_definition 734 if g_target_definition is None: 735 g_target_definition = {} 736 offset = 0 737 for reg_info in x86_64_register_infos: 738 reg_name = reg_info['name'] 739 740 # Only fill in the offset if there is no 'slice' in the register 741 # info 742 if 'slice' not in reg_info and 'composite' not in reg_info: 743 reg_info['offset'] = offset 744 offset += reg_info['bitsize'] / 8 745 746 # Set the GCC/DWARF register number for this register if it has one 747 reg_num = get_reg_num(name_to_gcc_dwarf_regnum, reg_name) 748 if reg_num != LLDB_INVALID_REGNUM: 749 reg_info['gcc'] = reg_num 750 reg_info['dwarf'] = reg_num 751 752 # Set the generic register number for this register if it has one 753 reg_num = get_reg_num(name_to_generic_regnum, reg_name) 754 if reg_num != LLDB_INVALID_REGNUM: 755 reg_info['generic'] = reg_num 756 757 # Set the GDB register number for this register if it has one 758 reg_num = get_reg_num(name_to_gdb_regnum, reg_name) 759 if reg_num != LLDB_INVALID_REGNUM: 760 reg_info['gdb'] = reg_num 761 762 g_target_definition['sets'] = [ 763 'General Purpose Registers', 764 'Floating Point Registers'] 765 g_target_definition['registers'] = x86_64_register_infos 766 g_target_definition[ 767 'host-info'] = {'triple': 'x86_64-*-linux', 'endian': eByteOrderLittle} 768 g_target_definition['g-packet-size'] = offset 769 g_target_definition['breakpoint-pc-offset'] = -1 770 return g_target_definition 771 772 773def get_dynamic_setting(target, setting_name): 774 if setting_name == 'gdb-server-target-definition': 775 return get_target_definition() 776