From ba98e8542998cdfe3f8c6891e243f53885648aef Mon Sep 17 00:00:00 2001 From: ghidra1 Date: Wed, 10 Apr 2019 15:33:30 -0400 Subject: [PATCH 1/2] Set version 9.0.3-DEV --- Ghidra/application.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Ghidra/application.properties b/Ghidra/application.properties index d147a5076e..25d4c367b0 100644 --- a/Ghidra/application.properties +++ b/Ghidra/application.properties @@ -1,5 +1,5 @@ application.name=Ghidra -application.version=9.0.2 +application.version=9.0.3-DEV application.release.name=PUBLIC application.layout.version=1 application.gradle.version=5.0 From 933e16f751feb14b2b61b603b451388821c10716 Mon Sep 17 00:00:00 2001 From: caheckman <48068198+caheckman@users.noreply.github.com> Date: Fri, 12 Apr 2019 09:44:53 -0400 Subject: [PATCH 2/2] Suggestions from github issue #382 --- .../Features/Decompiler/src/decompile/cpp/architecture.hh | 4 ++-- .../Features/Decompiler/src/decompile/cpp/consolemain.cc | 4 ++-- Ghidra/Features/Decompiler/src/decompile/cpp/fspec.cc | 4 ++-- .../Decompiler/src/decompile/cpp/inject_sleigh.cc | 5 ++--- .../Decompiler/src/decompile/cpp/inject_sleigh.hh | 1 - .../Features/Decompiler/src/decompile/cpp/sleigh_arch.cc | 8 ++++++-- .../Features/Decompiler/src/decompile/cpp/sleigh_arch.hh | 1 + .../Features/Decompiler/src/decompile/cpp/slghsymbol.cc | 4 ++-- Ghidra/Features/Decompiler/src/decompile/cpp/subflow.cc | 3 +-- Ghidra/Features/Decompiler/src/decompile/cpp/unify.cc | 2 +- 10 files changed, 19 insertions(+), 17 deletions(-) diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/architecture.hh b/Ghidra/Features/Decompiler/src/decompile/cpp/architecture.hh index f41b4557da..a0943c9243 100644 --- a/Ghidra/Features/Decompiler/src/decompile/cpp/architecture.hh +++ b/Ghidra/Features/Decompiler/src/decompile/cpp/architecture.hh @@ -116,8 +116,6 @@ public: class Architecture : public AddrSpaceManager { public: string archid; ///< ID string uniquely describing this architecture - string description; ///< Description of architecture - string version; ///< Configuration version // Configuration data int4 trim_recurse_max; ///< How many levels to let parameter trims recurse @@ -178,6 +176,8 @@ public: void restoreFlowOverride(const Element *el); ///< Set flow overrides from XML virtual ~Architecture(void); ///< Destructor + virtual string getDescription(void) const { return archid; } ///< Get a string describing \b this architecture + /// \brief Print an error message to console /// /// Write the given message to whatever the registered error stream is diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/consolemain.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/consolemain.cc index 84b23c0ce7..fa726c2571 100644 --- a/Ghidra/Features/Decompiler/src/decompile/cpp/consolemain.cc +++ b/Ghidra/Features/Decompiler/src/decompile/cpp/consolemain.cc @@ -100,7 +100,7 @@ void IfcLoadFile::execute(istream &s) #ifdef OPACTION_DEBUG dcp->conf->setDebugStream(status->optr); #endif - *status->optr << filename << " successfully loaded: " << dcp->conf->description << endl; + *status->optr << filename << " successfully loaded: " << dcp->conf->getDescription() << endl; } void IfcAddpath::execute(istream &s) @@ -162,7 +162,7 @@ void IfcRestore::execute(istream &s) #ifdef OPACTION_DEBUG dcp->conf->setDebugStream(status->optr); #endif - *status->optr << savefile << " successfully loaded: " << dcp->conf->description << endl; + *status->optr << savefile << " successfully loaded: " << dcp->conf->getDescription() << endl; } int main(int argc,char **argv) diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/fspec.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/fspec.cc index 06a05287fb..c38d6859ee 100644 --- a/Ghidra/Features/Decompiler/src/decompile/cpp/fspec.cc +++ b/Ghidra/Features/Decompiler/src/decompile/cpp/fspec.cc @@ -2282,7 +2282,7 @@ ProtoStoreSymbol::ProtoStoreSymbol(Scope *sc,const Address &usepoint) ParameterPieces pieces; pieces.type = scope->getArch()->types->getTypeVoid(); pieces.flags = 0; - setOutput(pieces); + ProtoStoreSymbol::setOutput(pieces); } ProtoStoreSymbol::~ProtoStoreSymbol(void) @@ -2465,7 +2465,7 @@ ProtoStoreInternal::ProtoStoreInternal(Datatype *vt) ParameterPieces pieces; pieces.type = voidtype; pieces.flags = 0; - setOutput(pieces); + ProtoStoreInternal::setOutput(pieces); } ProtoStoreInternal::~ProtoStoreInternal(void) diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/inject_sleigh.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/inject_sleigh.cc index dbb04c7d6f..4a1e44dbf8 100644 --- a/Ghidra/Features/Decompiler/src/decompile/cpp/inject_sleigh.cc +++ b/Ghidra/Features/Decompiler/src/decompile/cpp/inject_sleigh.cc @@ -281,9 +281,8 @@ void InjectPayloadDynamic::inject(InjectContext &context,PcodeEmit &emit) const PcodeInjectLibrarySleigh::PcodeInjectLibrarySleigh(Architecture *g,uintb tmpbase) : PcodeInjectLibrary(g,tmpbase) { - glb = g; - slgh = (const SleighBase *)glb->translate; - contextCache.glb = glb; + slgh = (const SleighBase *)g->translate; + contextCache.glb = g; } int4 PcodeInjectLibrarySleigh::registerDynamicInject(InjectPayload *payload) diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/inject_sleigh.hh b/Ghidra/Features/Decompiler/src/decompile/cpp/inject_sleigh.hh index dac98dd6e5..ad6f44bff2 100644 --- a/Ghidra/Features/Decompiler/src/decompile/cpp/inject_sleigh.hh +++ b/Ghidra/Features/Decompiler/src/decompile/cpp/inject_sleigh.hh @@ -87,7 +87,6 @@ public: }; class PcodeInjectLibrarySleigh : public PcodeInjectLibrary { - Architecture *glb; const SleighBase *slgh; vector inst; InjectContextSleigh contextCache; diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/sleigh_arch.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/sleigh_arch.cc index b7075b885b..1742e61a23 100644 --- a/Ghidra/Features/Decompiler/src/decompile/cpp/sleigh_arch.cc +++ b/Ghidra/Features/Decompiler/src/decompile/cpp/sleigh_arch.cc @@ -125,6 +125,12 @@ SleighArchitecture::~SleighArchitecture(void) translate = (const Translate *)0; } +string SleighArchitecture::getDescription(void) const + +{ + return description[languageindex].getDescription(); +} + /// If the current \b languageindex matches the \b last_languageindex, /// try to reuse the previous Sleigh object, so we don't reload /// the .sla file. @@ -198,8 +204,6 @@ void SleighArchitecture::buildSpecFile(DocumentStorage &store) { // Given a specific language, make sure relevant spec files are loaded bool language_reuse = isTranslateReused(); const LanguageDescription &language(description[languageindex]); - Architecture::description = language.getDescription(); - version = language.getVersion(); string compiler = archid.substr(archid.rfind(':')+1); const CompilerTag &compilertag( language.getCompiler(compiler)); diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/sleigh_arch.hh b/Ghidra/Features/Decompiler/src/decompile/cpp/sleigh_arch.hh index d7788a2da4..01d41fe077 100644 --- a/Ghidra/Features/Decompiler/src/decompile/cpp/sleigh_arch.hh +++ b/Ghidra/Features/Decompiler/src/decompile/cpp/sleigh_arch.hh @@ -112,6 +112,7 @@ public: void restoreXmlHeader(const Element *el); ///< Restore from XML basic attributes of an executable virtual void printMessage(const string &message) const { *errorstream << message << endl; } virtual ~SleighArchitecture(void); + virtual string getDescription(void) const; static string normalizeProcessor(const string &nm); ///< Try to recover a \e language \e id processor field static string normalizeEndian(const string &nm); ///< Try to recover a \e language \e id endianess field diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/slghsymbol.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/slghsymbol.cc index 6f75e63ad7..dbeba71e14 100644 --- a/Ghidra/Features/Decompiler/src/decompile/cpp/slghsymbol.cc +++ b/Ghidra/Features/Decompiler/src/decompile/cpp/slghsymbol.cc @@ -2062,10 +2062,10 @@ int4 DecisionNode::getNumFixed(int4 low,int4 size,bool context) double DecisionNode::getScore(int4 low,int4 size,bool context) { - int4 numBins = 1 << size; + int4 numBins = 1 << size; // size is between 1 and 8 int4 i; uintm val,mask; - uintm m = (size==8*sizeof(uintm)) ? 0 : (((uintm)1)<vn->getSize() - precision); - if (isinput) - replaceInput(rvn); // Replace input to avoid overlap errors + replaceInput(rvn); // Replace input to avoid overlap errors rvn->replacement = fd->newVarnode(precision,addr); } else diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/unify.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/unify.cc index 6edc35a505..d848cfc7dd 100644 --- a/Ghidra/Features/Decompiler/src/decompile/cpp/unify.cc +++ b/Ghidra/Features/Decompiler/src/decompile/cpp/unify.cc @@ -91,7 +91,7 @@ UnifyDatatype::~UnifyDatatype(void) delete storespot.cn; break; default: - throw LowlevelError("Bad unify datatype"); + break; } }