From fa149327973c6b13ac828ad22737537738d21e85 Mon Sep 17 00:00:00 2001 From: James <49045138+ghidracadabra@users.noreply.github.com> Date: Wed, 17 Apr 2019 13:34:29 -0400 Subject: [PATCH] GT-2816 added ability to override indirect call destinations --- .../plugin/processors/sleigh/PcodeEmit.java | 170 +++++++++++------- .../processors/sleigh/PcodeEmitObjects.java | 83 ++++----- .../processors/sleigh/PcodeEmitPacked.java | 113 ++++++------ .../listing/InstructionPcodeOverride.java | 6 +- .../program/model/pcode/PcodeOverride.java | 36 ++-- 5 files changed, 229 insertions(+), 179 deletions(-) diff --git a/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/app/plugin/processors/sleigh/PcodeEmit.java b/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/app/plugin/processors/sleigh/PcodeEmit.java index 7d5c6d363d..8a688c329b 100644 --- a/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/app/plugin/processors/sleigh/PcodeEmit.java +++ b/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/app/plugin/processors/sleigh/PcodeEmit.java @@ -149,7 +149,7 @@ public abstract class PcodeEmit { public ParserWalker getWalker() { return walker; } - + /** * Make a note of the current op index, and associate * it with the label index from the label template, @@ -158,11 +158,13 @@ public abstract class PcodeEmit { * @param op = the label template op */ private void setLabel(OpTpl op) { - if (labeldef == null) + if (labeldef == null) { labeldef = new ArrayList(); + } int labelindex = (int) op.getInput()[0].getOffset().getReal() + labelbase; - while (labeldef.size() <= labelindex) + while (labeldef.size() <= labelindex) { labeldef.add(null); + } labeldef.set(labelindex, numOps); } @@ -205,8 +207,8 @@ public abstract class PcodeEmit { private void dumpNullReturn() { VarnodeTpl nullAddr = - new VarnodeTpl(new ConstTpl(const_space), new ConstTpl(ConstTpl.REAL, 0), new ConstTpl( - ConstTpl.REAL, const_space.getPointerSize())); + new VarnodeTpl(new ConstTpl(const_space), new ConstTpl(ConstTpl.REAL, 0), + new ConstTpl(ConstTpl.REAL, const_space.getPointerSize())); OpTpl retOpt = new OpTpl(PcodeOp.RETURN, null, new VarnodeTpl[] { nullAddr }); dump(retOpt); @@ -253,13 +255,11 @@ public abstract class PcodeEmit { //