GP-2157 Marshaling refactor. Decompiler side.

This commit is contained in:
caheckman 2022-05-17 16:15:21 -04:00
parent 672c1f11e2
commit d8c10bf229
97 changed files with 5313 additions and 3733 deletions

View file

@ -16,6 +16,12 @@
#include "varnode.hh"
#include "funcdata.hh"
AttributeId ATTRIB_ADDRTIED = AttributeId("addrtied",131);
AttributeId ATTRIB_GRP = AttributeId("grp",132);
AttributeId ATTRIB_INPUT = AttributeId("input",133);
AttributeId ATTRIB_PERSISTS = AttributeId("persists",134);
AttributeId ATTRIB_UNAFF = AttributeId("unaff",135);
/// Compare by location then by definition.
/// This is the same as the normal varnode compare, but we distinguish identical frees by their
/// pointer address. Thus varsets defined with this comparison act like multisets for free varnodes
@ -863,30 +869,30 @@ int4 Varnode::termOrder(const Varnode *op) const
return 0;
}
/// Write an XML tag, \b \<addr>, with at least the following attributes:
/// Encode \b this as an \<addr> element, with at least the following attributes:
/// - \b space describes the AddrSpace
/// - \b offset of the Varnode within the space
/// - \b size of the Varnode is bytes
///
/// Additionally the tag will contain other optional attributes.
/// \param s is the stream to write the tag to
void Varnode::saveXml(ostream &s) const
/// Additionally the element will contain other optional attributes.
/// \param encoder is the stream encoder
void Varnode::encode(Encoder &encoder) const
{
s << "<addr";
loc.getSpace()->saveXmlAttributes(s,loc.getOffset(),size);
a_v_u(s,"ref",getCreateIndex());
encoder.openElement(ELEM_ADDR);
loc.getSpace()->encodeAttributes(encoder,loc.getOffset(),size);
encoder.writeUnsignedInteger(ATTRIB_REF, getCreateIndex());
if (mergegroup != 0)
a_v_i(s,"grp",getMergeGroup());
encoder.writeSignedInteger(ATTRIB_GRP, getMergeGroup());
if (isPersist())
s << " persists=\"true\"";
encoder.writeBool(ATTRIB_PERSISTS, true);
if (isAddrTied())
s << " addrtied=\"true\"";
encoder.writeBool(ATTRIB_ADDRTIED, true);
if (isUnaffected())
s << " unaff=\"true\"";
encoder.writeBool(ATTRIB_UNAFF, true);
if (isInput())
s << " input=\"true\"";
s << "/>";
encoder.writeBool(ATTRIB_INPUT, true);
encoder.closeElement(ELEM_ADDR);
}
/// Invoke the printRaw method on the given Varnode pointer, but take into account that it