mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2024-11-21 19:42:14 +00:00
GP-4976 Only send back <typeref>
This commit is contained in:
parent
cb5ab633de
commit
e80f52c22e
@ -4825,6 +4825,7 @@ int4 ActionInternalStorage::apply(Funcdata &data)
|
||||
void ActionInferTypes::propagationDebug(Architecture *glb,Varnode *vn,const Datatype *newtype,PcodeOp *op,int4 slot,Varnode *ptralias)
|
||||
|
||||
{
|
||||
if (!TypeFactory::propagatedbg_on) return;
|
||||
ostringstream s;
|
||||
|
||||
vn->printRaw(s);
|
||||
@ -5225,9 +5226,11 @@ int4 ActionInferTypes::apply(Funcdata &data)
|
||||
VarnodeLocSet::const_iterator iter;
|
||||
|
||||
#ifdef TYPEPROP_DEBUG
|
||||
ostringstream s;
|
||||
s << "Type propagation pass - " << dec << localcount;
|
||||
data.getArch()->printDebug(s.str());
|
||||
if (TypeFactory::propagatedbg_on) {
|
||||
ostringstream s;
|
||||
s << "Type propagation pass - " << dec << localcount;
|
||||
data.getArch()->printDebug(s.str());
|
||||
}
|
||||
#endif
|
||||
if (localcount >= 7) { // This constant arrived at empirically
|
||||
if (localcount == 7) {
|
||||
|
@ -4,9 +4,9 @@
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@ -79,7 +79,7 @@ void CPoolRecord::encode(Encoder &encoder) const
|
||||
encoder.writeString(ATTRIB_CONTENT, token);
|
||||
encoder.closeElement(ELEM_TOKEN);
|
||||
}
|
||||
type->encode(encoder);
|
||||
type->encodeRef(encoder);
|
||||
encoder.closeElement(ELEM_CPOOLREC);
|
||||
}
|
||||
|
||||
|
@ -5,9 +5,9 @@
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@ -257,7 +257,16 @@ void FileManage::directoryList(vector<string> &res,const string &dirname,bool al
|
||||
if (dir == (DIR *)0) return;
|
||||
entry = readdir(dir);
|
||||
while(entry != (struct dirent *)0) {
|
||||
if (entry->d_type == DT_DIR) {
|
||||
bool isDirectory = false;
|
||||
if (entry->d_type == DT_DIR)
|
||||
isDirectory = true;
|
||||
else if (entry->d_type == DT_UNKNOWN || entry->d_type == DT_LNK) {
|
||||
string path = dirfinal + entry->d_name;
|
||||
struct stat stbuf;
|
||||
stat(path.c_str(), &stbuf);
|
||||
isDirectory = S_ISDIR(stbuf.st_mode);
|
||||
}
|
||||
if (isDirectory) {
|
||||
string fullname(entry->d_name);
|
||||
if ((fullname!=".")&&(fullname!="..")) {
|
||||
if (allowdot || (fullname[0] != '.'))
|
||||
|
@ -3378,7 +3378,7 @@ void ProtoStoreInternal::encode(Encoder &encoder) const
|
||||
if (outparam->isTypeLocked())
|
||||
encoder.writeBool(ATTRIB_TYPELOCK,true);
|
||||
outparam->getAddress().encode(encoder);
|
||||
outparam->getType()->encode(encoder);
|
||||
outparam->getType()->encodeRef(encoder);
|
||||
encoder.closeElement(ELEM_RETPARAM);
|
||||
}
|
||||
else {
|
||||
@ -3406,7 +3406,7 @@ void ProtoStoreInternal::encode(Encoder &encoder) const
|
||||
if (param->isHiddenReturn())
|
||||
encoder.writeBool(ATTRIB_HIDDENRETPARM, true);
|
||||
param->getAddress().encode(encoder);
|
||||
param->getType()->encode(encoder);
|
||||
param->getType()->encodeRef(encoder);
|
||||
encoder.closeElement(ELEM_PARAM);
|
||||
}
|
||||
encoder.closeElement(ELEM_INTERNALLIST);
|
||||
@ -3422,7 +3422,7 @@ void ProtoStoreInternal::decode(Decoder &decoder,ProtoModel *model)
|
||||
proto.firstVarArgSlot = -1;
|
||||
bool addressesdetermined = true;
|
||||
|
||||
pieces.push_back( ParameterPieces() ); // Push on placeholder for output pieces
|
||||
pieces.emplace_back(); // Push on placeholder for output pieces
|
||||
pieces.back().type = outparam->getType();
|
||||
pieces.back().flags = 0;
|
||||
if (outparam->isTypeLocked())
|
||||
@ -4599,7 +4599,7 @@ void FuncProto::encode(Encoder &encoder) const
|
||||
if (outparam->isTypeLocked())
|
||||
encoder.writeBool(ATTRIB_TYPELOCK, true);
|
||||
outparam->getAddress().encode(encoder,outparam->getSize());
|
||||
outparam->getType()->encode(encoder);
|
||||
outparam->getType()->encodeRef(encoder);
|
||||
encoder.closeElement(ELEM_RETURNSYM);
|
||||
encodeEffect(encoder);
|
||||
encodeLikelyTrash(encoder);
|
||||
|
@ -4,9 +4,9 @@
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@ -155,6 +155,10 @@ void IfaceDecompCapability::registerCommands(IfaceStatus *status)
|
||||
status->registerCom(new IfcTraceList(),"trace","list");
|
||||
status->registerCom(new IfcBreakjump(),"break","jumptable");
|
||||
#endif
|
||||
|
||||
#ifdef TYPEPROP_DEBUG
|
||||
status->registerCom(new IfcTracePropagation(),"trace","propagation");
|
||||
#endif
|
||||
}
|
||||
|
||||
/// Runs over every function in the scope, or any sub-scope , calling
|
||||
@ -3586,6 +3590,24 @@ void IfcBreakjump::execute(istream &s)
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef TYPEPROP_DEBUG
|
||||
|
||||
void IfcTracePropagation::execute(istream &s)
|
||||
|
||||
{
|
||||
string token;
|
||||
s >> ws >> token;
|
||||
if (token == "on")
|
||||
TypeFactory::propagatedbg_on = true;
|
||||
else if (token == "off")
|
||||
TypeFactory::propagatedbg_on = false;
|
||||
else
|
||||
throw IfaceParseError("Must specific on/off");
|
||||
*status->optr << "Data-type propagation trace set to: "<< token << endl;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/// Execute one command and handle any exceptions.
|
||||
/// Error messages are printed to the console. For low-level errors,
|
||||
/// the current function is reset to null
|
||||
|
@ -4,9 +4,9 @@
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@ -668,5 +668,14 @@ public:
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef TYPEPROP_DEBUG
|
||||
|
||||
class IfcTracePropagation : public IfaceDecompCommand {
|
||||
public:
|
||||
virtual void execute(istream &s);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
} // End namespace ghidra
|
||||
#endif
|
||||
|
@ -4,9 +4,9 @@
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@ -165,7 +165,7 @@ void ParamMeasure::encode( Encoder &encoder,ElementId &tag,bool moredetail ) con
|
||||
encoder.openElement(ELEM_ADDR);
|
||||
vndata.space->encodeAttributes( encoder, vndata.offset, vndata.size );
|
||||
encoder.closeElement(ELEM_ADDR);
|
||||
vntype->encode(encoder);
|
||||
vntype->encodeRef(encoder);
|
||||
if( moredetail ) {
|
||||
encoder.openElement(ELEM_RANK);
|
||||
encoder.writeSignedInteger(ATTRIB_VAL, rank);
|
||||
|
@ -4,9 +4,9 @@
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@ -38,7 +38,10 @@ int UnitTest::run(set<string> &testNames)
|
||||
t->func();
|
||||
++passed;
|
||||
cerr << " passed." << endl;
|
||||
} catch(LowlevelError &err) {
|
||||
cerr << " fail: " << err.explain << endl;
|
||||
} catch(...) {
|
||||
cerr << " fail" << endl;
|
||||
}
|
||||
}
|
||||
cerr << "==============================" << endl;
|
||||
|
@ -3026,6 +3026,10 @@ void TypeSpacebase::decode(Decoder &decoder,TypeFactory &typegrp)
|
||||
// decoder.closeElement(elemId);
|
||||
}
|
||||
|
||||
#ifdef TYPEPROP_DEBUG
|
||||
bool TypeFactory::propagatedbg_on = false;
|
||||
#endif
|
||||
|
||||
/// Initialize an empty container
|
||||
/// \param g is the owning Architecture
|
||||
TypeFactory::TypeFactory(Architecture *g)
|
||||
@ -4358,7 +4362,7 @@ Datatype *TypeFactory::decodeTypeNoRef(Decoder &decoder,bool forcecore)
|
||||
break;
|
||||
case TYPE_SPACEBASE:
|
||||
{
|
||||
TypeSpacebase tsb((AddrSpace *)0,Address(),glb);
|
||||
TypeSpacebase tsb(glb);
|
||||
tsb.decode(decoder,*this);
|
||||
if (forcecore)
|
||||
tsb.flags |= Datatype::coretype;
|
||||
|
@ -690,6 +690,8 @@ public:
|
||||
TypeSpacebase(const TypeSpacebase &op) : Datatype(op) {
|
||||
spaceid = op.spaceid; localframe=op.localframe; glb=op.glb;
|
||||
}
|
||||
/// Constructor for use with decode
|
||||
TypeSpacebase(Architecture *g) : Datatype(0,1,TYPE_SPACEBASE) { spaceid = (AddrSpace *)0; glb = g; }
|
||||
/// Construct given an address space, scope, and architecture
|
||||
TypeSpacebase(AddrSpace *id,const Address &frame,Architecture *g)
|
||||
: Datatype(0,1,TYPE_SPACEBASE), localframe(frame) { spaceid = id; glb = g; }
|
||||
@ -820,6 +822,9 @@ public:
|
||||
void cacheCoreTypes(void); ///< Cache common types
|
||||
list<DatatypeWarning>::const_iterator beginWarnings(void) const { return warnings.begin(); } ///< Start of data-type warnings
|
||||
list<DatatypeWarning>::const_iterator endWarnings(void) const { return warnings.end(); } ///< End of data-type warnings
|
||||
#ifdef TYPEPROP_DEBUG
|
||||
static bool propagatedbg_on; ///< If \b true, display data-type propagation trace
|
||||
#endif
|
||||
};
|
||||
|
||||
/// The display format for the data-type is changed based on the given format. A value of
|
||||
|
@ -5,9 +5,9 @@
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@ -88,8 +88,8 @@ CPUI_DEBUG -- This is the ONE debug switch that should be passed in
|
||||
#ifdef CPUI_DEBUG
|
||||
# define OPACTION_DEBUG
|
||||
# define PRETTY_DEBUG
|
||||
# define TYPEPROP_DEBUG
|
||||
//# define __REMOTE_SOCKET__
|
||||
//# define TYPEPROP_DEBUG
|
||||
//# define DFSVERIFY_DEBUG
|
||||
//# define BLOCKCONSISTENT_DEBUG
|
||||
//# define MERGEMULTI_DEBUG
|
||||
|
@ -4,9 +4,9 @@
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@ -845,7 +845,7 @@ void HighVariable::encode(Encoder &encoder) const
|
||||
if (symboloffset >= 0)
|
||||
encoder.writeSignedInteger(ATTRIB_OFFSET, symboloffset);
|
||||
}
|
||||
getType()->encode(encoder);
|
||||
getType()->encodeRef(encoder);
|
||||
for(int4 j=0;j<inst.size();++j) {
|
||||
encoder.openElement(ELEM_ADDR);
|
||||
encoder.writeUnsignedInteger(ATTRIB_REF, inst[j]->getCreateIndex());
|
||||
|
Loading…
Reference in New Issue
Block a user