mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-05 02:39:44 +02:00
Merge remote-tracking branch
'origin/GP-3590_DecompilerDataypeId--SQUASHED' (Closes #5403, Closes #5475)
This commit is contained in:
commit
99da2a3e13
6 changed files with 178 additions and 147 deletions
|
@ -771,7 +771,7 @@ void ArchitectureGhidra::getStringData(vector<uint1> &buffer,const Address &addr
|
|||
encoder.openElement(ELEM_COMMAND_GETSTRINGDATA);
|
||||
encoder.writeSignedInteger(ATTRIB_MAXSIZE, maxBytes);
|
||||
encoder.writeString(ATTRIB_TYPE,ct->getName());
|
||||
encoder.writeUnsignedInteger(ATTRIB_ID, ct->getId());
|
||||
encoder.writeUnsignedInteger(ATTRIB_ID, ct->getUnsizedId());
|
||||
addr.encode(encoder);
|
||||
encoder.closeElement(ELEM_COMMAND_GETSTRINGDATA);
|
||||
sout.write("\000\000\001\017",4);
|
||||
|
|
|
@ -192,8 +192,9 @@ void EmitMarkup::tagType(const string &name,syntax_highlight hl,const Datatype *
|
|||
encoder->openElement(ELEM_TYPE);
|
||||
if (hl != no_color)
|
||||
encoder->writeUnsignedInteger(ATTRIB_COLOR,hl);
|
||||
if (ct->getId() != 0) {
|
||||
encoder->writeUnsignedInteger(ATTRIB_ID, ct->getId());
|
||||
uint8 typeId = ct->getUnsizedId();
|
||||
if (typeId != 0) {
|
||||
encoder->writeUnsignedInteger(ATTRIB_ID, typeId);
|
||||
}
|
||||
encoder->writeString(ATTRIB_CONTENT,name);
|
||||
encoder->closeElement(ELEM_TYPE);
|
||||
|
@ -207,8 +208,9 @@ void EmitMarkup::tagField(const string &name,syntax_highlight hl,const Datatype
|
|||
encoder->writeUnsignedInteger(ATTRIB_COLOR,hl);
|
||||
if (ct != (const Datatype *)0) {
|
||||
encoder->writeString(ATTRIB_NAME,ct->getName());
|
||||
if (ct->getId() != 0) {
|
||||
encoder->writeUnsignedInteger(ATTRIB_ID, ct->getId());
|
||||
uint8 typeId = ct->getUnsizedId();
|
||||
if (typeId != 0) {
|
||||
encoder->writeUnsignedInteger(ATTRIB_ID, typeId);
|
||||
}
|
||||
encoder->writeSignedInteger(ATTRIB_OFF, o);
|
||||
if (op != (const PcodeOp *)0)
|
||||
|
|
|
@ -369,11 +369,7 @@ void Datatype::encodeBasic(type_metatype meta,Encoder &encoder) const
|
|||
|
||||
{
|
||||
encoder.writeString(ATTRIB_NAME, name);
|
||||
uint8 saveId;
|
||||
if (isVariableLength())
|
||||
saveId = hashSize(id, size);
|
||||
else
|
||||
saveId = id;
|
||||
uint8 saveId = getUnsizedId();
|
||||
if (saveId != 0) {
|
||||
encoder.writeUnsignedInteger(ATTRIB_ID, saveId);
|
||||
}
|
||||
|
@ -575,9 +571,7 @@ uint8 Datatype::hashName(const string &nm)
|
|||
if ((res&1)==0)
|
||||
res ^= 0xfeabfeab; // Some kind of feedback
|
||||
}
|
||||
uint8 tmp=1;
|
||||
tmp <<= 63;
|
||||
res |= tmp; // Make sure the hash is negative (to distinguish it from database id's)
|
||||
res |= 0xC000000000000000; // Add header bits indicating a name hash
|
||||
return res;
|
||||
}
|
||||
|
||||
|
|
|
@ -203,6 +203,7 @@ public:
|
|||
type_metatype getMetatype(void) const { return metatype; } ///< Get the type \b meta-type
|
||||
sub_metatype getSubMeta(void) const { return submeta; } ///< Get the \b sub-metatype
|
||||
uint8 getId(void) const { return id; } ///< Get the type id
|
||||
uint8 getUnsizedId(void) const; ///< Get the type id, without variable length size adjustment
|
||||
int4 getSize(void) const { return size; } ///< Get the type size
|
||||
const string &getName(void) const { return name; } ///< Get the type name
|
||||
const string &getDisplayName(void) const { return displayName; } ///< Get string to use in display
|
||||
|
@ -768,6 +769,19 @@ inline uint4 Datatype::getDisplayFormat(void) const
|
|||
return (flags & force_format) >> 12;
|
||||
}
|
||||
|
||||
/// If the data-type is \e variable \e length, the working id for the data-type has a contribution
|
||||
/// based on the specific size of \b this instance. This contribution is removed, and the base id is returned.
|
||||
/// If the data-type is not \e variable \e length, the unaltered id is returned.
|
||||
/// \return the base id of the data-type
|
||||
inline uint8 Datatype::getUnsizedId(void) const
|
||||
|
||||
{
|
||||
if ((flags & variable_length) != 0) {
|
||||
return hashSize(id, size);
|
||||
}
|
||||
return id;
|
||||
}
|
||||
|
||||
/// Order data-types, with special handling of the \e bool data-type. Data-types are compared
|
||||
/// using the normal ordering, but \e bool is ordered after all other data-types. A return value
|
||||
/// of 0 indicates the data-types are the same, -1 indicates that \b this is prefered (ordered earlier),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue