From 9537f33da6b8de883a45c4b7758f0dc5c1438ed7 Mon Sep 17 00:00:00 2001 From: Zichuan Li Date: Tue, 21 May 2024 17:56:03 -0400 Subject: Solved issue #1180 by adding new APIs 1. Add two new APIs for multiple entry functions `GetAllAnalysisEntryFunctions` and `AddToEntryFunctions` 2. Add Python APIs `entry_functions` and `add_to_entry_functions`. `entry_functions` resturns a list of functions, which supports parsing functions in `init_array`, `fini_array` and TLS callbacks. 3. Modify bin-info, it now prints all entry functions --- view/elf/elfview.cpp | 10 ++++++++-- view/pe/peview.cpp | 2 ++ 2 files changed, 10 insertions(+), 2 deletions(-) (limited to 'view') diff --git a/view/elf/elfview.cpp b/view/elf/elfview.cpp index f938e978..a01d043b 100644 --- a/view/elf/elfview.cpp +++ b/view/elf/elfview.cpp @@ -1539,9 +1539,15 @@ bool ElfView::Init() entry += imageBaseAdjustment; Ref entryArch = entryPointArch->GetAssociatedArchitectureByAddress(entry); if (entryArch != entryPointArch) - AddFunctionForAnalysis(platform->GetRelatedPlatform(entryArch), entry); + { + auto func = AddFunctionForAnalysis(platform->GetRelatedPlatform(entryArch), entry); + AddToEntryFunctions(func); + } else - AddFunctionForAnalysis(platform, entry); + { + auto func = AddFunctionForAnalysis(platform, entry); + AddToEntryFunctions(func); + } m_logger->LogDebug("Adding function start: %#" PRIx64 "\n", entry); // name functions in .init_array, .fini_array, .ctors and .dtors diff --git a/view/pe/peview.cpp b/view/pe/peview.cpp index 89740413..bdf8175d 100644 --- a/view/pe/peview.cpp +++ b/view/pe/peview.cpp @@ -1920,6 +1920,8 @@ bool PEView::Init() m_logger->LogInfo("Found TLS entrypoint %s: 0x%" PRIx64, name, address); Ref assPlatform = platform->GetAssociatedPlatformByAddress(address); AddPESymbol(FunctionSymbol, "", name, address - m_imageBase); + auto func = AddFunctionForAnalysis(platform, address); + AddToEntryFunctions(func); } else m_logger->LogInfo("Found TLS entrypoint %s: 0x%" PRIx64 " however it is not backed by file!", -- cgit v1.3.1