summaryrefslogtreecommitdiff
path: root/plugins/rtti/itanium.cpp
diff options
context:
space:
mode:
authorMason Reed <mason@vector35.com>2024-12-03 16:55:52 -0500
committerMason Reed <mason@vector35.com>2025-03-19 21:17:34 -0400
commit7794bcfa9f8c51442a87f10a3475612dfc4435d8 (patch)
treed72744abb0318f65764eef0f4640ecfccfcaf7f6 /plugins/rtti/itanium.cpp
parent9ff2b8d804a34941a6085af85b6749c20549240e (diff)
Handle relocated itanium ABI base vtables
Diffstat (limited to 'plugins/rtti/itanium.cpp')
-rw-r--r--plugins/rtti/itanium.cpp29
1 files changed, 8 insertions, 21 deletions
diff --git a/plugins/rtti/itanium.cpp b/plugins/rtti/itanium.cpp
index cd80b7f9..f7ad9a70 100644
--- a/plugins/rtti/itanium.cpp
+++ b/plugins/rtti/itanium.cpp
@@ -208,14 +208,17 @@ std::optional<TypeInfoVariant> ReadTypeInfoVariant(BinaryView *view, uint64_t ob
// If there is a symbol at objectAddr pointing to a symbol starting with "vtable for __cxxabiv1"
auto baseSym = view->GetSymbolByAddress(typeInfo.base);
if (baseSym == nullptr)
- return std::nullopt;
+ {
+ // Check relocation at objectAddr for symbol
+ for (const auto& r : view->GetRelocationsAt(objectAddr))
+ if (auto relocSym = r->GetSymbol())
+ baseSym = relocSym;
+ if (baseSym == nullptr)
+ return std::nullopt;
+ }
if (baseSym->GetType() != ExternalSymbol)
return std::nullopt;
auto baseSymName = baseSym->GetShortName();
-
- // TODO: __vmi_class_type_info seems to point to operator delete(void*)
- // TODO: For now we just bruteforce it with the type_name check...
-
if (baseSymName.find("__cxxabiv1") != std::string::npos)
{
// symbol takes the form of `abi::base_name`
@@ -230,22 +233,6 @@ std::optional<TypeInfoVariant> ReadTypeInfoVariant(BinaryView *view, uint64_t ob
if (baseSymName == "__vmi_class_type_info")
return TIVVMIClass;
}
- else if (typeInfo.type_name.length() > 2)
- {
- // TODO: This is so ugly
- switch (typeInfo.type_name.at(0))
- {
- case '7':
- return TIVClass;
- case '9':
- return TIVSIClass;
- case '1':
- if (typeInfo.type_name.at(1) == '4')
- return TIVVMIClass;
- default:
- return std::nullopt;
- }
- }
return std::nullopt;
}