From 10a95181115741071ae23911413a3f731047621c Mon Sep 17 00:00:00 2001 From: "JesusFreke@JesusFreke.com" Date: Sat, 6 Mar 2010 06:12:09 +0000 Subject: [PATCH] Add additional context information to exceptions when building a MethodDefinition object git-svn-id: https://smali.googlecode.com/svn/trunk@672 55b6fa8a-2a1e-11de-a435-ffa8d773f76a --- .../baksmali/Adaptors/MethodDefinition.java | 66 +++++++++++-------- 1 file changed, 37 insertions(+), 29 deletions(-) diff --git a/baksmali/src/main/java/org/jf/baksmali/Adaptors/MethodDefinition.java b/baksmali/src/main/java/org/jf/baksmali/Adaptors/MethodDefinition.java index 8e1f3900..a250eee2 100644 --- a/baksmali/src/main/java/org/jf/baksmali/Adaptors/MethodDefinition.java +++ b/baksmali/src/main/java/org/jf/baksmali/Adaptors/MethodDefinition.java @@ -42,6 +42,7 @@ import org.jf.dexlib.Debug.DebugInstructionIterator; import org.jf.dexlib.Util.AccessFlags; import org.antlr.stringtemplate.StringTemplateGroup; import org.antlr.stringtemplate.StringTemplate; +import org.jf.dexlib.Util.ExceptionWithContext; import org.jf.dexlib.Util.Hex; import org.jf.dexlib.Util.SparseIntArray; @@ -61,42 +62,49 @@ public class MethodDefinition { private final int registerCount; public MethodDefinition(StringTemplateGroup stg, ClassDataItem.EncodedMethod encodedMethod) { - this.stg = stg; - this.encodedMethod = encodedMethod; - //TODO: what about try/catch blocks inside the dead code? those will need to be commented out too. ugh. - if (encodedMethod.codeItem != null) { - methodAnalyzer = new MethodAnalyzer(encodedMethod, baksmali.deodex); - List instructions = methodAnalyzer.getInstructions(); + try { + this.stg = stg; + this.encodedMethod = encodedMethod; - packedSwitchMap = new SparseIntArray(1); - sparseSwitchMap = new SparseIntArray(1); - instructionMap = new SparseIntArray(instructions.size()); + //TODO: what about try/catch blocks inside the dead code? those will need to be commented out too. ugh. - registerCount = encodedMethod.codeItem.getRegisterCount(); + if (encodedMethod.codeItem != null) { + methodAnalyzer = new MethodAnalyzer(encodedMethod, baksmali.deodex); + List instructions = methodAnalyzer.getInstructions(); - int currentCodeAddress = 0; - for (int i=0; i