From 5320c6967cd380fd73be079675a960f22ba53b40 Mon Sep 17 00:00:00 2001 From: Brian Potchik Date: Mon, 16 Jun 2025 17:30:38 -0400 Subject: Use heuristic confidence for ELF symbol auto-type inference. --- view/elf/elfview.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'view/elf/elfview.cpp') diff --git a/view/elf/elfview.cpp b/view/elf/elfview.cpp index 1a8aeea6..5c045682 100644 --- a/view/elf/elfview.cpp +++ b/view/elf/elfview.cpp @@ -2526,7 +2526,7 @@ void ElfView::DefineElfSymbol(BNSymbolType type, const string& incomingName, uin // Try to demangle any C++ symbols string shortName = rawName; string fullName = rawName; - Ref typeRef = symbolTypeRef; + Confidence> typeRef = symbolTypeRef; if (m_arch) { QualifiedName demangledName; @@ -2542,18 +2542,19 @@ void ElfView::DefineElfSymbol(BNSymbolType type, const string& incomingName, uin } } + // If unable to extract type information, create a default type with the given size and heuristic confidence if (!typeRef && (size > 0 && size <= 8)) { - typeRef = Type::IntegerType(size, false); + typeRef = Type::IntegerType(size, false)->WithConfidence(BN_HEURISTIC_CONFIDENCE); } - return std::pair, Ref>( + return std::pair, Confidence>>( new Symbol(type, shortName, fullName, rawName, addr, binding, nameSpace), typeRef); }; if (m_symbolQueue) { - m_symbolQueue->Append(process, [this](Symbol* symbol, Type* type) { + m_symbolQueue->Append(process, [this](Symbol* symbol, const Confidence>& type) { DefineAutoSymbolAndVariableOrFunction(GetDefaultPlatform(), symbol, type); }); } -- cgit v1.3.1