================ @@ -0,0 +1,107 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +/// +/// \file +/// This file contains the definition of the RegisterContextFreeBSDKernel_arm +/// class, which is used for reading registers from PCB on arm kernel dump. +/// +//===----------------------------------------------------------------------===// + +#include "RegisterContextFreeBSDKernel_arm.h" +#include "Plugins/Process/Utility/lldb-arm-register-enums.h" + +#include "lldb/Target/Process.h" +#include "lldb/Target/Thread.h" +#include "lldb/Utility/RegisterValue.h" +#include "llvm/Support/Endian.h" + +using namespace lldb; +using namespace lldb_private; + +RegisterContextFreeBSDKernel_arm::RegisterContextFreeBSDKernel_arm( + Thread &thread, std::unique_ptr<RegisterInfoPOSIX_arm> register_info_up, + lldb::addr_t pcb_addr) + : RegisterContextPOSIX_arm(thread, std::move(register_info_up)), + m_pcb_addr(pcb_addr) {} + +bool RegisterContextFreeBSDKernel_arm::ReadGPR() { return true; } + +bool RegisterContextFreeBSDKernel_arm::ReadFPR() { return true; } + +bool RegisterContextFreeBSDKernel_arm::WriteGPR() { + assert(0); + return false; +} + +bool RegisterContextFreeBSDKernel_arm::WriteFPR() { + assert(0); + return false; +} + +bool RegisterContextFreeBSDKernel_arm::ReadRegister( + const RegisterInfo *reg_info, RegisterValue &value) { + if (m_pcb_addr == LLDB_INVALID_ADDRESS) + return false; + + // https://cgit.freebsd.org/src/tree/sys/arm/include/frame.h + // struct pcb's first field is struct switchframe which is the only field used + // by debugger and should be aligned by 8 bytes. + struct { + llvm::support::ulittle32_t r4; + llvm::support::ulittle32_t r5; + llvm::support::ulittle32_t r6; + llvm::support::ulittle32_t r7; + llvm::support::ulittle32_t r8; + llvm::support::ulittle32_t r9; + llvm::support::ulittle32_t r10; + llvm::support::ulittle64_t r11; + llvm::support::ulittle64_t r12; + llvm::support::ulittle64_t sp; + llvm::support::ulittle64_t lr; + llvm::support::ulittle64_t pc; + } pcb; ---------------- DavidSpickett wrote:
Maybe this applies to the other platforms but I'm not going to go looking. ARM is my home turf so I'm being a bit more pedantic here :) The others don't need to be changed. https://github.com/llvm/llvm-project/pull/180674 _______________________________________________ lldb-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
