Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
keyescgm
jadx
提交
96f90e18
J
jadx
项目概览
keyescgm
/
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,发现更多精彩内容 >>
未验证
提交
96f90e18
编写于
1月 26, 2022
作者:
S
Skylot
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: improve exception handlers attach
上级
8ff18e63
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
15 addition
and
7 deletion
+15
-7
jadx-core/src/main/java/jadx/core/dex/visitors/blocks/BlockExceptionHandler.java
.../jadx/core/dex/visitors/blocks/BlockExceptionHandler.java
+10
-2
jadx-core/src/main/java/jadx/core/dex/visitors/ssa/SSATransform.java
...rc/main/java/jadx/core/dex/visitors/ssa/SSATransform.java
+5
-4
jadx-core/src/test/java/jadx/tests/integration/trycatch/TestTryCatchFinally8.java
...jadx/tests/integration/trycatch/TestTryCatchFinally8.java
+0
-1
未找到文件。
jadx-core/src/main/java/jadx/core/dex/visitors/blocks/BlockExceptionHandler.java
浏览文件 @
96f90e18
...
@@ -390,15 +390,23 @@ public class BlockExceptionHandler {
...
@@ -390,15 +390,23 @@ public class BlockExceptionHandler {
private
static
BlockNode
searchTopBlock
(
MethodNode
mth
,
List
<
BlockNode
>
blocks
)
{
private
static
BlockNode
searchTopBlock
(
MethodNode
mth
,
List
<
BlockNode
>
blocks
)
{
BlockNode
top
=
BlockUtils
.
getTopBlock
(
blocks
);
BlockNode
top
=
BlockUtils
.
getTopBlock
(
blocks
);
if
(
top
!=
null
)
{
if
(
top
!=
null
)
{
return
top
;
return
adjustTopBlock
(
top
)
;
}
}
BlockNode
topDom
=
BlockUtils
.
getCommonDominator
(
mth
,
blocks
);
BlockNode
topDom
=
BlockUtils
.
getCommonDominator
(
mth
,
blocks
);
if
(
topDom
!=
null
)
{
if
(
topDom
!=
null
)
{
return
topDom
;
return
adjustTopBlock
(
topDom
)
;
}
}
throw
new
JadxRuntimeException
(
"Failed to find top block for try-catch from: "
+
blocks
);
throw
new
JadxRuntimeException
(
"Failed to find top block for try-catch from: "
+
blocks
);
}
}
private
static
BlockNode
adjustTopBlock
(
BlockNode
topBlock
)
{
if
(
topBlock
.
getSuccessors
().
size
()
==
1
&&
!
topBlock
.
contains
(
AType
.
EXC_CATCH
))
{
// top block can be lifted by other exception handlers included in blocks list, trying to undo that
return
topBlock
.
getSuccessors
().
get
(
0
);
}
return
topBlock
;
}
@Nullable
@Nullable
private
static
BlockNode
searchBottomBlock
(
MethodNode
mth
,
List
<
BlockNode
>
blocks
)
{
private
static
BlockNode
searchBottomBlock
(
MethodNode
mth
,
List
<
BlockNode
>
blocks
)
{
// search common post-dominator block inside input set
// search common post-dominator block inside input set
...
...
jadx-core/src/main/java/jadx/core/dex/visitors/ssa/SSATransform.java
浏览文件 @
96f90e18
...
@@ -140,7 +140,7 @@ public class SSATransform extends AbstractVisitor {
...
@@ -140,7 +140,7 @@ public class SSATransform extends AbstractVisitor {
stack
.
push
(
initState
);
stack
.
push
(
initState
);
while
(!
stack
.
isEmpty
())
{
while
(!
stack
.
isEmpty
())
{
RenameState
state
=
stack
.
pop
();
RenameState
state
=
stack
.
pop
();
renameVarsInBlock
(
state
);
renameVarsInBlock
(
mth
,
state
);
for
(
BlockNode
dominated
:
state
.
getBlock
().
getDominatesOn
())
{
for
(
BlockNode
dominated
:
state
.
getBlock
().
getDominatesOn
())
{
stack
.
push
(
RenameState
.
copyFrom
(
state
,
dominated
));
stack
.
push
(
RenameState
.
copyFrom
(
state
,
dominated
));
}
}
...
@@ -156,7 +156,7 @@ public class SSATransform extends AbstractVisitor {
...
@@ -156,7 +156,7 @@ public class SSATransform extends AbstractVisitor {
}
}
}
}
private
static
void
renameVarsInBlock
(
RenameState
state
)
{
private
static
void
renameVarsInBlock
(
MethodNode
mth
,
RenameState
state
)
{
BlockNode
block
=
state
.
getBlock
();
BlockNode
block
=
state
.
getBlock
();
for
(
InsnNode
insn
:
block
.
getInstructions
())
{
for
(
InsnNode
insn
:
block
.
getInstructions
())
{
if
(
insn
.
getType
()
!=
InsnType
.
PHI
)
{
if
(
insn
.
getType
()
!=
InsnType
.
PHI
)
{
...
@@ -168,8 +168,9 @@ public class SSATransform extends AbstractVisitor {
...
@@ -168,8 +168,9 @@ public class SSATransform extends AbstractVisitor {
int
regNum
=
reg
.
getRegNum
();
int
regNum
=
reg
.
getRegNum
();
SSAVar
var
=
state
.
getVar
(
regNum
);
SSAVar
var
=
state
.
getVar
(
regNum
);
if
(
var
==
null
)
{
if
(
var
==
null
)
{
throw
new
JadxRuntimeException
(
"Not initialized variable reg: "
+
regNum
// TODO: in most cases issue in incorrectly attached exception handlers
+
", insn: "
+
insn
+
", block:"
+
block
);
mth
.
addWarnComment
(
"Not initialized variable reg: "
+
regNum
+
", insn: "
+
insn
+
", block:"
+
block
);
var
=
state
.
startVar
(
reg
);
}
}
var
.
use
(
reg
);
var
.
use
(
reg
);
}
}
...
...
jadx-core/src/test/java/jadx/tests/integration/trycatch/TestTryCatchFinally8.java
浏览文件 @
96f90e18
...
@@ -55,7 +55,6 @@ public class TestTryCatchFinally8 extends IntegrationTest {
...
@@ -55,7 +55,6 @@ public class TestTryCatchFinally8 extends IntegrationTest {
}
}
@Test
@Test
@NotYetImplemented
public
void
test2
()
{
public
void
test2
()
{
disableCompilation
();
disableCompilation
();
ClassNode
cls
=
getClassNode
(
TestCls
.
class
);
ClassNode
cls
=
getClassNode
(
TestCls
.
class
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录