Ghidra is a software reverse engineering (SRE) framework
GP-159 FillOutStructureCmd - added offsetPcodeOp pair class and getter methods.
ghidra007369a41a6673f
diff --git a/Ghidra/Features/Decompiler/src/main/java/ghidra/app/plugin/core/decompile/actions/FillOutStructureCmd.java b/Ghidra/Features/Decompiler/src/main/java/ghidra/app/plugin/core/decompile/actions/FillOutStructureCmd.javaindex 7dd37319a1..590f5d4a77 100644--- a/Ghidra/Features/Decompiler/src/main/java/ghidra/app/plugin/core/decompile/actions/FillOutStructureCmd.java+++ b/Ghidra/Features/Decompiler/src/main/java/ghidra/app/plugin/core/decompile/actions/FillOutStructureCmd.java@@ -75,8 +75,8 @@ public class FillOutStructureCmd extends BackgroundCommand {private TaskMonitor monitor;private PluginTool tool;- private List<PcodeOp> storePcodeOps = new ArrayList<PcodeOp>();- private List<PcodeOp> loadPcodeOps = new ArrayList<PcodeOp>();+ private List<OffsetPcodeOpPair> storePcodeOps = new ArrayList<OffsetPcodeOpPair>();+ private List<OffsetPcodeOpPair> loadPcodeOps = new ArrayList<OffsetPcodeOpPair>();/*** Constructor.@@ -207,23 +207,24 @@ public class FillOutStructureCmd extends BackgroundCommand {}/**- * Retrieve the pcodeOps that are used to store data into the variable+ * Retrieve the offset/pcodeOp pairs that are used to store data into the variable* the FillInStructureCmd was trying to create a structure on.* @return the pcodeOps doing the storing to the associated variable*/- public List<PcodeOp> getStorePcodeOps() {+ public List<OffsetPcodeOpPair> getStorePcodeOps() {return storePcodeOps;}/**- * Retrieve the pcodeOps that are used to load data from the variable+ * Retrieve the offset/pcodeOp pairs that are used to load data from the variable* the FillInStructureCmd was trying to create a structure on.* @return the pcodeOps doing the loading from the associated variable*/- public List<PcodeOp> getLoadPcodeOps() {+ public List<OffsetPcodeOpPair> getLoadPcodeOps() {return loadPcodeOps;}+/*** Retrieve the (likely) storage address for a function parameter given its index* @param function is the function@@ -690,8 +691,8 @@ public class FillOutStructureCmd extends BackgroundCommand {outDt = getDataTypeTraceForward(output);componentMap.addDataType(currentRef.offset, outDt);- if (outDt != null && !loadPcodeOps.contains(pcodeOp)) {- loadPcodeOps.add(pcodeOp);+ if (outDt != null) {+ loadPcodeOps.add(new OffsetPcodeOpPair(currentRef.offset, pcodeOp));}break;@@ -704,8 +705,8 @@ public class FillOutStructureCmd extends BackgroundCommand {outDt = getDataTypeTraceBackward(inputs[2]);componentMap.addDataType(currentRef.offset, outDt);- if (outDt != null && !storePcodeOps.contains(pcodeOp)) {- storePcodeOps.add(pcodeOp);+ if (outDt != null) {+ storePcodeOps.add(new OffsetPcodeOpPair(currentRef.offset, pcodeOp));}break;@@ -776,4 +777,26 @@ public class FillOutStructureCmd extends BackgroundCommand {todoList.add(new PointerRef(output, offset));doneList.add(output);}++ /**+ * Class to create pair between an offset and its related PcodeOp+ */+ static public class OffsetPcodeOpPair {++ private Long offset;+ private PcodeOp pcodeOp;++ public OffsetPcodeOpPair(Long offset, PcodeOp pcodeOp) {+ this.offset = offset;+ this.pcodeOp = pcodeOp;+ }++ public Long getOffset() {+ return offset;+ }++ public PcodeOp getPcodeOp() {+ return pcodeOp;+ }+ }}