- Timestamp:
- Apr 15, 2021, 2:58:49 PM (4 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 84cd72d
- Parents:
- 76c94bf
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tools/gdb/utils-gdb.py
r76c94bf rc0c0bd5 480 480 context = thread['context'] 481 481 482 483 484 # must be at frame 0 to set pc register 485 gdb.execute('select-frame 0') 486 if gdb.selected_frame().architecture().name() != 'i386:x86-64': 487 print('gdb debugging only supported for i386:x86-64 for now') 488 return 489 490 # gdb seems to handle things much better if we pretend we just entered the context switch 491 # pretend the pc is __cfactx_switch and adjust the sp, base pointer doesn't need to change 482 492 # lookup for sp,fp and uSwitch 483 xsp = context['SP'] + 4 8493 xsp = context['SP'] + 40 # 40 = 5 64bit registers : %r15, %r14, %r13, %r12, %rbx WARNING: x64 specific 484 494 xfp = context['FP'] 485 495 486 496 # convert string so we can strip out the address 487 497 try: 488 xpc = get_addr(gdb.parse_and_eval('__cfactx_switch').address + 28)498 xpc = get_addr(gdb.parse_and_eval('__cfactx_switch').address) 489 499 except: 490 500 print("here") 491 501 return 492 493 # must be at frame 0 to set pc register494 gdb.execute('select-frame 0')495 502 496 503 # push sp, fp, pc into a global stack … … 503 510 504 511 # update registers for new task 505 print('switching to ') 512 # print('switching to {} ({}) : [{}, {}, {}]'.format(thread['self_cor']['name'].string(), str(thread), str(xsp), str(xfp), str(xpc))) 513 print('switching to thread {} ({})'.format(str(thread), thread['self_cor']['name'].string())) 506 514 gdb.execute('set $rsp={}'.format(xsp)) 507 515 gdb.execute('set $rbp={}'.format(xfp)) … … 552 560 553 561 argv = parse(arg) 554 print(argv)555 562 if argv[0].isdigit(): 556 563 cname = " ".join(argv[1:]) if len(argv) > 1 else None
Note: See TracChangeset
for help on using the changeset viewer.