[Lldb-commits] [lldb] [llvm] [lldb][Process/FreeBSD] Add riscv64 support (PR #180549)
David Spickett via lldb-commits
lldb-commits at lists.llvm.org
Tue Feb 10 07:46:08 PST 2026
================
@@ -0,0 +1,81 @@
+//===-- NativeRegisterContextFreeBSD_riscv64.h --------------------*- C++
+//-*-===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+#if defined(__riscv) && __riscv_xlen == 64
+
+#ifndef lldb_NativeRegisterContextFreeBSD_riscv64_h
+#define lldb_NativeRegisterContextFreeBSD_riscv64_h
+
+// clang-format off
+#include <sys/types.h>
+#include <sys/param.h>
+#include <machine/reg.h>
+// clang-format on
+
+#include "Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD.h"
+#include "Plugins/Process/Utility/RegisterInfoPOSIX_riscv64.h"
+
+namespace lldb_private {
+namespace process_freebsd {
+
+class NativeRegisterContextFreeBSD_riscv64
+ : public NativeRegisterContextFreeBSD {
+public:
+ NativeRegisterContextFreeBSD_riscv64(const ArchSpec &target_arch,
+ NativeThreadFreeBSD &native_thread);
+
+ uint32_t GetRegisterSetCount() const override;
+ uint32_t GetUserRegisterCount() const override;
+ const RegisterSet *GetRegisterSet(uint32_t set_index) const override;
+
+ Status ReadRegister(const RegisterInfo *reg_info,
+ RegisterValue ®_value) override;
+ Status WriteRegister(const RegisterInfo *reg_info,
+ const RegisterValue ®_value) override;
+ Status ReadAllRegisterValues(lldb::WritableDataBufferSP &data_sp) override;
+ Status WriteAllRegisterValues(const lldb::DataBufferSP &data_sp) override;
+
+ void InvalidateAllRegisters() override;
+
+private:
+ // FreeBSD's native register structures
+ struct reg m_gpr;
+ struct fpreg m_fpr;
+
+ bool m_gpr_is_valid;
+ bool m_fpr_is_valid;
+
+ // Ptrace wrappers
+ Status ReadGPR();
+ Status WriteGPR();
+ Status ReadFPR();
+ Status WriteFPR();
+
+ // Conversion functions between FreeBSD and POSIX layouts
----------------
DavidSpickett wrote:
At this point all I can say is try making a RegisterContextFreeBSD_riscv64 and see if it's viable.
I need some time to understand exactly what the LLDB layout is and is used for.
https://github.com/llvm/llvm-project/pull/180549
More information about the lldb-commits
mailing list