}
}
}
else if (instruction instanceof TargetInsn)
{
TargetInsn targetInsn= (TargetInsn) instruction;
String instructionName= targetInsn.getOpcode().getName();
dexInstruction= new Element(sanitizeInstructionName(instructionName), NS_DEX);
addRegistersAsAttributes(targetInsn.getRegisters(), dexInstruction);
if (instructionName.equals("packed-switch") || instructionName.equals("sparse-switch"))
{
SwitchData switchData= switchDataBlocks.get(targetInsn.getTargetAddress());
if (switchData == null)
{
Log.error(TAG, "DEXmlvmOutputProcess: Couldn't find SwitchData block.");
System.exit(-1);
}
IntList cases= switchData.getCases();
CodeAddress[] caseTargets= switchData.getTargets();
// Sanity check.
if (cases.size() != caseTargets.length)
{
Log.error(TAG, "DEXmlvmOutputProcess: SwitchData size mismatch: cases vs targets.");
System.exit(-1);
}
for (int i= 0; i < cases.size(); ++i)
{
Element caseElement= new Element("case", NS_DEX);
caseElement.setAttribute("key", String.valueOf(cases.get(i)));
caseElement.setAttribute("label", String.valueOf(caseTargets[i].getAddress()));
dexInstruction.addContent(caseElement);
}
}
else if (instructionName.equals("fill-array-data"))
{
ArrayList<Constant> data= arrayData.get(targetInsn.getTargetAddress()).getValues();
for (Constant c : data)
{
Element constant= new Element("constant", NS_DEX);
constant.setAttribute("value", c.toHuman());
dexInstruction.addContent(constant);
}
}
else
{
dexInstruction.setAttribute("target", String.valueOf(targetInsn.getTargetAddress()));
}
}
else if (instruction instanceof HighRegisterPrefix)
{
HighRegisterPrefix highRegisterPrefix= (HighRegisterPrefix) instruction;