r"""bthread_regs , print bthread registers
(debugger, command, result, internal_dict)
| 276 | |
| 277 | |
| 278 | def bthread_regs(debugger, command, result, internal_dict): |
| 279 | r"""bthread_regs <id>, print bthread registers""" |
| 280 | bthread = global_state.get_bthread(command) |
| 281 | if bthread is None: |
| 282 | return |
| 283 | target = debugger.GetSelectedTarget() |
| 284 | stack = get_child(bthread, "stack").Dereference() |
| 285 | context = get_child(stack, "context") |
| 286 | ctx_addr = context.GetValueAsUnsigned() |
| 287 | uint64_t_type = target.FindFirstType("uint64_t") |
| 288 | |
| 289 | rip = target.CreateValueFromAddress("rip", lldb.SBAddress( |
| 290 | ctx_addr + 7*8, target), uint64_t_type).GetValueAsUnsigned() |
| 291 | rbp = target.CreateValueFromAddress("rbp", lldb.SBAddress( |
| 292 | ctx_addr + 6*8, target), uint64_t_type).GetValueAsUnsigned() |
| 293 | rbx = target.CreateValueFromAddress("rbx", lldb.SBAddress( |
| 294 | ctx_addr + 5*8, target), uint64_t_type).GetValueAsUnsigned() |
| 295 | r15 = target.CreateValueFromAddress("r15", lldb.SBAddress( |
| 296 | ctx_addr + 4*8, target), uint64_t_type).GetValueAsUnsigned() |
| 297 | r14 = target.CreateValueFromAddress("r14", lldb.SBAddress( |
| 298 | ctx_addr + 3*8, target), uint64_t_type).GetValueAsUnsigned() |
| 299 | r13 = target.CreateValueFromAddress("r13", lldb.SBAddress( |
| 300 | ctx_addr + 2*8, target), uint64_t_type).GetValueAsUnsigned() |
| 301 | r12 = target.CreateValueFromAddress("r12", lldb.SBAddress( |
| 302 | ctx_addr + 1*8, target), uint64_t_type).GetValueAsUnsigned() |
| 303 | rsp = ctx_addr + 8*8 |
| 304 | |
| 305 | print("rip: 0x{:x}\nrsp: 0x{:x}\nrbp: 0x{:x}\nrbx: 0x{:x}\nr15: 0x{:x}\nr14: 0x{:x}\nr13: 0x{:x}\nr12: 0x{:x}".format( |
| 306 | rip, rsp, rbp, rbx, r15, r14, r13, r12)) |
| 307 | |
| 308 | |
| 309 | def bthread_reg_restore(debugger, command, result, internal_dict): |
nothing calls this directly
no test coverage detected