Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
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
e3a10391
Commit
e3a10391
authored
Jun 16, 2013
by
Skylot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix codegen for arith ops, rename reserved arg names in methods
parent
8da0ba82
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
6 deletions
+22
-6
InsnGen.java
src/main/java/jadx/codegen/InsnGen.java
+1
-1
MethodGen.java
src/main/java/jadx/codegen/MethodGen.java
+1
-1
DotGraphVisitor.java
src/main/java/jadx/dex/visitors/DotGraphVisitor.java
+7
-3
ModVisitor.java
src/main/java/jadx/dex/visitors/ModVisitor.java
+13
-1
No files found.
src/main/java/jadx/codegen/InsnGen.java
View file @
e3a10391
...
...
@@ -571,7 +571,7 @@ public class InsnGen {
code
.
add
(
'('
).
add
(
v1
).
add
(
' '
).
add
(
op
.
getSymbol
()).
add
(
' '
).
add
(
v2
).
add
(
')'
);
}
else
{
String
res
=
arg
(
insn
.
getResult
());
if
(
res
.
equals
(
v1
))
{
if
(
res
.
equals
(
v1
)
&&
insn
.
getResult
().
equals
(
insn
.
getArg
(
0
))
)
{
state
.
add
(
InsnGenState
.
NO_RESULT
);
// "++" or "--"
if
(
insn
.
getArg
(
1
).
isLiteral
()
&&
(
op
==
ArithOp
.
ADD
||
op
==
ArithOp
.
SUB
))
{
...
...
src/main/java/jadx/codegen/MethodGen.java
View file @
e3a10391
...
...
@@ -194,7 +194,7 @@ public class MethodGen {
String
r
;
int
i
=
2
;
do
{
r
=
name
+
i
;
r
=
name
+
"_"
+
i
;
i
++;
}
while
(
varNames
.
contains
(
r
));
varNames
.
add
(
r
);
...
...
src/main/java/jadx/dex/visitors/DotGraphVisitor.java
View file @
e3a10391
...
...
@@ -9,6 +9,7 @@ import jadx.dex.nodes.IRegion;
import
jadx.dex.nodes.InsnNode
;
import
jadx.dex.nodes.MethodNode
;
import
jadx.dex.trycatch.ExceptionHandler
;
import
jadx.utils.BlockUtils
;
import
jadx.utils.InsnUtils
;
import
jadx.utils.Utils
;
...
...
@@ -131,9 +132,11 @@ public class DotGraphVisitor extends AbstractVisitor {
for
(
BlockNode
next
:
block
.
getDominatesOn
())
conn
.
startLine
(
makeName
(
block
)
+
" -> "
+
makeName
(
next
)
+
"[style=dotted];"
);
// // add all dominators connections
// for (BlockNode next : BlockUtils.bitsetToBlocks(mth, block.getDoms()))
// conn.startLine(makeName(block) + " -> " + makeName(next) + "[style=dotted, color=green];");
// add all dominators connections
if
(
false
)
{
for
(
BlockNode
next
:
BlockUtils
.
bitsetToBlocks
(
mth
,
block
.
getDoms
()))
conn
.
startLine
(
makeName
(
block
)
+
" -> "
+
makeName
(
next
)
+
"[style=dotted, color=green];"
);
}
}
private
String
attributesString
(
IAttributeNode
block
)
{
...
...
@@ -180,6 +183,7 @@ public class DotGraphVisitor extends AbstractVisitor {
.
replace
(
"{"
,
"\\{"
).
replace
(
"}"
,
"\\}"
)
.
replace
(
"\""
,
"\\\""
)
.
replace
(
"-"
,
"\\-"
)
.
replace
(
"|"
,
"\\|"
)
.
replace
(
"\n"
,
NL
);
}
}
src/main/java/jadx/dex/visitors/ModVisitor.java
View file @
e3a10391
package
jadx
.
dex
.
visitors
;
import
jadx.Consts
;
import
jadx.deobf.NameMapper
;
import
jadx.dex.attributes.AttributeType
;
import
jadx.dex.info.MethodInfo
;
import
jadx.dex.instructions.IndexInsnNode
;
...
...
@@ -37,9 +38,10 @@ public class ModVisitor extends AbstractVisitor {
return
;
removeStep
(
mth
);
replaceStep
(
mth
);
checkArgsNames
(
mth
);
for
(
BlockNode
block
:
mth
.
getBasicBlocks
())
{
processExceptionHander
(
mth
,
block
);
}
...
...
@@ -229,4 +231,14 @@ public class ModVisitor extends AbstractVisitor {
replaceInsn
(
block
,
pos
,
newInsn
);
return
true
;
}
private
void
checkArgsNames
(
MethodNode
mth
)
{
for
(
RegisterArg
arg
:
mth
.
getArguments
(
false
))
{
String
name
=
arg
.
getTypedVar
().
getName
();
if
(
name
!=
null
&&
NameMapper
.
isReserved
(
name
))
{
name
=
name
+
"_"
;
arg
.
getTypedVar
().
setName
(
name
);
}
}
}
}
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