提交 72c301dc 编写于 作者: S Skylot

core: print error on failed method decode

上级 e8fd1e1d
......@@ -180,14 +180,19 @@ public class MethodGen {
public void addFallbackMethodCode(CodeWriter code) {
if (mth.getInstructions() == null) {
// load original instructions
try {
mth.load();
DepthTraversal.visit(new FallbackModeVisitor(), mth);
} catch (DecodeException e) {
LOG.error("Error reload instructions in fallback mode:", e);
code.startLine("// Can't loadFile method instructions: " + e.getMessage());
return;
JadxErrorAttr errorAttr = mth.get(AType.JADX_ERROR);
if (errorAttr == null
|| errorAttr.getCause() == null
|| !errorAttr.getCause().getClass().equals(DecodeException.class)) {
// load original instructions
try {
mth.load();
DepthTraversal.visit(new FallbackModeVisitor(), mth);
} catch (DecodeException e) {
LOG.error("Error reload instructions in fallback mode:", e);
code.startLine("// Can't load method instructions: " + e.getMessage());
return;
}
}
}
InsnNode[] insnArr = mth.getInstructions();
......
......@@ -222,8 +222,8 @@ public class ClassNode extends LineAttrNode implements ILoadable {
for (MethodNode mth : getMethods()) {
try {
mth.load();
} catch (DecodeException e) {
LOG.error("Method load error", e);
} catch (Exception e) {
LOG.error("Method load error:", e);
mth.addAttr(new JadxErrorAttr(e));
}
}
......
......@@ -156,7 +156,8 @@ public class ClassModifier extends AbstractVisitor {
// remove public empty constructors
if (af.isConstructor()
&& af.isPublic()
&& mth.getArguments(false).isEmpty()) {
&& mth.getArguments(false).isEmpty()
&& !mth.contains(AType.JADX_ERROR)) {
List<BlockNode> bb = mth.getBasicBlocks();
if (bb == null || bb.isEmpty() || allBlocksEmpty(bb)) {
mth.add(AFlag.DONT_GENERATE);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册