GP-1405 Create data-type recommendation for potential this parameter

This commit is contained in:
caheckman 2022-06-17 14:51:35 -04:00
parent 91e5259018
commit 4f6211859b
7 changed files with 64 additions and 1 deletions

View file

@ -297,7 +297,7 @@ void ScopeLocal::collectNameRecs(void)
// If the "this" pointer points to a class, try to preserve the data-type
// even though the symbol is not preserved.
SymbolEntry *entry = sym->getFirstWholeMap();
typeRecommend.push_back(TypeRecommend(entry->getAddr(),dt));
addTypeRecommendation(entry->getAddr(), dt);
}
}
}
@ -1377,6 +1377,16 @@ void ScopeLocal::applyTypeRecommendations(void)
}
}
/// Associate a data-type with a particular storage address. If we see an input Varnode at this address,
/// if no other info is available, the given data-type is applied.
/// \param addr is the storage address
/// \param dt is the given data-type
void ScopeLocal::addTypeRecommendation(const Address &addr,Datatype *dt)
{
typeRecommend.push_back(TypeRecommend(addr,dt));
}
/// The symbol is stored as a name recommendation and then removed from the scope.
/// Name recommendations are associated either with a storage address and usepoint, or a dynamic hash.
/// The name may be reattached to a Symbol after decompilation.