GP-2024 Fix for formatting test

This commit is contained in:
caheckman 2022-05-12 17:53:10 -04:00
parent fafbaacd5f
commit c88f59a5ed
5 changed files with 13 additions and 8 deletions

View file

@ -1699,19 +1699,20 @@ Symbol *Scope::addDynamicSymbol(const string &nm,Datatype *ct,const Address &cad
return sym;
}
/// \brief Create a symbol that forces a constant display conversion
/// \brief Create a symbol that forces display conversion on a constant
///
/// \param format is the type of conversion (Symbol::force_hex, Symbol::force_dec, etc.)
/// \param nm is the equate name to display, which may be empty for an integer conversion
/// \param format is the type of integer conversion (Symbol::force_hex, Symbol::force_dec, etc.)
/// \param value is the constant value being converted
/// \param addr is the address of the p-code op reading the constant
/// \param hash is the dynamic hash identifying the constant
/// \return the new EquateSymbol
Symbol *Scope::addConvertSymbol(uint4 format,uintb value,Address &addr,uint8 hash)
Symbol *Scope::addEquateSymbol(const string &nm,uint4 format,uintb value,const Address &addr,uint8 hash)
{
Symbol *sym;
sym = new EquateSymbol(owner,"",format,value);
sym = new EquateSymbol(owner,nm,format,value);
addSymbolInternal(sym);
RangeList rnglist;
if (!addr.isInvalid())

View file

@ -727,7 +727,7 @@ public:
ExternRefSymbol *addExternalRef(const Address &addr,const Address &refaddr,const string &nm);
LabSymbol *addCodeLabel(const Address &addr,const string &nm);
Symbol *addDynamicSymbol(const string &nm,Datatype *ct,const Address &caddr,uint8 hash);
Symbol *addConvertSymbol(uint4 format,uintb value,Address &addr,uint8 hash);
Symbol *addEquateSymbol(const string &nm,uint4 format,uintb value,const Address &addr,uint8 hash);
string buildDefaultName(Symbol *sym,int4 &base,Varnode *vn) const; ///< Create a default name for the given Symbol
bool isReadOnly(const Address &addr,int4 size,const Address &usepoint) const;
void printBounds(ostream &s) const { rangetree.printBounds(s); } ///< Print a description of \b this Scope's \e owned memory ranges

View file

@ -1198,7 +1198,11 @@ void Funcdata::buildDynamicSymbol(Varnode *vn)
if (dhash.getHash() == 0)
throw RecovError("Unable to find unique hash for varnode");
Symbol *sym = localmap->addDynamicSymbol("",high->getType(),dhash.getAddress(),dhash.getHash());
Symbol *sym;
if (vn->isConstant())
sym = localmap->addEquateSymbol("",Symbol::force_hex, vn->getOffset(), dhash.getAddress(), dhash.getHash());
else
sym = localmap->addDynamicSymbol("",high->getType(),dhash.getAddress(),dhash.getHash());
vn->setSymbolEntry(sym->getFirstWholeMap());
}

View file

@ -708,7 +708,7 @@ void IfcMapconvert::execute(istream &s)
s >> hex >> hash; // Parse the hash value
dcp->fd->getScopeLocal()->addConvertSymbol(format, value, addr, hash);
dcp->fd->getScopeLocal()->addEquateSymbol("", format, value, addr, hash);
}
/// \class IfcPrintdisasm

View file

@ -25,7 +25,7 @@
<com>map addr r0x301020 octint4 globalbin</com>
<com>lo fu setglobals</com>
<com>decompile</com>
<com>force varnode #0xaa(0x100625:0x12) bin</com>
<com>force varnode #0xaa(0x100619:7) bin</com>
<com>print C</com>
<com>quit</com>
</script>