ah, found it. duh.
This commit is contained in:
@@ -175,11 +175,6 @@ public abstract class Instruction implements Cloneable
|
|||||||
return length;
|
return length;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDesc(Frame frame)
|
|
||||||
{
|
|
||||||
return type.getName() + " at pc " + frame.getPc() + " in " + frame.getMethod().getName() + " " + frame.getMethod().getDescriptor() + " class " + frame.getMethod().getCode().getAttributes().getClassFile().getName();
|
|
||||||
}
|
|
||||||
|
|
||||||
public abstract InstructionContext execute(Frame e);
|
public abstract InstructionContext execute(Frame e);
|
||||||
|
|
||||||
/* does this terminate a block? */
|
/* does this terminate a block? */
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ public class GetField extends Instruction implements GetFieldInstruction
|
|||||||
public String toString()
|
public String toString()
|
||||||
{
|
{
|
||||||
Method m = this.getInstructions().getCode().getAttributes().getMethod();
|
Method m = this.getInstructions().getCode().getAttributes().getMethod();
|
||||||
return "getfield " + myField + " in " + m;
|
return "getfield " + myField + " in " + m + " at pc 0x" + Integer.toHexString(this.getPc());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -118,12 +118,6 @@ public class InvokeSpecial extends Instruction implements InvokeInstruction
|
|||||||
return "invokespecial " + method + " in " + this.getInstructions().getCode().getAttributes().getMethod();
|
return "invokespecial " + method + " in " + this.getInstructions().getCode().getAttributes().getMethod();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getDesc(Frame frame)
|
|
||||||
{
|
|
||||||
return "invokespecial " + method.getNameAndType().getDescriptor() + " on " + method.getClassEntry().getName();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removeParameter(int idx)
|
public void removeParameter(int idx)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -113,12 +113,6 @@ public class InvokeStatic extends Instruction implements InvokeInstruction
|
|||||||
return ins;
|
return ins;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getDesc(Frame frame)
|
|
||||||
{
|
|
||||||
return "invokestatic " + method.getNameAndType().getDescriptor() + " on " + method.getClassEntry().getName() + " return value " + method.getNameAndType().getDescriptor().getReturnValue();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removeParameter(int idx)
|
public void removeParameter(int idx)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ public class LDC_W extends Instruction implements PushConstantInstruction
|
|||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getDesc(Frame frame)
|
public String toString()
|
||||||
{
|
{
|
||||||
return "ldc_w " + value;
|
return "ldc_w " + value;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -220,7 +220,7 @@ public class Frame
|
|||||||
}
|
}
|
||||||
catch (Throwable ex)
|
catch (Throwable ex)
|
||||||
{
|
{
|
||||||
System.err.println("Error executing instruction " + cur.getDesc(this));
|
System.err.println("Error executing instruction " + cur);
|
||||||
System.err.println("Frame stack (grows downward):");
|
System.err.println("Frame stack (grows downward):");
|
||||||
while (stack.getSize() > 0)
|
while (stack.getSize() > 0)
|
||||||
{
|
{
|
||||||
@@ -228,7 +228,7 @@ public class Frame
|
|||||||
InstructionContext pushed = stacki.getPushed();
|
InstructionContext pushed = stacki.getPushed();
|
||||||
Frame frame = pushed.getFrame();
|
Frame frame = pushed.getFrame();
|
||||||
|
|
||||||
System.err.println(pushed.getInstruction().getDesc(frame));
|
System.err.println(pushed.getInstruction());
|
||||||
}
|
}
|
||||||
System.err.println("end of stack");
|
System.err.println("end of stack");
|
||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
|
|||||||
@@ -48,7 +48,6 @@ public class StackContext
|
|||||||
|
|
||||||
public void addPopped(InstructionContext popped)
|
public void addPopped(InstructionContext popped)
|
||||||
{
|
{
|
||||||
// assert ParallellMappingExecutor.returnStacks.contains(this) == false;
|
|
||||||
if (!this.poppeds.contains(popped))
|
if (!this.poppeds.contains(popped))
|
||||||
this.poppeds.add(popped);
|
this.poppeds.add(popped);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,6 +64,8 @@ public class UnusedParameters implements Deobfuscator
|
|||||||
|
|
||||||
private int processUnused(Execution execution, ClassGroup group)
|
private int processUnused(Execution execution, ClassGroup group)
|
||||||
{
|
{
|
||||||
|
// XXX maybe only remove parameters at the very end, in the event i want to export a func?
|
||||||
|
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
||||||
for (List<Method> m : unused.keySet())
|
for (List<Method> m : unused.keySet())
|
||||||
@@ -163,19 +165,20 @@ public class UnusedParameters implements Deobfuscator
|
|||||||
|
|
||||||
ii.removeParameter(paramIndex); // remove parameter from instruction
|
ii.removeParameter(paramIndex); // remove parameter from instruction
|
||||||
|
|
||||||
Collection<InstructionContext> ics = invokes.get(i);//execution.getInstructonContexts(i);
|
Collection<InstructionContext> ics = invokes.get(i);
|
||||||
assert ics != null;
|
assert ics != null;
|
||||||
if (ics != null)
|
if (ics != null)
|
||||||
{
|
{
|
||||||
InstructionContext ins = ics.toArray(new InstructionContext[0])[0];
|
for (InstructionContext ins : ics)
|
||||||
|
{
|
||||||
|
int pops = signature.size() - paramIndex - 1; // index from top of stack of parameter. 0 is the last parameter
|
||||||
|
|
||||||
int pops = signature.size() - paramIndex - 1; // index from top of stack of parameter. 0 is the last parameter
|
StackContext sctx = ins.getPops().get(pops);
|
||||||
|
if (sctx.getPushed().getInstruction().getInstructions() == null)
|
||||||
|
continue;
|
||||||
|
|
||||||
StackContext sctx = ins.getPops().get(pops);
|
ins.removeStack(pops); // remove parameter from stack
|
||||||
if (sctx.getPushed().getInstruction().getInstructions() == null)
|
}
|
||||||
continue;
|
|
||||||
|
|
||||||
ins.removeStack(pops); // remove parameter from stack
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user