[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:07:23 PDT 2026
https://github.com/felipepiovezan created https://github.com/llvm/llvm-project/pull/208643
LLDB currently fails to find TLS variables on Linux, and this is part of the problem.
>From d30d49c352f358afc51f12d2cab1683659d42563 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 | 16 ++++++++++++++++
2 files changed, 17 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..b8a9886dbb7c4 100644
--- a/lldb/unittests/ABI/AArch64/ABIAArch64Test.cpp
+++ b/lldb/unittests/ABI/AArch64/ABIAArch64Test.cpp
@@ -66,6 +66,22 @@ 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, 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