Ghidra is a software reverse engineering (SRE) framework
Namespace display options
caheckmane339d91ffd17
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/options.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/options.ccindex 32ea9769fa..4e20a4a032 100644--- a/Ghidra/Features/Decompiler/src/decompile/cpp/options.cc+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/options.cc@@ -81,6 +81,7 @@ OptionDatabase::OptionDatabase(Architecture *g)registerOption(new OptionToggleRule());registerOption(new OptionAliasBlock());registerOption(new OptionMaxInstruction());+ registerOption(new OptionNamespaceStrategy());}OptionDatabase::~OptionDatabase(void)@@ -833,3 +834,23 @@ string OptionMaxInstruction::apply(Architecture *glb,const string &p1,const striglb->max_instructions = newMax;return "Maximum instructions per function set";}++/// \class OptionNamespaceStrategy+/// \brief How should namespace tokens be displayed+///+/// The first parameter gives the strategy identifier, mapping to PrintLanguage::namespace_strategy.+string OptionNamespaceStrategy::apply(Architecture *glb,const string &p1,const string &p2,const string &p3) const++{+ PrintLanguage::namespace_strategy strategy;+ if (p1 == "minimal")+ strategy = PrintLanguage::MINIMAL_NAMESPACES;+ else if (p1 == "all")+ strategy = PrintLanguage::ALL_NAMESPACES;+ else if (p1 == "none")+ strategy = PrintLanguage::NO_NAMESPACES;+ else+ throw ParseError("Must specify a valid strategy");+ glb->print->setNamespaceStrategy(strategy);+ return "Namespace strategy set";+}diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/options.hh b/Ghidra/Features/Decompiler/src/decompile/cpp/options.hhindex 5cd7674407..37c692077a 100644--- a/Ghidra/Features/Decompiler/src/decompile/cpp/options.hh+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/options.hh@@ -270,4 +270,10 @@ public:virtual string apply(Architecture *glb,const string &p1,const string &p2,const string &p3) const;};+class OptionNamespaceStrategy : public ArchOption {+public:+ OptionNamespaceStrategy(void) { name = "namespacestrategy"; } ///< Constructor+ virtual string apply(Architecture *glb,const string &p1,const string &p2,const string &p3) const;+};+#endifdiff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/printc.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/printc.ccindex 3e35c3d063..7f4241e6db 100644--- a/Ghidra/Features/Decompiler/src/decompile/cpp/printc.cc+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/printc.cc@@ -174,7 +174,17 @@ void PrintC::pushPrototypeInputs(const FuncProto *proto)void PrintC::pushSymbolScope(const Symbol *symbol){- int4 scopedepth = symbol->getResolutionDepth(curscope);+ int4 scopedepth;+ if (namespc_strategy == MINIMAL_NAMESPACES)+ scopedepth = symbol->getResolutionDepth(curscope);+ else if (namespc_strategy == ALL_NAMESPACES) {+ if (symbol->getScope() == curscope)+ scopedepth = 0;+ else+ scopedepth = symbol->getResolutionDepth((const Scope *)0);+ }+ else+ scopedepth = 0;if (scopedepth != 0) {vector<const Scope *> scopeList;const Scope *point = symbol->getScope();@@ -195,7 +205,17 @@ void PrintC::pushSymbolScope(const Symbol *symbol)void PrintC::emitSymbolScope(const Symbol *symbol){- int4 scopedepth = symbol->getResolutionDepth(curscope);+ int4 scopedepth;+ if (namespc_strategy == MINIMAL_NAMESPACES)+ scopedepth = symbol->getResolutionDepth(curscope);+ else if (namespc_strategy == ALL_NAMESPACES) {+ if (symbol->getScope() == curscope)+ scopedepth = 0;+ else+ scopedepth = symbol->getResolutionDepth((const Scope *)0);+ }+ else+ scopedepth = 0;if (scopedepth != 0) {vector<const Scope *> scopeList;const Scope *point = symbol->getScope();diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/printlanguage.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/printlanguage.ccindex b486b8386d..bb73411e3b 100644--- a/Ghidra/Features/Decompiler/src/decompile/cpp/printlanguage.cc+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/printlanguage.cc@@ -575,6 +575,7 @@ void PrintLanguage::resetDefaultsInternal(void)mods = 0;head_comment_type = Comment::header | Comment::warningheader;line_commentindent = 20;+ namespc_strategy = MINIMAL_NAMESPACES;instr_comment_type = Comment::user2 | Comment::warning;}diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/printlanguage.hh b/Ghidra/Features/Decompiler/src/decompile/cpp/printlanguage.hhindex f2bad7f287..e06c7c4abd 100644--- a/Ghidra/Features/Decompiler/src/decompile/cpp/printlanguage.hh+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/printlanguage.hh@@ -162,6 +162,13 @@ public:blanktoken ///< For anonymous types};+ /// \brief Strategies for displaying namespace tokens+ enum namespace_strategy {+ MINIMAL_NAMESPACES = 0, ///< (default) Print just enough namespace info to fully resolve symbol+ NO_NAMESPACES = 1, ///< Never print namespace information+ ALL_NAMESPACES = 2 ///< Always print all namespace information+ };+/// \brief An entry on the reverse polish notation (RPN) stackstruct ReversePolish {const OpToken *tok; ///< The operator token@@ -245,6 +252,7 @@ protected:uint4 mods; ///< Currently active printing modificationsuint4 instr_comment_type; ///< Type of instruction comments to displayuint4 head_comment_type; ///< Type of header comments to display+ namespace_strategy namespc_strategy; ///< How should namespace tokens be displayed#ifdef CPUI_DEBUGbool isStackEmpty(void) const { return (nodepend.empty()&&revpol.empty()); } ///< Return \b true if the RPN stack is emptybool isModStackEmpty(void) const { return modstack.empty(); } ///< Return \b true if the printing modification stack is empty@@ -412,6 +420,7 @@ public:bool usecommentfill); ///< Establish comment delimiters for the languageuint4 getInstructionComment(void) const { return instr_comment_type; } ///< Get the type of comments suitable within the body of a functionvoid setInstructionComment(uint4 val) { instr_comment_type = val; } ///< Set the type of comments suitable within the body of a function+ void setNamespaceStrategy(namespace_strategy strat) { namespc_strategy = strat; } ///< Set how namespace tokens are displayeduint4 getHeaderComment(void) const { return head_comment_type; } ///< Get the type of comments suitable for a function headervoid setHeaderComment(uint4 val) { head_comment_type = val; } ///< Set the type of comments suitable for a function headerbool emitsXml(void) const { return emit->emitsXml(); } ///< Does the low-level emitter, emit XML markupdiff --git a/Ghidra/Features/Decompiler/src/main/java/ghidra/app/decompiler/DecompInterface.java b/Ghidra/Features/Decompiler/src/main/java/ghidra/app/decompiler/DecompInterface.javaindex a1516041a0..a4d12379c4 100644--- a/Ghidra/Features/Decompiler/src/main/java/ghidra/app/decompiler/DecompInterface.java+++ b/Ghidra/Features/Decompiler/src/main/java/ghidra/app/decompiler/DecompInterface.java@@ -31,7 +31,6 @@ import ghidra.program.model.lang.*;import ghidra.program.model.listing.Function;import ghidra.program.model.listing.Program;import ghidra.program.model.pcode.*;-import ghidra.util.exception.CancelledException;import ghidra.util.task.CancelledListener;import ghidra.util.task.TaskMonitor;import ghidra.xml.XmlPullParser;@@ -131,7 +130,7 @@ public class DecompInterface {}/**- * Returns true if debug has been enabled for the current/next decompilation.+ * @return true if debug has been enabled for the current/next decompilation.*/public boolean debugEnabled() {return debug != null;@@ -199,8 +198,8 @@ public class DecompInterface {/*** This is the main routine for making sure that a decompiler* process is active and that it is initialized properly- * @throws IOException- * @throws DecompileException+ * @throws IOException for any problems with the pipe to the decompiler process+ * @throws DecompileException for errors initializing decompiler options etc.*/protected void initializeProcess() throws IOException, DecompileException {if (decompCallback == null) {@@ -233,7 +232,6 @@ public class DecompInterface {}if (xmlOptions != null) {decompProcess.setMaxResultSize(xmlOptions.getMaxPayloadMBytes());- decompProcess.setShowNamespace(xmlOptions.isDisplayNamespaces());if (!decompProcess.sendCommand1Param("setOptions",xmlOptions.getXML(this)).toString().equals("t")) {throw new IOException("Did not accept decompiler options");@@ -590,7 +588,6 @@ public class DecompInterface {try {verifyProcess();decompProcess.setMaxResultSize(xmlOptions.getMaxPayloadMBytes());- decompProcess.setShowNamespace(xmlOptions.isDisplayNamespaces());return decompProcess.sendCommand1Param("setOptions",xmloptions.getXML(this)).toString().equals("t");}@@ -701,8 +698,7 @@ public class DecompInterface {if (program == null) {return new DecompileResults(func, pcodelanguage, null, dtmanage, decompileMessage, null,- DecompileProcess.DisposeState.DISPOSED_ON_CANCEL,- false /* cancelled--doesn't matter */);+ DecompileProcess.DisposeState.DISPOSED_ON_CANCEL);}try {@@ -747,7 +743,7 @@ public class DecompInterface {stream = res.getInputStream();}return new DecompileResults(func, pcodelanguage, compilerSpec, dtmanage, decompileMessage,- stream, processState, isDisplayNamespace());+ stream, processState);}/**@@ -796,12 +792,4 @@ public class DecompInterface {public CompilerSpec getCompilerSpec() {return compilerSpec;}-- private boolean isDisplayNamespace() {- if (xmlOptions == null) {- return false; // not sure if this can happen- }- return xmlOptions.isDisplayNamespaces();- }-}diff --git a/Ghidra/Features/Decompiler/src/main/java/ghidra/app/decompiler/DecompileCallback.java b/Ghidra/Features/Decompiler/src/main/java/ghidra/app/decompiler/DecompileCallback.javaindex 6b934a2d1a..8059b3e9fe 100644--- a/Ghidra/Features/Decompiler/src/main/java/ghidra/app/decompiler/DecompileCallback.java+++ b/Ghidra/Features/Decompiler/src/main/java/ghidra/app/decompiler/DecompileCallback.java@@ -78,7 +78,6 @@ public class DecompileCallback {private PcodeDataTypeManager dtmanage;private Charset utf8Charset;private String nativeMessage;- private boolean showNamespace;private InstructionBlock lastPseudoInstructionBlock;private Disassembler pseudoDisassembler;@@ -154,10 +153,6 @@ public class DecompileCallback {nativeMessage = msg;}- public void setShowNamespace(boolean showNamespace) {- this.showNamespace = showNamespace;- }-public synchronized int readXMLSize(String addrxml) {int attrstart = addrxml.indexOf("size=\"");if (attrstart >= 4) {@@ -770,8 +765,7 @@ public class DecompileCallback {return null;}- HighFunction hfunc =- new HighFunction(func, pcodelanguage, pcodecompilerspec, dtmanage, showNamespace);+ HighFunction hfunc = new HighFunction(func, pcodelanguage, pcodecompilerspec, dtmanage);int extrapop = getExtraPopOverride(func, addr);hfunc.grabFromFunction(extrapop, false, (extrapop != default_extrapop));@@ -1012,7 +1006,7 @@ public class DecompileCallback {long diff = addr.getOffset() - entry.getOffset();if ((diff >= 0) && (diff < 8)) {HighFunction hfunc = new HighFunction(func, pcodelanguage, pcodecompilerspec,- dtmanage, showNamespace);+ dtmanage);int extrapop = getExtraPopOverride(func, addr);hfunc.grabFromFunction(extrapop, includeDefaultNames,diff --git a/Ghidra/Features/Decompiler/src/main/java/ghidra/app/decompiler/DecompileOptions.java b/Ghidra/Features/Decompiler/src/main/java/ghidra/app/decompiler/DecompileOptions.javaindex 6d81421a7e..c344f3c0ce 100644--- a/Ghidra/Features/Decompiler/src/main/java/ghidra/app/decompiler/DecompileOptions.java+++ b/Ghidra/Features/Decompiler/src/main/java/ghidra/app/decompiler/DecompileOptions.java@@ -230,6 +230,35 @@ public class DecompileOptions {private final static boolean COMMENTHEAD_OPTIONDEFAULT = true;private boolean commentHeadInclude;+ public enum NamespaceStrategy {+ Minimal("minimal", "Minimally"),+ All("all", "Always"),+ Never("none", "Never");++ private String label;+ private String optionString;++ private NamespaceStrategy(String optString, String label) {+ this.label = label;+ this.optionString = optString;+ }++ public String getOptionString() {+ return optionString;+ }++ @Override+ public String toString() {+ return label;+ }+ }++ private final static String NAMESPACE_OPTIONSTRING = "Display.Display Namespaces";+ private final static String NAMESPACE_OPTIONDESCRIPTION =+ "Choose how/if namespace tokens should be displayed along with symbol names";+ private final static NamespaceStrategy NAMESPACE_OPTIONDEFAULT = NamespaceStrategy.Minimal;+ private NamespaceStrategy namespaceStrategy;+private final static String INTEGERFORMAT_OPTIONSTRING = "Display.Integer format";private final static String INTEGERFORMAT_OPTIONDESCRIPTION ="Choose how to display integers: as hexadecimal, decimal, or best fit";@@ -317,13 +346,10 @@ public class DecompileOptions {"Number of Decompiled Functions to Cache in the Decompile Window";private final static String LINE_NUMBER_MSG = "Display.Display Line Numbers";- private final static String NAMESPACE_MSG = "Display.Display Namespaces";private final static String DECOMPILE_TIMEOUT = "Decompiler Timeout (seconds)";private final static String PAYLOAD_LIMIT = "Decompiler Max-Payload (MBytes)";private final static Boolean LINE_NUMBER_DEF = Boolean.TRUE;- private final static Boolean NAMESPACES_DEF = Boolean.FALSE;private boolean displayLineNumbers;- private boolean displayNamespaces;private int decompileTimeoutSeconds;private int payloadLimitMBytes;private int cachedResultsSize;@@ -354,6 +380,7 @@ public class DecompileOptions {commentEOLInclude = COMMENTEOL_OPTIONDEFAULT;commentWARNInclude = COMMENTWARN_OPTIONDEFAULT;commentHeadInclude = COMMENTHEAD_OPTIONDEFAULT;+ namespaceStrategy = NAMESPACE_OPTIONDEFAULT;integerFormat = INTEGERFORMAT_OPTIONDEFAULT;keywordColor = HIGHLIGHT_KEYWORD_DEF;functionColor = HIGHLIGHT_FUNCTION_DEF;@@ -367,7 +394,6 @@ public class DecompileOptions {codeViewerBackgroundColor = CODE_VIEWER_BACKGROUND_COLOR;defaultFont = DEFAULT_FONT;displayLineNumbers = LINE_NUMBER_DEF;- displayNamespaces = NAMESPACES_DEF;displayLanguage = BasicCompilerSpec.DECOMPILER_OUTPUT_DEF;protoEvalModel = "default";decompileTimeoutSeconds = SUGGESTED_DECOMPILE_TIMEOUT_SECS;@@ -414,6 +440,7 @@ public class DecompileOptions {commentPLATEInclude = opt.getBoolean(COMMENTPLATE_OPTIONSTRING, COMMENTPLATE_OPTIONDEFAULT);commentWARNInclude = opt.getBoolean(COMMENTWARN_OPTIONSTRING, COMMENTWARN_OPTIONDEFAULT);commentHeadInclude = opt.getBoolean(COMMENTHEAD_OPTIONSTRING, COMMENTHEAD_OPTIONDEFAULT);+ namespaceStrategy = opt.getEnum(NAMESPACE_OPTIONSTRING, NAMESPACE_OPTIONDEFAULT);integerFormat = opt.getEnum(INTEGERFORMAT_OPTIONSTRING, INTEGERFORMAT_OPTIONDEFAULT);keywordColor = opt.getColor(HIGHLIGHT_KEYWORD_MSG, HIGHLIGHT_KEYWORD_DEF);typeColor = opt.getColor(HIGHLIGHT_TYPE_MSG, HIGHLIGHT_TYPE_DEF);@@ -432,7 +459,6 @@ public class DecompileOptions {defaultFont = SystemUtilities.adjustForFontSizeOverride(defaultFont);defaultSearchHighlightColor = opt.getColor(SEARCH_HIGHLIGHT_MSG, SEARCH_HIGHLIGHT_DEF);displayLineNumbers = opt.getBoolean(LINE_NUMBER_MSG, LINE_NUMBER_DEF);- displayNamespaces = opt.getBoolean(NAMESPACE_MSG, NAMESPACES_DEF);decompileTimeoutSeconds = opt.getInt(DECOMPILE_TIMEOUT, SUGGESTED_DECOMPILE_TIMEOUT_SECS);payloadLimitMBytes = opt.getInt(PAYLOAD_LIMIT, SUGGESTED_MAX_PAYLOAD_BYTES);cachedResultsSize = opt.getInt(CACHED_RESULTS_SIZE_MSG, SUGGESTED_CACHED_RESULTS_SIZE);@@ -541,6 +567,8 @@ public class DecompileOptions {COMMENTWARN_OPTIONDESCRIPTION);opt.registerOption(COMMENTHEAD_OPTIONSTRING, COMMENTHEAD_OPTIONDEFAULT, help,COMMENTHEAD_OPTIONDESCRIPTION);+ opt.registerOption(NAMESPACE_OPTIONSTRING, NAMESPACE_OPTIONDEFAULT, help,+ NAMESPACE_OPTIONDESCRIPTION);opt.registerOption(INTEGERFORMAT_OPTIONSTRING, INTEGERFORMAT_OPTIONDEFAULT, help,INTEGERFORMAT_OPTIONDESCRIPTION);opt.registerOption(HIGHLIGHT_KEYWORD_MSG, HIGHLIGHT_KEYWORD_DEF, help,@@ -569,8 +597,6 @@ public class DecompileOptions {"The color used to highlight matches using the Find Dialog.");opt.registerOption(LINE_NUMBER_MSG, LINE_NUMBER_DEF, help,"Toggle for displaying line numbers in the decompiler.");- opt.registerOption(NAMESPACE_MSG, NAMESPACES_DEF, help,- "Toggle for dislaying namespaces for functions.");opt.registerOption(DECOMPILE_TIMEOUT, SUGGESTED_DECOMPILE_TIMEOUT_SECS, help,"The number of seconds to allow the decompiler to run before terminating the " +"decompiler.\nCurrently this does not affect the UI, which will run indefinitely. " +@@ -654,6 +680,8 @@ public class DecompileOptions {appendOption(buf, "commentheader", "header", commentHeadInclude ? "on" : "off", "");appendOption(buf, "commentheader", "warningheader", commentWARNInclude ? "on" : "off", "");+ appendOption(buf, "namespacestrategy", namespaceStrategy.getOptionString(), "", "");+appendOption(buf, "integerformat", integerFormat.getOptionString(), "", "");appendOption(buf, "protoeval", protoEvalModel, "", "");@@ -793,10 +821,6 @@ public class DecompileOptions {return displayLineNumbers;}- public boolean isDisplayNamespaces() {- return displayNamespaces;- }-public DecompilerLanguage getDisplayLanguage() {return displayLanguage;}diff --git a/Ghidra/Features/Decompiler/src/main/java/ghidra/app/decompiler/DecompileProcess.java b/Ghidra/Features/Decompiler/src/main/java/ghidra/app/decompiler/DecompileProcess.javaindex 1bfb9f37a2..3e568ce925 100644--- a/Ghidra/Features/Decompiler/src/main/java/ghidra/app/decompiler/DecompileProcess.java+++ b/Ghidra/Features/Decompiler/src/main/java/ghidra/app/decompiler/DecompileProcess.java@@ -70,7 +70,6 @@ public class DecompileProcess {private int archId = -1; // architecture id for decomp processprivate DecompileCallback callback; // Callback interface for decompilerprivate int maxResultSizeMBYtes = 50; // maximum result size in MBytes to allow from decompiler- private boolean showNamespace; // whether to show namespaces for functionspublic enum DisposeState {NOT_DISPOSED, // Process was/is not disposed@@ -441,7 +440,6 @@ public class DecompileProcess {String cspecxml, String tspecxml, String coretypesxml)throws IOException, DecompileException {callback = cback;- callback.setShowNamespace(showNamespace);setup();String restring = null;@@ -591,11 +589,6 @@ public class DecompileProcess {this.maxResultSizeMBYtes = maxResultSizeMBytes;}- public void setShowNamespace(boolean showNamespace) {- this.showNamespace = showNamespace;- callback.setShowNamespace(showNamespace);- }-/*** Send a command to the decompiler with one parameter and return the result* @param command is the command stringdiff --git a/Ghidra/Features/Decompiler/src/main/java/ghidra/app/decompiler/DecompileResults.java b/Ghidra/Features/Decompiler/src/main/java/ghidra/app/decompiler/DecompileResults.javaindex e2b9092409..e6038f665c 100644--- a/Ghidra/Features/Decompiler/src/main/java/ghidra/app/decompiler/DecompileResults.java+++ b/Ghidra/Features/Decompiler/src/main/java/ghidra/app/decompiler/DecompileResults.java@@ -62,12 +62,10 @@ public class DecompileResults {private ClangTokenGroup docroot; // C code parsed from XMLprivate String errMsg; // Error message from decompilerprivate DecompileProcess.DisposeState processState;- private boolean showNamespace; // include namespace when displaying function namespublic DecompileResults(Function f, Language language, CompilerSpec compilerSpec,PcodeDataTypeManager d, String e, InputStream raw,- DecompileProcess.DisposeState processState,- boolean showNamespace) {+ DecompileProcess.DisposeState processState) {function = f;this.language = language;this.compilerSpec = compilerSpec;@@ -76,7 +74,6 @@ public class DecompileResults {hfunc = null;hparamid = null;docroot = null;- this.showNamespace = showNamespace;//dumpResults(raw);parseRawString(raw);}@@ -226,7 +223,7 @@ public class DecompileResults {XmlElement el = parser.peek();if (el.getName().equals("function")) {if (hfunc == null) {- hfunc = new HighFunction(function, language, compilerSpec, dtmanage, showNamespace);+ hfunc = new HighFunction(function, language, compilerSpec, dtmanage);hfunc.readXML(parser);}else { // TODO: This is an ugly kludge to get around duplicate XML tag names@@ -237,9 +234,7 @@ public class DecompileResults {}}else if (el.getName().equals("parammeasures")) {- hparamid =- new HighParamID(function, language, compilerSpec, dtmanage,- showNamespace);+ hparamid = new HighParamID(function, language, compilerSpec, dtmanage);hparamid.readXML(parser);}else {diff --git a/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/model/pcode/HighFunction.java b/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/model/pcode/HighFunction.javaindex a5a702ff2a..faa800e92c 100644--- a/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/model/pcode/HighFunction.java+++ b/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/model/pcode/HighFunction.java@@ -51,22 +51,19 @@ public class HighFunction extends PcodeSyntaxTree {private GlobalSymbolMap globalSymbols;private List<JumpTable> jumpTables;private List<DataTypeSymbol> protoOverrides;- private boolean showNamespace = true;/*** @param function function associated with the higher level function abstraction.* @param language description of the processor language of the function* @param compilerSpec description of the compiler that produced the function* @param dtManager data type manager- * @param showNamespace true signals to print function names with their namespace*/public HighFunction(Function function, Language language, CompilerSpec compilerSpec,- PcodeDataTypeManager dtManager, boolean showNamespace) {+ PcodeDataTypeManager dtManager) {super(function.getProgram().getAddressFactory(), dtManager);func = function;this.language = language;this.compilerSpec = compilerSpec;- this.showNamespace = showNamespace;localSymbols = new LocalSymbolMap(this, "stack");globalSymbols = new GlobalSymbolMap(this);proto = new FunctionPrototype(localSymbols, function);@@ -260,9 +257,9 @@ public class HighFunction extends PcodeSyntaxTree {public void readXML(XmlPullParser parser) throws PcodeXMLException {XmlElement start = parser.start("function");String name = start.getAttribute("name");- if (!func.getName(showNamespace).equals(name)) {+ if (!func.getName().equals(name)) {throw new PcodeXMLException(- "Function name mismatch: " + func.getName(showNamespace) + " + " + name);+ "Function name mismatch: " + func.getName() + " + " + name);}while (!parser.peek().isEnd()) {XmlElement subel = parser.peek();@@ -449,7 +446,7 @@ public class HighFunction extends PcodeSyntaxTree {if (id != 0) {SpecXmlUtils.encodeUnsignedIntegerAttribute(resBuf, "id", id);}- SpecXmlUtils.xmlEscapeAttribute(resBuf, "name", func.getName(showNamespace));+ SpecXmlUtils.xmlEscapeAttribute(resBuf, "name", func.getName());SpecXmlUtils.encodeSignedIntegerAttribute(resBuf, "size", size);if (func.isInline()) {SpecXmlUtils.encodeBooleanAttribute(resBuf, "inline", true);diff --git a/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/model/pcode/HighParamID.java b/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/model/pcode/HighParamID.javaindex c207104db0..e565cf089a 100644--- a/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/model/pcode/HighParamID.java+++ b/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/model/pcode/HighParamID.java@@ -48,23 +48,20 @@ public class HighParamID extends PcodeSyntaxTree {private Integer protoextrapop;private List<ParamMeasure> inputlist = new ArrayList<ParamMeasure>();private List<ParamMeasure> outputlist = new ArrayList<ParamMeasure>();- private boolean showNamespace = true;/*** @param function function associated with the higher level function abstraction.* @param language language parser used to disassemble/get info on the language.* @param compilerSpec the compiler spec.* @param dtManager data type manager.- * @param showNamespace true to show the parameters namespace.*/public HighParamID(Function function, Language language, CompilerSpec compilerSpec,- PcodeDataTypeManager dtManager, boolean showNamespace) {+ PcodeDataTypeManager dtManager) {super(function.getProgram().getAddressFactory(), dtManager);func = function;modelname = null;protoextrapop = PrototypeModel.UNKNOWN_EXTRAPOP;- this.showNamespace = showNamespace;}/**@@ -137,8 +134,8 @@ public class HighParamID extends PcodeSyntaxTree {public void readXML(XmlPullParser parser) throws PcodeXMLException {XmlElement start = parser.start("parammeasures");functionname = start.getAttribute("name");- if (!func.getName(showNamespace).equals(functionname)) {- throw new PcodeXMLException("Function name mismatch: " + func.getName(showNamespace) ++ if (!func.getName().equals(functionname)) {+ throw new PcodeXMLException("Function name mismatch: " + func.getName() +" + " + functionname);}while (!parser.peek().isEnd()) {@@ -157,10 +154,12 @@ public class HighParamID extends PcodeSyntaxTree {subel = parser.start("proto");modelname = subel.getAttribute("model");String val = subel.getAttribute("extrapop");- if (val.equals("unknown"))+ if (val.equals("unknown")) {protoextrapop = PrototypeModel.UNKNOWN_EXTRAPOP;- else+ }+ else {protoextrapop = SpecXmlUtils.decodeInt(val);+ }parser.end(subel);}else if (subel.getName().equals("input")) {@@ -243,23 +242,28 @@ public class HighParamID extends PcodeSyntaxTree {try {//TODO: Currently, only storing one output, so looking for the best to report. When possible, change this to report allint best_index = 0;- if (getNumOutputs() > 1)- for (int i = 1; i < getNumOutputs(); i++)+ if (getNumOutputs() > 1) {+ for (int i = 1; i < getNumOutputs(); i++) {if (getOutput(i).getRank() < getOutput(best_index).getRank()) {//TODO: create mirror of ranks on high side (instead of using numbers?)best_index = i;}+ }+ }if (getNumOutputs() != 0) {ParamMeasure pm = getOutput(best_index);pm.getRank(); //TODO (maybe): this value is not used or stored on the java side at this pointVarnode vn = pm.getVarnode();DataType dataType;- if (storeDataTypes)+ if (storeDataTypes) {dataType = pm.getDataType();- else+ }+ else {dataType = dtManage.findUndefined(vn.getSize());+ }//Msg.debug(this, "func: " + func.getName() + " -- type: " + dataType.getName());- if (!(dataType == null || dataType instanceof VoidDataType))+ if (!(dataType == null || dataType instanceof VoidDataType)) {func.setReturn(dataType, buildStorage(vn), SourceType.ANALYSIS);+ }}}catch (InvalidInputException e) {@@ -282,10 +286,12 @@ public class HighParamID extends PcodeSyntaxTree {DataType dataType;//Msg.debug(this, "function(" + func.getName() + ")--param size: " + vn.getSize() +// "--type before store: " + pm.getDataType().getName());- if (storeDataTypes)+ if (storeDataTypes) {dataType = pm.getDataType();- else+ }+ else {dataType = dtManage.findUndefined(vn.getSize());+ }Variable v =new ParameterImpl(null, dataType, buildStorage(vn),func.getProgram());