Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
qq_39073359
jadx
提交
f02a33ac
J
jadx
项目概览
qq_39073359
/
jadx
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
J
jadx
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
f02a33ac
编写于
6月 19, 2019
作者:
S
Skylot
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: ignore NOPs in try-catch (#668)
上级
9c34a315
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
79 addition
and
4 deletion
+79
-4
jadx-core/src/main/java/jadx/core/dex/nodes/MethodNode.java
jadx-core/src/main/java/jadx/core/dex/nodes/MethodNode.java
+3
-4
jadx-core/src/test/java/jadx/tests/api/SmaliTest.java
jadx-core/src/test/java/jadx/tests/api/SmaliTest.java
+7
-0
jadx-core/src/test/java/jadx/tests/integration/trycatch/TestTryCatchLastInsn.java
...jadx/tests/integration/trycatch/TestTryCatchLastInsn.java
+35
-0
jadx-core/src/test/smali/trycatch/TestTryCatchLastInsn.smali
jadx-core/src/test/smali/trycatch/TestTryCatchLastInsn.smali
+34
-0
未找到文件。
jadx-core/src/main/java/jadx/core/dex/nodes/MethodNode.java
浏览文件 @
f02a33ac
...
...
@@ -29,6 +29,7 @@ import jadx.core.dex.info.MethodInfo;
import
jadx.core.dex.instructions.GotoNode
;
import
jadx.core.dex.instructions.IfNode
;
import
jadx.core.dex.instructions.InsnDecoder
;
import
jadx.core.dex.instructions.InsnType
;
import
jadx.core.dex.instructions.SwitchNode
;
import
jadx.core.dex.instructions.args.ArgType
;
import
jadx.core.dex.instructions.args.InsnArg
;
...
...
@@ -332,7 +333,7 @@ public class MethodNode extends LineAttrNode implements ILoadable, ICodeNode {
InsnNode
insn
=
null
;
while
(
offset
<=
end
&&
offset
>=
0
)
{
insn
=
insnByOffset
[
offset
];
if
(
insn
!=
null
)
{
if
(
insn
!=
null
&&
insn
.
getType
()
!=
InsnType
.
NOP
)
{
if
(
tryBlockStarted
)
{
catchBlock
.
addInsn
(
insn
);
}
else
if
(
insn
.
canThrowException
())
{
...
...
@@ -343,9 +344,7 @@ public class MethodNode extends LineAttrNode implements ILoadable, ICodeNode {
}
offset
=
InsnDecoder
.
getNextInsnOffset
(
insnByOffset
,
offset
);
}
if
(
insnByOffset
[
end
]
!=
null
)
{
insnByOffset
[
end
].
add
(
AFlag
.
TRY_LEAVE
);
}
else
if
(
insn
!=
null
)
{
if
(
tryBlockStarted
&&
insn
!=
null
)
{
insn
.
add
(
AFlag
.
TRY_LEAVE
);
}
}
...
...
jadx-core/src/test/java/jadx/tests/api/SmaliTest.java
浏览文件 @
f02a33ac
...
...
@@ -31,6 +31,13 @@ public abstract class SmaliTest extends IntegrationTest {
return
getClassNodeFromFile
(
outDex
,
clsName
);
}
/**
* Preferred method for one file smali test
*/
protected
ClassNode
getClassNodeFromSmali
()
{
return
getClassNodeFromSmaliWithPkg
(
getTestPkg
(),
getTestName
());
}
protected
ClassNode
getClassNodeFromSmali
(
String
clsName
)
{
return
getClassNodeFromSmali
(
clsName
,
clsName
);
}
...
...
jadx-core/src/test/java/jadx/tests/integration/trycatch/TestTryCatchLastInsn.java
0 → 100644
浏览文件 @
f02a33ac
package
jadx.tests.integration.trycatch
;
import
org.junit.jupiter.api.Test
;
import
jadx.core.dex.nodes.ClassNode
;
import
jadx.tests.api.SmaliTest
;
import
static
jadx
.
tests
.
api
.
utils
.
JadxMatchers
.
containsOne
;
import
static
org
.
hamcrest
.
MatcherAssert
.
assertThat
;
public
class
TestTryCatchLastInsn
extends
SmaliTest
{
// @formatter:off
/*
public Exception test() {
? r1 = "result"; // String
try {
r1 = call(); // Exception
} catch(Exception e) {
System.out.println(r1); // String
r1 = e;
}
return r1;
}
*/
// @formatter:on
@Test
public
void
test
()
{
ClassNode
cls
=
getClassNodeFromSmali
();
String
code
=
cls
.
getCode
().
toString
();
assertThat
(
code
,
containsOne
(
"return call();"
));
}
}
jadx-core/src/test/smali/trycatch/TestTryCatchLastInsn.smali
0 → 100644
浏览文件 @
f02a33ac
.class public Ltrycatch/TestTryCatchLastInsn;
.super Ljava/lang/Object;
.source "TestTryCatchLastInsn.java"
.method public test()Ljava/lang/Exception;
.registers 6
.prologue
const-string v1, "result"
:try_start
invoke-direct {p0}, Ltrycatch/TestTryCatchLastInsn;->call()Ljava/lang/Exception;
move-result-object v1
:try_end
.catch Ljava/lang/Exception; {:try_start .. :try_end} :catch
:goto_return
return-object v1
:catch
move-exception v4
sget-object v3, Ljava/lang/System;->out:Ljava/io/PrintStream;
invoke-virtual {v3, v1}, Ljava/io/PrintStream;->println(Ljava/lang/String;)V
move-object v1, v4
goto :goto_return
.end method
.method private call()Ljava/lang/Exception;
.registers 2
new-instance v0, Ljava/lang/Exception;
invoke-direct {v0}, Ljava/lang/Exception;-><init>()V
return-object v0
.end method
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录