diff options
author | ASOU Masato <asou@cvs.openbsd.org> | 2024-10-31 07:37:36 +0000 |
---|---|---|
committer | ASOU Masato <asou@cvs.openbsd.org> | 2024-10-31 07:37:36 +0000 |
commit | e4b96e716dac3c504e974dc4043d0ccb98c11c2e (patch) | |
tree | f78e55b021d4bc9076a697654a9e2d0260fa920a /gnu | |
parent | 416db1d1cdb05a4adc981e54c9fea22c819720ca (diff) |
Correct display stack pointer of the kernel core. From Yuichiro NAITO.
ok asou
Diffstat (limited to 'gnu')
3 files changed, 16 insertions, 13 deletions
diff --git a/gnu/llvm/lldb/source/Plugins/Process/OpenBSDKernel/RegisterContextOpenBSDKernel_arm64.cpp b/gnu/llvm/lldb/source/Plugins/Process/OpenBSDKernel/RegisterContextOpenBSDKernel_arm64.cpp index 1ebfc6a799f..34fc8067203 100644 --- a/gnu/llvm/lldb/source/Plugins/Process/OpenBSDKernel/RegisterContextOpenBSDKernel_arm64.cpp +++ b/gnu/llvm/lldb/source/Plugins/Process/OpenBSDKernel/RegisterContextOpenBSDKernel_arm64.cpp @@ -91,7 +91,7 @@ bool RegisterContextOpenBSDKernel_arm64::ReadRegister( value = (u_int64_t)sf.sf_x29; return true; case gpr_sp_arm64: - value = (u_int64_t)pcb.pcb_sp; + value = (u_int64_t)(pcb.pcb_sp + sizeof(sf)); return true; case gpr_pc_arm64: value = (u_int64_t)sf.sf_lr; diff --git a/gnu/llvm/lldb/source/Plugins/Process/OpenBSDKernel/RegisterContextOpenBSDKernel_i386.cpp b/gnu/llvm/lldb/source/Plugins/Process/OpenBSDKernel/RegisterContextOpenBSDKernel_i386.cpp index 9a909a4e07d..fc644df23a4 100644 --- a/gnu/llvm/lldb/source/Plugins/Process/OpenBSDKernel/RegisterContextOpenBSDKernel_i386.cpp +++ b/gnu/llvm/lldb/source/Plugins/Process/OpenBSDKernel/RegisterContextOpenBSDKernel_i386.cpp @@ -62,12 +62,12 @@ bool RegisterContextOpenBSDKernel_i386::ReadRegister( if ((pcb.pcb_flags & PCB_SAVECTX) != 0) { uint32_t reg = reg_info->kinds[lldb::eRegisterKindLLDB]; switch (reg) { -#define PCBREG(x) \ - case lldb_##x##_i386: \ - value = pcb.pcb_##x; \ return true; - PCBREG(ebp); - PCBREG(esp); + case lldb_esp_i386: + value = (u_int32_t)pcb.pcb_ebp; + return true; + case lldb_ebp_i386: + value = m_thread.GetProcess()->ReadPointerFromMemory(pcb.pcb_ebp, error); case lldb_eip_i386: value = m_thread.GetProcess()->ReadPointerFromMemory(pcb.pcb_ebp + 4, error); @@ -88,6 +88,10 @@ bool RegisterContextOpenBSDKernel_i386::ReadRegister( uint32_t reg = reg_info->kinds[lldb::eRegisterKindLLDB]; switch (reg) { +#define PCBREG(x, offset) \ + case lldb_##x##_i386: \ + value = (u_int32_t)(pcb.pcb_##x + (offset)); \ + return true; #define SFREG(x) \ case lldb_##x##_i386: \ value = sf.sf_##x; \ diff --git a/gnu/llvm/lldb/source/Plugins/Process/OpenBSDKernel/RegisterContextOpenBSDKernel_x86_64.cpp b/gnu/llvm/lldb/source/Plugins/Process/OpenBSDKernel/RegisterContextOpenBSDKernel_x86_64.cpp index 501fa858a92..e87b99867a9 100644 --- a/gnu/llvm/lldb/source/Plugins/Process/OpenBSDKernel/RegisterContextOpenBSDKernel_x86_64.cpp +++ b/gnu/llvm/lldb/source/Plugins/Process/OpenBSDKernel/RegisterContextOpenBSDKernel_x86_64.cpp @@ -77,9 +77,9 @@ bool RegisterContextOpenBSDKernel_x86_64::ReadRegister( case lldb_##x##_x86_64: \ value = (u_int64_t)sf.sf_##x; \ return true; -#define PCBREG(x) \ +#define PCBREG(x, offset) \ case lldb_##x##_x86_64: \ - value = pcb.pcb_##x; \ + value = pcb.pcb_##x + (offset); \ return true; switch (reg) { SFREG(r15); @@ -89,15 +89,14 @@ bool RegisterContextOpenBSDKernel_x86_64::ReadRegister( SFREG(rbp); SFREG(rbx); SFREG(rip); - PCBREG(rsp); + PCBREG(rsp, sizeof(sf)); } } else { switch (reg) { - PCBREG(rbp); - PCBREG(rsp); + PCBREG(rbp, 0); + PCBREG(rsp, 8); case lldb_rip_x86_64: - value = m_thread.GetProcess()->ReadPointerFromMemory(pcb.pcb_rbp + 8, - error); + value = m_thread.GetProcess()->ReadPointerFromMemory(pcb.pcb_rbp, error); return true; } } |