diff --git a/Ghidra/Features/Base/src/main/help/help/topics/ReferencesPlugin/References_from.htm b/Ghidra/Features/Base/src/main/help/help/topics/ReferencesPlugin/References_from.htm
index 79bd15e9dd..f834bb6945 100644
--- a/Ghidra/Features/Base/src/main/help/help/topics/ReferencesPlugin/References_from.htm
+++ b/Ghidra/Features/Base/src/main/help/help/topics/ReferencesPlugin/References_from.htm
@@ -1,4 +1,4 @@
-
+c
@@ -740,11 +740,12 @@
Used to change CALLOTHER pcode operations to CALL operations. The new call target is the "to" address of the
- reference. The override only takes effect when the reference is primary, and only when there is exactly one primary
+ reference. Any inputs to the original CALLOTHER op are discarded; the new CALL op may have inputs assigned to it during decompilation.
+ The override only takes effect when the reference is primary, and only when there is exactly one primary
CALLOTHER_OVERRIDE_CALL reference at the "from" address of the reference. Only the first CALLOTHER operation at the "from"
address of the reference is changed. Applying this override to instances of a CALLOTHER op that have output is not recommended
- and can adversely affect decompilation. You can see whether a particular instance has an output by enabling the "PCode" field
- of the Listing. Note that this reference override takes precedence over those of CALLOTHER_OVERRIDE_JUMP
+ and can adversely affect decompilation (e.g., the decompiler may throw an exception). You can see whether a particular instance has an
+ output by enabling the "PCode" field of the Listing. Note that this reference override takes precedence over those of CALLOTHER_OVERRIDE_JUMP
references.
|
diff --git a/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/app/plugin/processors/sleigh/PcodeEmitObjects.java b/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/app/plugin/processors/sleigh/PcodeEmitObjects.java
index aff3940fdc..a19803c13c 100644
--- a/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/app/plugin/processors/sleigh/PcodeEmitObjects.java
+++ b/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/app/plugin/processors/sleigh/PcodeEmitObjects.java
@@ -107,7 +107,7 @@ public class PcodeEmitObjects extends PcodeEmit {
*/
@Override
void dump(Address instrAddr, int opcode, VarnodeData[] in, int isize, VarnodeData out) {
- opcode = checkOverrides(opcode, in);
+ int updatedOpcode = checkOverrides(opcode, in);
Varnode outvn;
if (out != null) {
outvn = new Varnode(out.space.getAddress(out.offset), out.size);
@@ -115,11 +115,14 @@ public class PcodeEmitObjects extends PcodeEmit {
else {
outvn = null;
}
+ if (opcode == PcodeOp.CALLOTHER && updatedOpcode == PcodeOp.CALL) {
+ isize = 1; //CALLOTHER_CALL_OVERRIDE, ignore inputs other than call dest
+ }
Varnode[] invn = new Varnode[isize];
for (int i = 0; i < isize; ++i) {
invn[i] = new Varnode(in[i].space.getAddress(in[i].offset), in[i].size);
}
- PcodeOp op = new PcodeOp(instrAddr, oplist.size(), opcode, invn, outvn);
+ PcodeOp op = new PcodeOp(instrAddr, oplist.size(), updatedOpcode, invn, outvn);
oplist.add(op);
}
diff --git a/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/app/plugin/processors/sleigh/PcodeEmitPacked.java b/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/app/plugin/processors/sleigh/PcodeEmitPacked.java
index 5bb47adf20..486356801a 100644
--- a/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/app/plugin/processors/sleigh/PcodeEmitPacked.java
+++ b/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/app/plugin/processors/sleigh/PcodeEmitPacked.java
@@ -124,9 +124,12 @@ public class PcodeEmitPacked extends PcodeEmit {
@Override
void dump(Address instrAddr, int opcode, VarnodeData[] in, int isize, VarnodeData out)
throws IOException {
- opcode = checkOverrides(opcode, in);
+ int updatedOpcode = checkOverrides(opcode, in);
+ if (opcode == PcodeOp.CALLOTHER && updatedOpcode == PcodeOp.CALL) {
+ isize = 1; //CALLOTHER_CALL_OVERRIDE, ignore inputs other than call dest
+ }
encoder.openElement(ELEM_OP);
- encoder.writeSignedInteger(ATTRIB_CODE, opcode);
+ encoder.writeSignedInteger(ATTRIB_CODE, updatedOpcode);
encoder.writeSignedInteger(ATTRIB_SIZE, isize);
if (out == null) {
encoder.openElement(ELEM_VOID);
@@ -136,7 +139,7 @@ public class PcodeEmitPacked extends PcodeEmit {
out.encode(encoder);
}
int i = 0;
- if ((opcode == PcodeOp.LOAD) || (opcode == PcodeOp.STORE)) {
+ if ((updatedOpcode == PcodeOp.LOAD) || (updatedOpcode == PcodeOp.STORE)) {
dumpSpaceId(in[0]);
i = 1;
}