Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Quincy379
jadx
提交
bd9e1096
J
jadx
项目概览
Quincy379
/
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,发现更多精彩内容 >>
提交
bd9e1096
编写于
8月 30, 2019
作者:
S
Skylot
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: handle methods with all NOPs (#744)
上级
db892adf
变更
6
显示空白变更内容
内联
并排
Showing
6 changed file
with
122 addition
and
4 deletion
+122
-4
jadx-core/src/main/java/jadx/core/dex/attributes/AFlag.java
jadx-core/src/main/java/jadx/core/dex/attributes/AFlag.java
+1
-0
jadx-core/src/main/java/jadx/core/dex/visitors/blocksmaker/BlockProcessor.java
...va/jadx/core/dex/visitors/blocksmaker/BlockProcessor.java
+1
-1
jadx-core/src/main/java/jadx/core/dex/visitors/blocksmaker/BlockSplitter.java
...ava/jadx/core/dex/visitors/blocksmaker/BlockSplitter.java
+5
-2
jadx-core/src/main/java/jadx/core/dex/visitors/regions/RegionMakerVisitor.java
...va/jadx/core/dex/visitors/regions/RegionMakerVisitor.java
+1
-1
jadx-core/src/test/java/jadx/tests/integration/others/TestAllNops.java
.../test/java/jadx/tests/integration/others/TestAllNops.java
+22
-0
jadx-core/src/test/smali/others/TestAllNops.smali
jadx-core/src/test/smali/others/TestAllNops.smali
+92
-0
未找到文件。
jadx-core/src/main/java/jadx/core/dex/attributes/AFlag.java
浏览文件 @
bd9e1096
package
jadx.core.dex.attributes
;
package
jadx.core.dex.attributes
;
public
enum
AFlag
{
public
enum
AFlag
{
MTH_ENTER_BLOCK
,
TRY_ENTER
,
TRY_ENTER
,
TRY_LEAVE
,
TRY_LEAVE
,
...
...
jadx-core/src/main/java/jadx/core/dex/visitors/blocksmaker/BlockProcessor.java
浏览文件 @
bd9e1096
...
@@ -39,7 +39,7 @@ public class BlockProcessor extends AbstractVisitor {
...
@@ -39,7 +39,7 @@ public class BlockProcessor extends AbstractVisitor {
@Override
@Override
public
void
visit
(
MethodNode
mth
)
{
public
void
visit
(
MethodNode
mth
)
{
if
(
mth
.
isNoCode
())
{
if
(
mth
.
isNoCode
()
||
mth
.
getBasicBlocks
().
isEmpty
()
)
{
return
;
return
;
}
}
processBlocksTree
(
mth
);
processBlocksTree
(
mth
);
...
...
jadx-core/src/main/java/jadx/core/dex/visitors/blocksmaker/BlockSplitter.java
浏览文件 @
bd9e1096
...
@@ -77,6 +77,7 @@ public class BlockSplitter extends AbstractVisitor {
...
@@ -77,6 +77,7 @@ public class BlockSplitter extends AbstractVisitor {
InsnNode
prevInsn
=
null
;
InsnNode
prevInsn
=
null
;
Map
<
Integer
,
BlockNode
>
blocksMap
=
new
HashMap
<>();
Map
<
Integer
,
BlockNode
>
blocksMap
=
new
HashMap
<>();
BlockNode
curBlock
=
startNewBlock
(
mth
,
0
);
BlockNode
curBlock
=
startNewBlock
(
mth
,
0
);
curBlock
.
add
(
AFlag
.
MTH_ENTER_BLOCK
);
mth
.
setEnterBlock
(
curBlock
);
mth
.
setEnterBlock
(
curBlock
);
// split into blocks
// split into blocks
...
@@ -331,7 +332,8 @@ public class BlockSplitter extends AbstractVisitor {
...
@@ -331,7 +332,8 @@ public class BlockSplitter extends AbstractVisitor {
static
boolean
removeEmptyDetachedBlocks
(
MethodNode
mth
)
{
static
boolean
removeEmptyDetachedBlocks
(
MethodNode
mth
)
{
return
mth
.
getBasicBlocks
().
removeIf
(
block
->
block
.
getInstructions
().
isEmpty
()
return
mth
.
getBasicBlocks
().
removeIf
(
block
->
block
.
getInstructions
().
isEmpty
()
&&
block
.
getPredecessors
().
isEmpty
()
&&
block
.
getPredecessors
().
isEmpty
()
&&
block
.
getSuccessors
().
isEmpty
());
&&
block
.
getSuccessors
().
isEmpty
()
&&
!
block
.
contains
(
AFlag
.
MTH_ENTER_BLOCK
));
}
}
private
static
boolean
removeUnreachableBlocks
(
MethodNode
mth
)
{
private
static
boolean
removeUnreachableBlocks
(
MethodNode
mth
)
{
...
@@ -385,7 +387,8 @@ public class BlockSplitter extends AbstractVisitor {
...
@@ -385,7 +387,8 @@ public class BlockSplitter extends AbstractVisitor {
return
block
.
getInstructions
().
isEmpty
()
return
block
.
getInstructions
().
isEmpty
()
&&
block
.
isAttrStorageEmpty
()
&&
block
.
isAttrStorageEmpty
()
&&
block
.
getSuccessors
().
size
()
<=
1
&&
block
.
getSuccessors
().
size
()
<=
1
&&
!
block
.
getPredecessors
().
isEmpty
();
&&
!
block
.
getPredecessors
().
isEmpty
()
&&
!
block
.
contains
(
AFlag
.
MTH_ENTER_BLOCK
);
}
}
private
static
void
collectSuccessors
(
BlockNode
startBlock
,
Set
<
BlockNode
>
toRemove
)
{
private
static
void
collectSuccessors
(
BlockNode
startBlock
,
Set
<
BlockNode
>
toRemove
)
{
...
...
jadx-core/src/main/java/jadx/core/dex/visitors/regions/RegionMakerVisitor.java
浏览文件 @
bd9e1096
...
@@ -39,7 +39,7 @@ public class RegionMakerVisitor extends AbstractVisitor {
...
@@ -39,7 +39,7 @@ public class RegionMakerVisitor extends AbstractVisitor {
@Override
@Override
public
void
visit
(
MethodNode
mth
)
throws
JadxException
{
public
void
visit
(
MethodNode
mth
)
throws
JadxException
{
if
(
mth
.
isNoCode
())
{
if
(
mth
.
isNoCode
()
||
mth
.
getBasicBlocks
().
isEmpty
()
)
{
return
;
return
;
}
}
RegionMaker
rm
=
new
RegionMaker
(
mth
);
RegionMaker
rm
=
new
RegionMaker
(
mth
);
...
...
jadx-core/src/test/java/jadx/tests/integration/others/TestAllNops.java
0 → 100644
浏览文件 @
bd9e1096
package
jadx.tests.integration.others
;
import
org.junit.jupiter.api.Test
;
import
jadx.core.dex.nodes.ClassNode
;
import
jadx.tests.api.SmaliTest
;
import
static
jadx
.
tests
.
api
.
utils
.
JadxMatchers
.
containsLines
;
import
static
org
.
hamcrest
.
MatcherAssert
.
assertThat
;
public
class
TestAllNops
extends
SmaliTest
{
@Test
public
void
test
()
{
disableCompilation
();
ClassNode
cls
=
getClassNodeFromSmali
();
String
code
=
cls
.
getCode
().
toString
();
assertThat
(
code
,
containsLines
(
1
,
"private boolean test() {"
,
"}"
));
assertThat
(
code
,
containsLines
(
1
,
"private boolean testWithTryCatch() {"
,
"}"
));
}
}
jadx-core/src/test/smali/others/TestAllNops.smali
0 → 100644
浏览文件 @
bd9e1096
.class public Lothers/TestAllNops;
.super Ljava/lang/Object;
.method public constructor <init>()V
.registers 1
.line 55
nop
nop
nop
nop
.end method
.method private test()Z
.registers 11
.line 1480
nop
nop
.line 1481
nop
nop
nop
nop
nop
nop
.line 1485
nop
nop
.line 1486
nop
nop
.line 1487
nop
.end method
.method private testWithTryCatch()Z
.registers 11
.line 1480
:try_start_0
nop
nop
.line 1481
nop
nop
nop
nop
nop
nop
.line 1485
nop
nop
:try_end_35
.catch Ljava/security/NoSuchAlgorithmException; {:try_start_0 .. :try_end_35} :catch_36
nop
.line 1547
:catch_36
nop
.line 1487
nop
.end method
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录