diff options
| author | Mark Rowe <mrowe@bdash.net.nz> | 2025-05-07 22:56:09 -0700 |
|---|---|---|
| committer | Mason Reed <35282038+emesare@users.noreply.github.com> | 2025-05-09 21:04:50 -0400 |
| commit | 79ef475f51d21d83dcc5a6e3e5b6b40cac616cc7 (patch) | |
| tree | 8b9fe382474b449f2600803ae850dd0dd20a19dc /objectivec/objc.cpp | |
| parent | 4f35a5bb156c2744083d1ce2cf7f04609984dd52 (diff) | |
[ObjC] Retrieve category's class name when class is an external symbol
This also updates the symbol names that are generated when the name
cannot be found to include the address in hex rather than decimal so
it's easier to navigate to.
Diffstat (limited to 'objectivec/objc.cpp')
| -rw-r--r-- | objectivec/objc.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/objectivec/objc.cpp b/objectivec/objc.cpp index 9bdd61c3..acfdbe53 100644 --- a/objectivec/objc.cpp +++ b/objectivec/objc.cpp @@ -583,7 +583,8 @@ void ObjCProcessor::LoadCategories(ObjCReader* reader, Ref<Section> classPtrSect } else if (const auto symbol = GetSymbol(cat.cls)) { - if (symbol->GetType() == ImportedDataSymbol || symbol->GetType() == ImportAddressSymbol || symbol->GetType() == DataSymbol) + if (symbol->GetType() == ImportedDataSymbol || symbol->GetType() == ImportAddressSymbol + || symbol->GetType() == DataSymbol || symbol->GetType() == ExternalSymbol) { // Symbols named `_OBJC_CLASS_$_` are references to external classes. // Symbols named `cls_` are classes defined in a loaded image other than @@ -601,7 +602,7 @@ void ObjCProcessor::LoadCategories(ObjCReader* reader, Ref<Section> classPtrSect m_logger->LogInfo( "[SharedCache.ObjC] Using base address as stand-in classname for category at 0x%llx", catLocation); - categoryBaseClassName = std::to_string(catLocation); + categoryBaseClassName = fmt::format("{:x}", catLocation); } try { @@ -613,7 +614,7 @@ void ObjCProcessor::LoadCategories(ObjCReader* reader, Ref<Section> classPtrSect m_logger->LogWarn( "Failed to read category name for category at 0x%llx. Using base address as stand-in category name", catLocation); - categoryAdditionsName = std::to_string(catLocation); + categoryAdditionsName = fmt::format("{:x}", catLocation); } category.name = categoryBaseClassName + " (" + categoryAdditionsName + ")"; DefineObjCSymbol(BNSymbolType::DataSymbol, ptrType, "categoryPtr_" + category.name, i, true); @@ -699,7 +700,7 @@ void ObjCProcessor::LoadProtocols(ObjCReader* reader, Ref<Section> listSection) m_logger->LogError( "Failed to read protocol name for protocol at 0x%llx. Using base address as stand-in protocol name", protocolLocation); - protocolName = std::to_string(protocolLocation); + protocolName = fmt::format("{:x}", protocolLocation); } Protocol protocolClass; |
