[Lldb-commits] [lldb] [lldb] Implement LLDB_REGNUM_GENERIC_TP convertion for Aarch64 (PR #208643)
Felipe de Azevedo Piovezan via lldb-commits
lldb-commits at lists.llvm.org
Fri Jul 10 01:22:43 PDT 2026
https://github.com/felipepiovezan updated https://github.com/llvm/llvm-project/pull/208643
>From a4603f681c35fb6de5baa417f8a486d752cbc6b6 Mon Sep 17 00:00:00 2001
From: Felipe de Azevedo Piovezan <fpiovezan at apple.com>
Date: Mon, 6 Jul 2026 13:04:21 +0100
Subject: [PATCH] [lldb] Implement LLDB_REGNUM_GENERIC_TP convertion for
Aarch64
LLDB currently fails to find TLS variables on Linux, and this is part of
the problem.
---
lldb/source/Plugins/ABI/AArch64/ABIAArch64.cpp | 1 +
lldb/unittests/ABI/AArch64/ABIAArch64Test.cpp | 17 +++++++++++++++++
2 files changed, 18 insertions(+)
diff --git a/lldb/source/Plugins/ABI/AArch64/ABIAArch64.cpp b/lldb/source/Plugins/ABI/AArch64/ABIAArch64.cpp
index 72d03e2348e59..8226bb6aea424 100644
--- a/lldb/source/Plugins/ABI/AArch64/ABIAArch64.cpp
+++ b/lldb/source/Plugins/ABI/AArch64/ABIAArch64.cpp
@@ -88,6 +88,7 @@ uint32_t ABIAArch64::GetGenericNum(llvm::StringRef name) {
.Cases({"sp", "x31"}, LLDB_REGNUM_GENERIC_SP)
.Cases({"fp", "x29"}, LLDB_REGNUM_GENERIC_FP)
.Case("cpsr", LLDB_REGNUM_GENERIC_FLAGS)
+ .Case("tpidr", LLDB_REGNUM_GENERIC_TP)
.Case("x0", LLDB_REGNUM_GENERIC_ARG1)
.Case("x1", LLDB_REGNUM_GENERIC_ARG2)
.Case("x2", LLDB_REGNUM_GENERIC_ARG3)
diff --git a/lldb/unittests/ABI/AArch64/ABIAArch64Test.cpp b/lldb/unittests/ABI/AArch64/ABIAArch64Test.cpp
index 5f9332e3e85bd..06176de68a336 100644
--- a/lldb/unittests/ABI/AArch64/ABIAArch64Test.cpp
+++ b/lldb/unittests/ABI/AArch64/ABIAArch64Test.cpp
@@ -66,6 +66,23 @@ TEST_P(ABIAArch64TestFixture, AugmentRegisterInfo) {
EXPECT_EQ(new_pc.regnum_dwarf, arm64_dwarf::pc);
}
+TEST_P(ABIAArch64TestFixture, AugmentRegisterInfoThreadPointer) {
+ ABISP abi_sp = ABI::FindPlugin(ProcessSP(), ArchSpec(GetParam()));
+ ASSERT_TRUE(abi_sp);
+ using Register = DynamicRegisterInfo::Register;
+
+ Register tpidr;
+ tpidr.name = ConstString("tpidr");
+ tpidr.set_name = ConstString("GPR");
+ std::vector<Register> regs{tpidr};
+
+ abi_sp->AugmentRegisterInfo(regs);
+
+ ASSERT_EQ(regs.size(), 1U);
+ EXPECT_EQ(regs[0].regnum_generic,
+ static_cast<uint32_t>(LLDB_REGNUM_GENERIC_TP));
+}
+
INSTANTIATE_TEST_SUITE_P(ABIAArch64Tests, ABIAArch64TestFixture,
testing::Values("aarch64-pc-linux",
"arm64-apple-macosx"));
More information about the lldb-commits
mailing list