The stored offset is a relative offset from the position of the instruction, not an absolute offset

git-svn-id: https://smali.googlecode.com/svn/trunk@364 55b6fa8a-2a1e-11de-a435-ffa8d773f76a
This commit is contained in:
JesusFreke@JesusFreke.com 2009-08-05 05:35:11 +00:00
parent 416b72fc74
commit 814580d4cf

View File

@ -218,11 +218,11 @@ public class MethodDefinition {
if (opcode == Opcode.PACKED_SWITCH) { if (opcode == Opcode.PACKED_SWITCH) {
Instruction31t ins = (Instruction31t)opcode.format.Factory.makeInstruction( Instruction31t ins = (Instruction31t)opcode.format.Factory.makeInstruction(
methodIdItem.getDexFile(), opcode, encodedInstructions, index); methodIdItem.getDexFile(), opcode, encodedInstructions, index);
packedSwitchMap.put(ins.getOffset(), index/2); packedSwitchMap.put(index/2 + ins.getOffset(), index/2);
} else if (opcode == Opcode.SPARSE_SWITCH) { } else if (opcode == Opcode.SPARSE_SWITCH) {
Instruction31t ins = (Instruction31t)opcode.format.Factory.makeInstruction( Instruction31t ins = (Instruction31t)opcode.format.Factory.makeInstruction(
methodIdItem.getDexFile(), opcode, encodedInstructions, index); methodIdItem.getDexFile(), opcode, encodedInstructions, index);
sparseSwitchMap.put(ins.getOffset(), index/2); sparseSwitchMap.put(index/2 + ins.getOffset(), index/2);
} }
} }