GP-1932 Decompiler support for address space attribute on pointers

This commit is contained in:
caheckman 2022-03-04 20:07:34 -05:00
parent 31b30adf2d
commit 7078885aea
12 changed files with 710 additions and 366 deletions

View file

@ -2893,8 +2893,10 @@ void IfcReadonly::execute(istream &s)
/// \class IfcPointerSetting
/// \brief Create a pointer with additional settings: `pointer setting <name> <basetype> offset <val>`
///
/// The new data-type is named and must be pointer. It must have a setting
/// - \b offset which creates a shifted pointer
/// Alternately: `pointer setting <name> <basetype> space <spacename>`
/// The new data-type is named and must be pointer.
/// An \e offset setting creates a relative pointer and attaches the provided offset value.
/// A \e space setting create a pointer with the provided address space as an attribute.
void IfcPointerSetting::execute(istream &s)
{
@ -2927,6 +2929,19 @@ void IfcPointerSetting::execute(istream &s)
AddrSpace *spc = dcp->conf->getDefaultDataSpace();
dcp->conf->types->getTypePointerRel(spc->getAddrSize(), bt, ptrto, spc->getWordSize(), off,typeName);
}
else if (setting == "space") {
string spaceName;
s >> spaceName;
if (spaceName.length() == 0)
throw IfaceParseError("Missing name of address space");
Datatype *ptrTo = dcp->conf->types->findByName(baseType);
if (ptrTo == (Datatype *)0)
throw IfaceParseError("Unknown base data-type: "+baseType);
AddrSpace *spc = dcp->conf->getSpaceByName(spaceName);
if (spc == (AddrSpace *)0)
throw IfaceParseError("Unknown space: "+spaceName);
dcp->conf->types->getTypePointerWithSpace(ptrTo,spc,typeName);
}
else
throw IfaceParseError("Unknown pointer setting: "+setting);
*status->optr << "Successfully created pointer: " << typeName << endl;