summaryrefslogtreecommitdiff
path: root/view/elf/elfview.cpp
diff options
context:
space:
mode:
authorBrian Potchik <brian@vector35.com>2025-06-16 17:30:38 -0400
committerBrian Potchik <brian@vector35.com>2025-06-16 17:30:38 -0400
commit5320c6967cd380fd73be079675a960f22ba53b40 (patch)
tree304043c0e624458829e8cab3e6931bba8d20ea12 /view/elf/elfview.cpp
parent5cab99afa06eb32265fee4798cbfc83bd6a8ae4d (diff)
Use heuristic confidence for ELF symbol auto-type inference.
Diffstat (limited to 'view/elf/elfview.cpp')
-rw-r--r--view/elf/elfview.cpp9
1 files changed, 5 insertions, 4 deletions
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<Type> typeRef = symbolTypeRef;
+ Confidence<Ref<Type>> 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<Symbol>, Ref<Type>>(
+ return std::pair<Ref<Symbol>, Confidence<Ref<Type>>>(
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<Ref<Type>>& type) {
DefineAutoSymbolAndVariableOrFunction(GetDefaultPlatform(), symbol, type);
});
}