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#---------------------------------------------------------------------- 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 197 198def get_reg_num(reg_num_dict, reg_name): 199 if reg_name in reg_num_dict: 200 return reg_num_dict[reg_name] 201 return LLDB_INVALID_REGNUM 202 203x86_64_register_infos = [ 204 {'name': 'rax', 205 'set': 0, 206 'bitsize': 64, 207 'encoding': eEncodingUint, 208 'format': eFormatAddressInfo}, 209 {'name': 'rbx', 210 'set': 0, 211 'bitsize': 64, 212 'encoding': eEncodingUint, 213 'format': eFormatAddressInfo}, 214 {'name': 'rcx', 'set': 0, 'bitsize': 64, 'encoding': eEncodingUint, 215 'format': eFormatAddressInfo, 'alt-name': 'arg4'}, 216 {'name': 'rdx', 'set': 0, 'bitsize': 64, 'encoding': eEncodingUint, 217 'format': eFormatAddressInfo, 'alt-name': 'arg3'}, 218 {'name': 'rsi', 'set': 0, 'bitsize': 64, 'encoding': eEncodingUint, 219 'format': eFormatAddressInfo, 'alt-name': 'arg2'}, 220 {'name': 'rdi', 'set': 0, 'bitsize': 64, 'encoding': eEncodingUint, 221 'format': eFormatAddressInfo, 'alt-name': 'arg1'}, 222 {'name': 'rbp', 'set': 0, 'bitsize': 64, 'encoding': eEncodingUint, 223 'format': eFormatAddressInfo, 'alt-name': 'fp'}, 224 {'name': 'rsp', 'set': 0, 'bitsize': 64, 'encoding': eEncodingUint, 225 'format': eFormatAddressInfo, 'alt-name': 'sp'}, 226 {'name': 'r8', 'set': 0, 'bitsize': 64, 'encoding': eEncodingUint, 227 'format': eFormatAddressInfo, 'alt-name': 'arg5'}, 228 {'name': 'r9', 'set': 0, 'bitsize': 64, 'encoding': eEncodingUint, 229 'format': eFormatAddressInfo, 'alt-name': 'arg6'}, 230 {'name': 'r10', 231 'set': 0, 232 'bitsize': 64, 233 'encoding': eEncodingUint, 234 'format': eFormatAddressInfo}, 235 {'name': 'r11', 236 'set': 0, 237 'bitsize': 64, 238 'encoding': eEncodingUint, 239 'format': eFormatAddressInfo}, 240 {'name': 'r12', 241 'set': 0, 242 'bitsize': 64, 243 'encoding': eEncodingUint, 244 'format': eFormatAddressInfo}, 245 {'name': 'r13', 246 'set': 0, 247 'bitsize': 64, 248 'encoding': eEncodingUint, 249 'format': eFormatAddressInfo}, 250 {'name': 'r14', 251 'set': 0, 252 'bitsize': 64, 253 'encoding': eEncodingUint, 254 'format': eFormatAddressInfo}, 255 {'name': 'r15', 256 'set': 0, 257 'bitsize': 64, 258 'encoding': eEncodingUint, 259 'format': eFormatAddressInfo}, 260 {'name': 'rip', 'set': 0, 'bitsize': 64, 'encoding': eEncodingUint, 261 'format': eFormatAddressInfo, 'alt-name': 'pc'}, 262 {'name': 'rflags', 'set': 0, 'bitsize': 32, 263 'encoding': eEncodingUint, 'format': eFormatHex}, 264 {'name': 'cs', 'set': 0, 'bitsize': 32, 265 'encoding': eEncodingUint, 'format': eFormatHex}, 266 {'name': 'ss', 'set': 0, 'bitsize': 32, 267 'encoding': eEncodingUint, 'format': eFormatHex}, 268 {'name': 'ds', 'set': 0, 'bitsize': 32, 269 'encoding': eEncodingUint, 'format': eFormatHex}, 270 {'name': 'es', 'set': 0, 'bitsize': 32, 271 'encoding': eEncodingUint, 'format': eFormatHex}, 272 {'name': 'fs', 'set': 0, 'bitsize': 32, 273 'encoding': eEncodingUint, 'format': eFormatHex}, 274 {'name': 'gs', 'set': 0, 'bitsize': 32, 275 'encoding': eEncodingUint, 'format': eFormatHex}, 276 {'name': 'stmm0', 277 'set': 1, 278 'bitsize': 80, 279 'encoding': eEncodingVector, 280 'format': eFormatVectorOfUInt8}, 281 {'name': 'stmm1', 282 'set': 1, 283 'bitsize': 80, 284 'encoding': eEncodingVector, 285 'format': eFormatVectorOfUInt8}, 286 {'name': 'stmm2', 287 'set': 1, 288 'bitsize': 80, 289 'encoding': eEncodingVector, 290 'format': eFormatVectorOfUInt8}, 291 {'name': 'stmm3', 292 'set': 1, 293 'bitsize': 80, 294 'encoding': eEncodingVector, 295 'format': eFormatVectorOfUInt8}, 296 {'name': 'stmm4', 297 'set': 1, 298 'bitsize': 80, 299 'encoding': eEncodingVector, 300 'format': eFormatVectorOfUInt8}, 301 {'name': 'stmm5', 302 'set': 1, 303 'bitsize': 80, 304 'encoding': eEncodingVector, 305 'format': eFormatVectorOfUInt8}, 306 {'name': 'stmm6', 307 'set': 1, 308 'bitsize': 80, 309 'encoding': eEncodingVector, 310 'format': eFormatVectorOfUInt8}, 311 {'name': 'stmm7', 312 'set': 1, 313 'bitsize': 80, 314 'encoding': eEncodingVector, 315 'format': eFormatVectorOfUInt8}, 316 {'name': 'fctrl', 'set': 1, 'bitsize': 32, 317 'encoding': eEncodingUint, 'format': eFormatHex}, 318 {'name': 'fstat', 'set': 1, 'bitsize': 32, 319 'encoding': eEncodingUint, 'format': eFormatHex}, 320 {'name': 'ftag', 'set': 1, 'bitsize': 32, 321 'encoding': eEncodingUint, 'format': eFormatHex}, 322 {'name': 'fiseg', 'set': 1, 'bitsize': 32, 323 'encoding': eEncodingUint, 'format': eFormatHex}, 324 {'name': 'fioff', 'set': 1, 'bitsize': 32, 325 'encoding': eEncodingUint, 'format': eFormatHex}, 326 {'name': 'foseg', 'set': 1, 'bitsize': 32, 327 'encoding': eEncodingUint, 'format': eFormatHex}, 328 {'name': 'fooff', 'set': 1, 'bitsize': 32, 329 'encoding': eEncodingUint, 'format': eFormatHex}, 330 {'name': 'fop', 'set': 1, 'bitsize': 32, 331 'encoding': eEncodingUint, 'format': eFormatHex}, 332 {'name': 'xmm0', 333 'set': 1, 334 'bitsize': 128, 335 'encoding': eEncodingVector, 336 'format': eFormatVectorOfUInt8}, 337 {'name': 'xmm1', 338 'set': 1, 339 'bitsize': 128, 340 'encoding': eEncodingVector, 341 'format': eFormatVectorOfUInt8}, 342 {'name': 'xmm2', 343 'set': 1, 344 'bitsize': 128, 345 'encoding': eEncodingVector, 346 'format': eFormatVectorOfUInt8}, 347 {'name': 'xmm3', 348 'set': 1, 349 'bitsize': 128, 350 'encoding': eEncodingVector, 351 'format': eFormatVectorOfUInt8}, 352 {'name': 'xmm4', 353 'set': 1, 354 'bitsize': 128, 355 'encoding': eEncodingVector, 356 'format': eFormatVectorOfUInt8}, 357 {'name': 'xmm5', 358 'set': 1, 359 'bitsize': 128, 360 'encoding': eEncodingVector, 361 'format': eFormatVectorOfUInt8}, 362 {'name': 'xmm6', 363 'set': 1, 364 'bitsize': 128, 365 'encoding': eEncodingVector, 366 'format': eFormatVectorOfUInt8}, 367 {'name': 'xmm7', 368 'set': 1, 369 'bitsize': 128, 370 'encoding': eEncodingVector, 371 'format': eFormatVectorOfUInt8}, 372 {'name': 'xmm8', 373 'set': 1, 374 'bitsize': 128, 375 'encoding': eEncodingVector, 376 'format': eFormatVectorOfUInt8}, 377 {'name': 'xmm9', 378 'set': 1, 379 'bitsize': 128, 380 'encoding': eEncodingVector, 381 'format': eFormatVectorOfUInt8}, 382 {'name': 'xmm10', 383 'set': 1, 384 'bitsize': 128, 385 'encoding': eEncodingVector, 386 'format': eFormatVectorOfUInt8}, 387 {'name': 'xmm11', 388 'set': 1, 389 'bitsize': 128, 390 'encoding': eEncodingVector, 391 'format': eFormatVectorOfUInt8}, 392 {'name': 'xmm12', 393 'set': 1, 394 'bitsize': 128, 395 'encoding': eEncodingVector, 396 'format': eFormatVectorOfUInt8}, 397 {'name': 'xmm13', 398 'set': 1, 399 'bitsize': 128, 400 'encoding': eEncodingVector, 401 'format': eFormatVectorOfUInt8}, 402 {'name': 'xmm14', 403 'set': 1, 404 'bitsize': 128, 405 'encoding': eEncodingVector, 406 'format': eFormatVectorOfUInt8}, 407 {'name': 'xmm15', 408 'set': 1, 409 'bitsize': 128, 410 'encoding': eEncodingVector, 411 'format': eFormatVectorOfUInt8}, 412 {'name': 'mxcsr', 'set': 1, 'bitsize': 32, 413 'encoding': eEncodingUint, 'format': eFormatHex}, 414 # Registers that are contained in or composed of one of more other 415 # registers 416 {'name': 'eax', 417 'set': 0, 418 'bitsize': 32, 419 'encoding': eEncodingUint, 420 'format': eFormatHex, 421 'slice': 'rax[31:0]'}, 422 {'name': 'ebx', 423 'set': 0, 424 'bitsize': 32, 425 'encoding': eEncodingUint, 426 'format': eFormatHex, 427 'slice': 'rbx[31:0]'}, 428 {'name': 'ecx', 429 'set': 0, 430 'bitsize': 32, 431 'encoding': eEncodingUint, 432 'format': eFormatHex, 433 'slice': 'rcx[31:0]'}, 434 {'name': 'edx', 435 'set': 0, 436 'bitsize': 32, 437 'encoding': eEncodingUint, 438 'format': eFormatHex, 439 'slice': 'rdx[31:0]'}, 440 {'name': 'edi', 441 'set': 0, 442 'bitsize': 32, 443 'encoding': eEncodingUint, 444 'format': eFormatHex, 445 'slice': 'rdi[31:0]'}, 446 {'name': 'esi', 447 'set': 0, 448 'bitsize': 32, 449 'encoding': eEncodingUint, 450 'format': eFormatHex, 451 'slice': 'rsi[31:0]'}, 452 {'name': 'ebp', 453 'set': 0, 454 'bitsize': 32, 455 'encoding': eEncodingUint, 456 'format': eFormatHex, 457 'slice': 'rbp[31:0]'}, 458 {'name': 'esp', 459 'set': 0, 460 'bitsize': 32, 461 'encoding': eEncodingUint, 462 'format': eFormatHex, 463 'slice': 'rsp[31:0]'}, 464 {'name': 'r8d', 465 'set': 0, 466 'bitsize': 32, 467 'encoding': eEncodingUint, 468 'format': eFormatHex, 469 'slice': 'r8[31:0]'}, 470 {'name': 'r9d', 471 'set': 0, 472 'bitsize': 32, 473 'encoding': eEncodingUint, 474 'format': eFormatHex, 475 'slice': 'r9[31:0]'}, 476 {'name': 'r10d', 477 'set': 0, 478 'bitsize': 32, 479 'encoding': eEncodingUint, 480 'format': eFormatHex, 481 'slice': 'r10[31:0]'}, 482 {'name': 'r11d', 483 'set': 0, 484 'bitsize': 32, 485 'encoding': eEncodingUint, 486 'format': eFormatHex, 487 'slice': 'r11[31:0]'}, 488 {'name': 'r12d', 489 'set': 0, 490 'bitsize': 32, 491 'encoding': eEncodingUint, 492 'format': eFormatHex, 493 'slice': 'r12[31:0]'}, 494 {'name': 'r13d', 495 'set': 0, 496 'bitsize': 32, 497 'encoding': eEncodingUint, 498 'format': eFormatHex, 499 'slice': 'r13[31:0]'}, 500 {'name': 'r14d', 501 'set': 0, 502 'bitsize': 32, 503 'encoding': eEncodingUint, 504 'format': eFormatHex, 505 'slice': 'r14[31:0]'}, 506 {'name': 'r15d', 507 'set': 0, 508 'bitsize': 32, 509 'encoding': eEncodingUint, 510 'format': eFormatHex, 511 'slice': 'r15[31:0]'}, 512 513 {'name': 'ax', 514 'set': 0, 515 'bitsize': 16, 516 'encoding': eEncodingUint, 517 'format': eFormatHex, 518 'slice': 'rax[15:0]'}, 519 {'name': 'bx', 520 'set': 0, 521 'bitsize': 16, 522 'encoding': eEncodingUint, 523 'format': eFormatHex, 524 'slice': 'rbx[15:0]'}, 525 {'name': 'cx', 526 'set': 0, 527 'bitsize': 16, 528 'encoding': eEncodingUint, 529 'format': eFormatHex, 530 'slice': 'rcx[15:0]'}, 531 {'name': 'dx', 532 'set': 0, 533 'bitsize': 16, 534 'encoding': eEncodingUint, 535 'format': eFormatHex, 536 'slice': 'rdx[15:0]'}, 537 {'name': 'di', 538 'set': 0, 539 'bitsize': 16, 540 'encoding': eEncodingUint, 541 'format': eFormatHex, 542 'slice': 'rdi[15:0]'}, 543 {'name': 'si', 544 'set': 0, 545 'bitsize': 16, 546 'encoding': eEncodingUint, 547 'format': eFormatHex, 548 'slice': 'rsi[15:0]'}, 549 {'name': 'bp', 550 'set': 0, 551 'bitsize': 16, 552 'encoding': eEncodingUint, 553 'format': eFormatHex, 554 'slice': 'rbp[15:0]'}, 555 {'name': 'sp', 556 'set': 0, 557 'bitsize': 16, 558 'encoding': eEncodingUint, 559 'format': eFormatHex, 560 'slice': 'rsp[15:0]'}, 561 {'name': 'r8w', 562 'set': 0, 563 'bitsize': 16, 564 'encoding': eEncodingUint, 565 'format': eFormatHex, 566 'slice': 'r8[15:0]'}, 567 {'name': 'r9w', 568 'set': 0, 569 'bitsize': 16, 570 'encoding': eEncodingUint, 571 'format': eFormatHex, 572 'slice': 'r9[15:0]'}, 573 {'name': 'r10w', 574 'set': 0, 575 'bitsize': 16, 576 'encoding': eEncodingUint, 577 'format': eFormatHex, 578 'slice': 'r10[15:0]'}, 579 {'name': 'r11w', 580 'set': 0, 581 'bitsize': 16, 582 'encoding': eEncodingUint, 583 'format': eFormatHex, 584 'slice': 'r11[15:0]'}, 585 {'name': 'r12w', 586 'set': 0, 587 'bitsize': 16, 588 'encoding': eEncodingUint, 589 'format': eFormatHex, 590 'slice': 'r12[15:0]'}, 591 {'name': 'r13w', 592 'set': 0, 593 'bitsize': 16, 594 'encoding': eEncodingUint, 595 'format': eFormatHex, 596 'slice': 'r13[15:0]'}, 597 {'name': 'r14w', 598 'set': 0, 599 'bitsize': 16, 600 'encoding': eEncodingUint, 601 'format': eFormatHex, 602 'slice': 'r14[15:0]'}, 603 {'name': 'r15w', 604 'set': 0, 605 'bitsize': 16, 606 'encoding': eEncodingUint, 607 'format': eFormatHex, 608 'slice': 'r15[15:0]'}, 609 610 {'name': 'ah', 611 'set': 0, 612 'bitsize': 8, 613 'encoding': eEncodingUint, 614 'format': eFormatHex, 615 'slice': 'rax[15:8]'}, 616 {'name': 'bh', 617 'set': 0, 618 'bitsize': 8, 619 'encoding': eEncodingUint, 620 'format': eFormatHex, 621 'slice': 'rbx[15:8]'}, 622 {'name': 'ch', 623 'set': 0, 624 'bitsize': 8, 625 'encoding': eEncodingUint, 626 'format': eFormatHex, 627 'slice': 'rcx[15:8]'}, 628 {'name': 'dh', 629 'set': 0, 630 'bitsize': 8, 631 'encoding': eEncodingUint, 632 'format': eFormatHex, 633 'slice': 'rdx[15:8]'}, 634 635 {'name': 'al', 636 'set': 0, 637 'bitsize': 8, 638 'encoding': eEncodingUint, 639 'format': eFormatHex, 640 'slice': 'rax[7:0]'}, 641 {'name': 'bl', 642 'set': 0, 643 'bitsize': 8, 644 'encoding': eEncodingUint, 645 'format': eFormatHex, 646 'slice': 'rbx[7:0]'}, 647 {'name': 'cl', 648 'set': 0, 649 'bitsize': 8, 650 'encoding': eEncodingUint, 651 'format': eFormatHex, 652 'slice': 'rcx[7:0]'}, 653 {'name': 'dl', 654 'set': 0, 655 'bitsize': 8, 656 'encoding': eEncodingUint, 657 'format': eFormatHex, 658 'slice': 'rdx[7:0]'}, 659 {'name': 'dil', 660 'set': 0, 661 'bitsize': 8, 662 'encoding': eEncodingUint, 663 'format': eFormatHex, 664 'slice': 'rdi[7:0]'}, 665 {'name': 'sil', 666 'set': 0, 667 'bitsize': 8, 668 'encoding': eEncodingUint, 669 'format': eFormatHex, 670 'slice': 'rsi[7:0]'}, 671 {'name': 'bpl', 672 'set': 0, 673 'bitsize': 8, 674 'encoding': eEncodingUint, 675 'format': eFormatHex, 676 'slice': 'rbp[7:0]'}, 677 {'name': 'spl', 678 'set': 0, 679 'bitsize': 8, 680 'encoding': eEncodingUint, 681 'format': eFormatHex, 682 'slice': 'rsp[7:0]'}, 683 {'name': 'r8l', 684 'set': 0, 685 'bitsize': 8, 686 'encoding': eEncodingUint, 687 'format': eFormatHex, 688 'slice': 'r8[7:0]'}, 689 {'name': 'r9l', 690 'set': 0, 691 'bitsize': 8, 692 'encoding': eEncodingUint, 693 'format': eFormatHex, 694 'slice': 'r9[7:0]'}, 695 {'name': 'r10l', 696 'set': 0, 697 'bitsize': 8, 698 'encoding': eEncodingUint, 699 'format': eFormatHex, 700 'slice': 'r10[7:0]'}, 701 {'name': 'r11l', 702 'set': 0, 703 'bitsize': 8, 704 'encoding': eEncodingUint, 705 'format': eFormatHex, 706 'slice': 'r11[7:0]'}, 707 {'name': 'r12l', 708 'set': 0, 709 'bitsize': 8, 710 'encoding': eEncodingUint, 711 'format': eFormatHex, 712 'slice': 'r12[7:0]'}, 713 {'name': 'r13l', 714 'set': 0, 715 'bitsize': 8, 716 'encoding': eEncodingUint, 717 'format': eFormatHex, 718 'slice': 'r13[7:0]'}, 719 {'name': 'r14l', 720 'set': 0, 721 'bitsize': 8, 722 'encoding': eEncodingUint, 723 'format': eFormatHex, 724 'slice': 'r14[7:0]'}, 725 {'name': 'r15l', 726 'set': 0, 727 'bitsize': 8, 728 'encoding': eEncodingUint, 729 'format': eFormatHex, 730 'slice': 'r15[7:0]'}, 731] 732 733g_target_definition = None 734 735 736def get_target_definition(): 737 global g_target_definition 738 if g_target_definition is None: 739 g_target_definition = {} 740 offset = 0 741 for reg_info in x86_64_register_infos: 742 reg_name = reg_info['name'] 743 744 # Only fill in the offset if there is no 'slice' in the register 745 # info 746 if 'slice' not in reg_info and 'composite' not in reg_info: 747 reg_info['offset'] = offset 748 offset += reg_info['bitsize'] / 8 749 750 # Set the GCC/DWARF register number for this register if it has one 751 reg_num = get_reg_num(name_to_gcc_dwarf_regnum, reg_name) 752 if reg_num != LLDB_INVALID_REGNUM: 753 reg_info['gcc'] = reg_num 754 reg_info['dwarf'] = reg_num 755 756 # Set the generic register number for this register if it has one 757 reg_num = get_reg_num(name_to_generic_regnum, reg_name) 758 if reg_num != LLDB_INVALID_REGNUM: 759 reg_info['generic'] = reg_num 760 761 # Set the GDB register number for this register if it has one 762 reg_num = get_reg_num(name_to_gdb_regnum, reg_name) 763 if reg_num != LLDB_INVALID_REGNUM: 764 reg_info['gdb'] = reg_num 765 766 g_target_definition['sets'] = [ 767 'General Purpose Registers', 768 'Floating Point Registers'] 769 g_target_definition['registers'] = x86_64_register_infos 770 g_target_definition[ 771 'host-info'] = {'triple': 'x86_64-apple-macosx', 'endian': eByteOrderLittle} 772 g_target_definition['g-packet-size'] = offset 773 return g_target_definition 774 775 776def get_dynamic_setting(target, setting_name): 777 if setting_name == 'gdb-server-target-definition': 778 return get_target_definition() 779