X-Git-Url: https://git.saurik.com/apple/ld64.git/blobdiff_plain/9543cb2f21e50a417dc8cf37eb7173f353536979..599556ff3dd31aab68bb9685f1ed7fc4867803e7:/src/other/unwinddump.cpp diff --git a/src/other/unwinddump.cpp b/src/other/unwinddump.cpp index 3da01c5..effd09b 100644 --- a/src/other/unwinddump.cpp +++ b/src/other/unwinddump.cpp @@ -221,7 +221,14 @@ const char* UnwindPrinter::functionName(pint_t addr, uint32_t* offset) for (uint32_t i=0; i < fSymbolCount; ++i) { uint8_t type = fSymbols[i].n_type(); if ( ((type & N_STAB) == 0) && ((type & N_TYPE) == N_SECT) ) { - if ( fSymbols[i].n_value() == addr ) { + uint32_t value = fSymbols[i].n_value(); + if ( value == addr ) { + const char* r = &fStrings[fSymbols[i].n_strx()]; + return r; + } + if ( fSymbols[i].n_desc() & N_ARM_THUMB_DEF ) + value |= 1; + if ( value == addr ) { const char* r = &fStrings[fSymbols[i].n_strx()]; //fprintf(stderr, "addr=0x%08llX, i=%u, n_type=0x%0X, r=%s\n", (long long)(fSymbols[i].n_value()), i, fSymbols[i].n_type(), r); return r; @@ -730,6 +737,8 @@ void UnwindPrinter::decode(uint32_t encoding, const uint8_t* funcStart, c } #endif + + template <> const char* UnwindPrinter::personalityName(const macho_relocation_info* reloc) { @@ -759,6 +768,7 @@ const char* UnwindPrinter::personalityName(const macho_relocation_info bool UnwindPrinter::hasExernReloc(uint64_t sectionOffset, const char** personalityStr, pint_t* addr) { @@ -795,6 +805,7 @@ void UnwindPrinter::printObjectUnwindSection(bool showFunctionNames) } else { functionNameStr = this->functionName(entry->codeStart(), &offsetInFunction); + funcAddress = entry->codeStart(); } if ( offsetInFunction == 0 ) printf(" start: 0x%08llX %s\n", (uint64_t)funcAddress, functionNameStr); @@ -990,7 +1001,7 @@ static void dump(const char* path, const std::set& onlyArchs, bool s if ( UnwindPrinter::validFile(p + offset) ) UnwindPrinter::make(p + offset, size, path, showFunctionNames); else - throw "in universal file, arm64 slice does not contain arm mach-o"; + throw "in universal file, arm64 slice does not contain arm64 mach-o"; break; #endif default: @@ -1062,6 +1073,7 @@ int main(int argc, const char* argv[]) #if SUPPORT_ARCH_arm64 onlyArchs.insert(CPU_TYPE_ARM64); #endif + onlyArchs.insert(CPU_TYPE_ARM); } // process each file