Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
ql04210214
jadx
提交
72a50eae
J
jadx
项目概览
ql04210214
/
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,发现更多精彩内容 >>
提交
72a50eae
编写于
8月 11, 2014
作者:
S
Skylot
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
core: fix missing blocks in loop region
上级
fa37b90c
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
72 addition
and
3 deletion
+72
-3
jadx-core/src/main/java/jadx/core/dex/regions/LoopRegion.java
...-core/src/main/java/jadx/core/dex/regions/LoopRegion.java
+1
-1
jadx-core/src/main/java/jadx/core/dex/visitors/regions/RegionMaker.java
...main/java/jadx/core/dex/visitors/regions/RegionMaker.java
+16
-2
jadx-core/src/test/java/jadx/tests/internal/others/TestLoopInTry2.java
.../test/java/jadx/tests/internal/others/TestLoopInTry2.java
+55
-0
未找到文件。
jadx-core/src/main/java/jadx/core/dex/regions/LoopRegion.java
浏览文件 @
72a50eae
...
...
@@ -138,6 +138,6 @@ public final class LoopRegion extends AbstractRegion {
@Override
public
String
toString
()
{
return
"LOOP
"
;
return
"LOOP
: "
+
baseString
()
;
}
}
jadx-core/src/main/java/jadx/core/dex/visitors/regions/RegionMaker.java
浏览文件 @
72a50eae
...
...
@@ -213,7 +213,21 @@ public class RegionMaker {
}
stack
.
addExit
(
out
);
BlockNode
loopBody
=
condInfo
.
getThenBlock
();
loopRegion
.
setBody
(
makeRegion
(
loopBody
,
stack
));
Region
body
=
makeRegion
(
loopBody
,
stack
);
// add blocks from loop start to first condition block
BlockNode
conditionBlock
=
condInfo
.
getIfBlock
();
if
(
loopStart
!=
conditionBlock
)
{
Set
<
BlockNode
>
blocks
=
BlockUtils
.
getAllPathsBlocks
(
loopStart
,
conditionBlock
);
blocks
.
remove
(
conditionBlock
);
for
(
BlockNode
block
:
blocks
)
{
if
(
block
.
getInstructions
().
isEmpty
()
&&
!
block
.
contains
(
AFlag
.
SKIP
)
&&
!
RegionUtils
.
isRegionContainsBlock
(
body
,
block
))
{
body
.
add
(
block
);
}
}
}
loopRegion
.
setBody
(
body
);
}
stack
.
pop
();
return
out
;
...
...
@@ -569,7 +583,7 @@ public class RegionMaker {
Set
<
BlockNode
>
exits
=
new
HashSet
<
BlockNode
>();
for
(
BlockNode
splitter
:
splitters
)
{
for
(
BlockNode
handler
:
blocks
)
{
List
<
BlockNode
>
s
=
splitter
.
get
Clean
Successors
();
List
<
BlockNode
>
s
=
splitter
.
getSuccessors
();
if
(
s
.
isEmpty
())
{
LOG
.
debug
(
ErrorsCounter
.
formatErrorMsg
(
mth
,
"No successors for splitter: "
+
splitter
));
continue
;
...
...
jadx-core/src/test/java/jadx/tests/internal/others/TestLoopInTry2.java
0 → 100644
浏览文件 @
72a50eae
package
jadx.tests.internal.others
;
import
jadx.api.InternalJadxTest
;
import
jadx.core.dex.nodes.ClassNode
;
import
jadx.core.dex.nodes.DexNode
;
import
jadx.core.dex.nodes.MethodNode
;
import
jadx.core.utils.exceptions.DecodeException
;
import
java.io.EOFException
;
import
org.junit.Test
;
import
com.android.dex.Code
;
import
com.android.dx.io.instructions.DecodedInstruction
;
import
com.android.dx.io.instructions.ShortArrayCodeInput
;
import
static
jadx
.
tests
.
utils
.
JadxMatchers
.
containsOne
;
import
static
org
.
junit
.
Assert
.
assertThat
;
public
class
TestLoopInTry2
extends
InternalJadxTest
{
public
static
class
TestCls
{
private
MethodNode
method
;
private
DexNode
dex
;
private
DecodedInstruction
[]
insnArr
;
public
void
test
(
Code
mthCode
)
throws
DecodeException
{
short
[]
encodedInstructions
=
mthCode
.
getInstructions
();
int
size
=
encodedInstructions
.
length
;
DecodedInstruction
[]
decoded
=
new
DecodedInstruction
[
size
];
ShortArrayCodeInput
in
=
new
ShortArrayCodeInput
(
encodedInstructions
);
try
{
while
(
in
.
hasMore
())
{
decoded
[
in
.
cursor
()]
=
DecodedInstruction
.
decode
(
in
);
}
}
catch
(
EOFException
e
)
{
throw
new
DecodeException
(
method
,
""
,
e
);
}
insnArr
=
decoded
;
}
}
@Test
public
void
test
()
{
ClassNode
cls
=
getClassNode
(
TestCls
.
class
);
String
code
=
cls
.
getCode
().
toString
();
System
.
out
.
println
(
code
);
assertThat
(
code
,
containsOne
(
"try {"
));
assertThat
(
code
,
containsOne
(
"while (in.hasMore()) {"
));
assertThat
(
code
,
containsOne
(
"decoded[in.cursor()] = DecodedInstruction.decode(in);"
));
assertThat
(
code
,
containsOne
(
"} catch (EOFException e) {"
));
assertThat
(
code
,
containsOne
(
"throw new DecodeException"
));
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录