Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
J
jadx
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open-source
jadx
Commits
b861151f
Commit
b861151f
authored
Aug 04, 2018
by
Skylot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
core: rollback finally block extraction if some blocks not removed (#327)
parent
feeafc40
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
5 deletions
+31
-5
BlockNode.java
jadx-core/src/main/java/jadx/core/dex/nodes/BlockNode.java
+4
-0
BlockFinallyExtract.java
...dx/core/dex/visitors/blocksmaker/BlockFinallyExtract.java
+13
-2
BlocksRemoveInfo.java
...re/dex/visitors/blocksmaker/helpers/BlocksRemoveInfo.java
+14
-3
No files found.
jadx-core/src/main/java/jadx/core/dex/nodes/BlockNode.java
View file @
b861151f
...
...
@@ -14,6 +14,7 @@ import jadx.core.dex.attributes.nodes.LoopInfo;
import
jadx.core.utils.BlockUtils
;
import
jadx.core.utils.EmptyBitSet
;
import
jadx.core.utils.InsnUtils
;
import
jadx.core.utils.exceptions.JadxRuntimeException
;
import
static
jadx
.
core
.
utils
.
Utils
.
lockList
;
...
...
@@ -70,6 +71,9 @@ public class BlockNode extends AttrNode implements IBlock {
successors
=
lockList
(
successors
);
predecessors
=
lockList
(
predecessors
);
dominatesOn
=
lockList
(
dominatesOn
);
if
(
domFrontier
==
null
)
{
throw
new
JadxRuntimeException
(
"Dominance frontier not set for block: "
+
this
);
}
}
/**
...
...
jadx-core/src/main/java/jadx/core/dex/visitors/blocksmaker/BlockFinallyExtract.java
View file @
b861151f
...
...
@@ -8,6 +8,7 @@ import java.util.LinkedList;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
import
java.util.stream.Collectors
;
import
org.jetbrains.annotations.NotNull
;
import
org.jetbrains.annotations.Nullable
;
...
...
@@ -194,11 +195,21 @@ public class BlockFinallyExtract extends AbstractVisitor {
laBefore
.
runAnalysis
();
}
int
removeApplied
=
0
;
for
(
BlocksRemoveInfo
removeInfo
:
removes
)
{
if
(!
applyRemove
(
mth
,
removeInfo
))
{
return
false
;
if
(
applyRemove
(
mth
,
removeInfo
))
{
removeApplied
++;
removeInfo
.
setApplied
(
true
);
}
}
if
(
removeApplied
==
0
)
{
return
false
;
}
if
(
removeApplied
!=
removes
.
size
())
{
throw
new
JadxRuntimeException
(
"Some finally instructions failed to remove: "
+
removes
.
stream
().
filter
(
n
->
!
n
.
isApplied
()).
map
(
BlocksRemoveInfo:
:
toString
).
collect
(
Collectors
.
joining
(
","
))
);
}
LiveVarAnalysis
laAfter
=
null
;
...
...
jadx-core/src/main/java/jadx/core/dex/visitors/blocksmaker/helpers/BlocksRemoveInfo.java
View file @
b861151f
...
...
@@ -23,6 +23,8 @@ public final class BlocksRemoveInfo {
private
BlockNode
startPredecessor
;
private
boolean
applied
;
public
BlocksRemoveInfo
(
BlocksPair
start
)
{
this
.
start
=
start
;
}
...
...
@@ -99,13 +101,22 @@ public final class BlocksRemoveInfo {
return
null
;
}
public
boolean
isApplied
()
{
return
applied
;
}
public
void
setApplied
(
boolean
applied
)
{
this
.
applied
=
applied
;
}
@Override
public
String
toString
()
{
return
"BRI
start: "
+
start
return
"BRI
{
start: "
+
start
+
", end: "
+
end
+
",
list
: "
+
processed
+
",
processed
: "
+
processed
+
", outs: "
+
outs
+
", regMap: "
+
regMap
+
", split: "
+
startSplitIndex
;
+
", split: "
+
startSplitIndex
+
"-"
+
endSplitIndex
+
"}"
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment