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
733836ea
Commit
733836ea
authored
Jan 13, 2015
by
NeoSpb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
core: fix processing of debug info (if local variable used before declaring a debug info)
parent
b4767626
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
1 deletion
+39
-1
DebugInfoParser.java
...main/java/jadx/core/dex/nodes/parser/DebugInfoParser.java
+15
-0
SimplifyVisitor.java
...src/main/java/jadx/core/dex/visitors/SimplifyVisitor.java
+24
-1
No files found.
jadx-core/src/main/java/jadx/core/dex/nodes/parser/DebugInfoParser.java
View file @
733836ea
...
...
@@ -212,6 +212,21 @@ public class DebugInfoParser {
prev
.
end
(
addr
,
line
);
setVar
(
prev
);
}
RegisterArg
activeReg
=
(
RegisterArg
)
activeRegisters
[
var
.
getRegNum
()];
if
(
activeReg
!=
null
)
{
SSAVar
ssaVar
=
activeReg
.
getSVar
();
if
((
ssaVar
!=
null
)
&&
(
ssaVar
.
getStartAddr
()
!=
-
1
))
{
if
(
ssaVar
.
getAssign
()
!=
null
)
{
if
(
ssaVar
.
getAssign
().
getParentInsn
()
!=
null
)
{
if
(
ssaVar
.
getAssign
().
getParentInsn
().
getOffset
()
>=
0
)
{
addr
=
ssaVar
.
getAssign
().
getParentInsn
().
getOffset
();
}
}
}
}
}
var
.
start
(
addr
,
line
);
locals
[
regNum
]
=
var
;
}
...
...
jadx-core/src/main/java/jadx/core/dex/visitors/SimplifyVisitor.java
View file @
733836ea
...
...
@@ -21,6 +21,7 @@ import jadx.core.dex.nodes.BlockNode;
import
jadx.core.dex.nodes.InsnNode
;
import
jadx.core.dex.nodes.MethodNode
;
import
jadx.core.dex.regions.conditions.IfCondition
;
import
jadx.core.utils.InsnUtils
;
import
java.util.ArrayList
;
import
java.util.Collections
;
...
...
@@ -78,9 +79,31 @@ public class SimplifyVisitor extends AbstractVisitor {
case
CHECK_CAST:
InsnArg
castArg
=
insn
.
getArg
(
0
);
ArgType
castArgType
=
castArg
.
getType
();
/*
* Don't removes CHECK_CAST for wrapped INVOKE
* if invoked method returns different type
*/
if
(
castArg
.
isInsnWrap
())
{
InsnWrapArg
castWrapArg
=
(
InsnWrapArg
)
castArg
;
InsnNode
wrapInsn
=
castWrapArg
.
getWrapInsn
();
if
(
wrapInsn
.
getType
()
==
InsnType
.
INVOKE
)
{
InvokeNode
invkInsn
=
(
InvokeNode
)
wrapInsn
;
castArgType
=
invkInsn
.
getCallMth
().
getReturnType
();
if
(
invkInsn
.
getResult
().
getType
()
!=
invkInsn
.
getCallMth
().
getReturnType
())
{
LOG
.
warn
(
"Invoke without cast at {} in {}"
,
InsnUtils
.
formatOffset
(
invkInsn
.
getOffset
()),
mth
);
}
}
}
ArgType
castType
=
(
ArgType
)
((
IndexInsnNode
)
insn
).
getIndex
();
if
(!
ArgType
.
isCastNeeded
(
castArg
.
getType
()
,
castType
))
{
if
(!
ArgType
.
isCastNeeded
(
castArg
Type
,
castType
))
{
InsnNode
insnNode
=
new
InsnNode
(
InsnType
.
MOVE
,
1
);
insnNode
.
setOffset
(
insn
.
getOffset
());
insnNode
.
setResult
(
insn
.
getResult
());
insnNode
.
addArg
(
castArg
);
return
insnNode
;
...
...
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