[Lldb-commits] [lldb] e4b9301 - [lldb] Move dynamic type cache to common ABI runtime (#212014)
via lldb-commits
lldb-commits at lists.llvm.org
Sat Aug 8 02:09:38 PDT 2026
Author: Nerixyz
Date: 2026-08-08T11:09:31+02:00
New Revision: e4b930171eb8e0085f82f1c99b2d1b89891c2706
URL: https://github.com/llvm/llvm-project/commit/e4b930171eb8e0085f82f1c99b2d1b89891c2706
DIFF: https://github.com/llvm/llvm-project/commit/e4b930171eb8e0085f82f1c99b2d1b89891c2706.diff
LOG: [lldb] Move dynamic type cache to common ABI runtime (#212014)
Both the Itanium and the MS ABI want some cache for dynamic types. This
moves the functionality from the Itanium ABI to the base class.
Added:
Modified:
lldb/source/Plugins/LanguageRuntime/CPlusPlus/CommonABIRuntime.cpp
lldb/source/Plugins/LanguageRuntime/CPlusPlus/CommonABIRuntime.h
lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABIRuntime.cpp
lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABIRuntime.h
Removed:
################################################################################
diff --git a/lldb/source/Plugins/LanguageRuntime/CPlusPlus/CommonABIRuntime.cpp b/lldb/source/Plugins/LanguageRuntime/CPlusPlus/CommonABIRuntime.cpp
index f72ad0460bf29..d0496965650c6 100644
--- a/lldb/source/Plugins/LanguageRuntime/CPlusPlus/CommonABIRuntime.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/CPlusPlus/CommonABIRuntime.cpp
@@ -98,3 +98,19 @@ lldb::TypeSP CommonABIRuntime::LookupTypeByName(llvm::StringRef type_name,
type_name);
return {};
}
+
+TypeAndOrName
+CommonABIRuntime::GetDynamicTypeInfo(const lldb_private::Address &vtable_addr) {
+ std::lock_guard<std::mutex> locker(m_mutex);
+ DynamicTypeCache::const_iterator pos = m_dynamic_type_map.find(vtable_addr);
+ if (pos == m_dynamic_type_map.end())
+ return TypeAndOrName();
+
+ return pos->second;
+}
+
+void CommonABIRuntime::SetDynamicTypeInfo(
+ const lldb_private::Address &vtable_addr, const TypeAndOrName &type_info) {
+ std::lock_guard<std::mutex> locker(m_mutex);
+ m_dynamic_type_map[vtable_addr] = type_info;
+}
diff --git a/lldb/source/Plugins/LanguageRuntime/CPlusPlus/CommonABIRuntime.h b/lldb/source/Plugins/LanguageRuntime/CPlusPlus/CommonABIRuntime.h
index 961e9c9606c51..54d44caa2ebbc 100644
--- a/lldb/source/Plugins/LanguageRuntime/CPlusPlus/CommonABIRuntime.h
+++ b/lldb/source/Plugins/LanguageRuntime/CPlusPlus/CommonABIRuntime.h
@@ -11,6 +11,7 @@
#include "lldb/Target/Process.h"
+#include <map>
#include <mutex>
namespace lldb_private {
@@ -31,9 +32,19 @@ class CommonABIRuntime {
lldb::ModuleSP preferred_module,
bool &any_found) const;
+ TypeAndOrName GetDynamicTypeInfo(const lldb_private::Address &vtable_addr);
+
+ void SetDynamicTypeInfo(const lldb_private::Address &vtable_addr,
+ const TypeAndOrName &type_info);
+
protected:
Process *m_process;
std::mutex m_mutex;
+
+private:
+ using DynamicTypeCache = std::map<Address, TypeAndOrName>;
+
+ DynamicTypeCache m_dynamic_type_map;
};
} // namespace lldb_private
diff --git a/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABIRuntime.cpp b/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABIRuntime.cpp
index f09a9b40a9807..5b983878623db 100644
--- a/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABIRuntime.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABIRuntime.cpp
@@ -256,19 +256,3 @@ ItaniumABIRuntime::GetExceptionObjectForThread(ThreadSP thread_sp) {
return exception;
}
-
-TypeAndOrName ItaniumABIRuntime::GetDynamicTypeInfo(
- const lldb_private::Address &vtable_addr) {
- std::lock_guard<std::mutex> locker(m_mutex);
- DynamicTypeCache::const_iterator pos = m_dynamic_type_map.find(vtable_addr);
- if (pos == m_dynamic_type_map.end())
- return TypeAndOrName();
- else
- return pos->second;
-}
-
-void ItaniumABIRuntime::SetDynamicTypeInfo(
- const lldb_private::Address &vtable_addr, const TypeAndOrName &type_info) {
- std::lock_guard<std::mutex> locker(m_mutex);
- m_dynamic_type_map[vtable_addr] = type_info;
-}
diff --git a/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABIRuntime.h b/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABIRuntime.h
index db2dae6a2cfa9..7c4cf019ee975 100644
--- a/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABIRuntime.h
+++ b/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABIRuntime.h
@@ -42,15 +42,6 @@ class ItaniumABIRuntime : public CommonABIRuntime {
private:
TypeAndOrName GetTypeInfo(ValueObject &in_value,
const LanguageRuntime::VTableInfo &vtable_info);
-
- TypeAndOrName GetDynamicTypeInfo(const lldb_private::Address &vtable_addr);
-
- void SetDynamicTypeInfo(const lldb_private::Address &vtable_addr,
- const TypeAndOrName &type_info);
-
- using DynamicTypeCache = std::map<Address, TypeAndOrName>;
-
- DynamicTypeCache m_dynamic_type_map;
};
} // namespace lldb_private
More information about the lldb-commits
mailing list