diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/coreaction.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/coreaction.cc index 84f9e731d0..b6090f8eb5 100644 --- a/Ghidra/Features/Decompiler/src/decompile/cpp/coreaction.cc +++ b/Ghidra/Features/Decompiler/src/decompile/cpp/coreaction.cc @@ -2357,8 +2357,8 @@ void ActionNameVars::makeRec(ProtoParameter *param,Varnode *vn,mapgetHigh(); - if (!high->isMark()) return; // Not one of the variables needing a name if (high->isAddrTied()) return; // Don't propagate parameter name to address tied variable + if (param->getName().compare(0,6,"param_")==0) return; map::iterator iter = recmap.find(high); if (iter != recmap.end()) { // We have seen this varnode before @@ -2391,18 +2391,6 @@ void ActionNameVars::lookForFuncParamNames(Funcdata &data,const vectorisFree()) continue; - if (vn->isInput()) continue; // Don't override unaffected or input naming strategy - Symbol *sym = vn->getHigh()->getSymbol(); - if (sym == (Symbol *)0) continue; - if (!sym->isNameUndefined()) continue; - markcount += 1; - vn->getHigh()->setMark(); - } - if (markcount == 0) return; map recmap; ScopeLocal *localmap = data.getScopeLocal(); @@ -2419,13 +2407,18 @@ void ActionNameVars::lookForFuncParamNames(Funcdata &data,const vector::iterator iter; for(uint4 i=0;iisFree()) continue; + if (vn->isInput()) continue; // Don't override unaffected or input naming strategy HighVariable *high = vn->getHigh(); - if (!high->isMark()) continue; - high->clearMark(); + if (high->getNumMergeClasses() > 1) continue; // Don't inherit a name if speculatively merged + Symbol *sym = high->getSymbol(); + if (sym == (Symbol *)0) continue; + if (!sym->isNameUndefined()) continue; iter = recmap.find(high); if (iter != recmap.end()) { Symbol *sym = high->getSymbol(); diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/variable.hh b/Ghidra/Features/Decompiler/src/decompile/cpp/variable.hh index 6420b26207..f97573c2be 100644 --- a/Ghidra/Features/Decompiler/src/decompile/cpp/variable.hh +++ b/Ghidra/Features/Decompiler/src/decompile/cpp/variable.hh @@ -104,6 +104,7 @@ public: Varnode *getInputVarnode(void) const; ///< Find (the) input member Varnode Varnode *getTypeRepresentative(void) const; ///< Get a member Varnode with the strongest data-type Varnode *getNameRepresentative(void) const; ///< Get a member Varnode that dictates the naming of \b this HighVariable + int4 getNumMergeClasses(void) const { return numMergeClasses; } ///< Get the number of speculative merges for \b this bool isMapped(void) const { updateFlags(); return ((flags&Varnode::mapped)!=0); } ///< Return \b true if \b this is mapped bool isPersist(void) const { updateFlags(); return ((flags&Varnode::persist)!=0); } ///< Return \b true if \b this is a global variable bool isAddrTied(void) const { updateFlags(); return ((flags&Varnode::addrtied)!=0); } ///< Return \b true if \b this is \e address \e ties