mirror of
https://github.com/NationalSecurityAgency/ghidra
synced 2024-09-13 21:56:19 +00:00
GP-2206_callother_override_improvements
This commit is contained in:
parent
45165ea167
commit
bedf676e4d
|
@ -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 (i.e., cause the decompiler to crash). </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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue