mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-10-19 18:12:14 -09:00
Merge remote-tracking branch
'origin/GP-2206_James_CALLOTHER_override_improvements' (Closes #3936, Closes #3665)
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
c<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
|
||||
<HTML>
|
||||
<HEAD>
|
||||
@@ -740,11 +740,12 @@
|
||||
</FONT></TD>
|
||||
|
||||
<TD valign="top">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. <EM> Applying this override to instances of a CALLOTHER op that have output is not recommended
|
||||
and can adversely affect decompilation. </EM> 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). </EM> 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. <BR>
|
||||
</TD>
|
||||
</TR>
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user