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
4c4af792
Commit
4c4af792
authored
Mar 19, 2014
by
Skylot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
core: fix dot graph dump
parent
a0d8d9fc
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
147 additions
and
168 deletions
+147
-168
Decompiler.java
jadx-core/src/main/java/jadx/api/Decompiler.java
+5
-15
DotGraphVisitor.java
...src/main/java/jadx/core/dex/visitors/DotGraphVisitor.java
+142
-153
No files found.
jadx-core/src/main/java/jadx/api/Decompiler.java
View file @
4c4af792
...
@@ -8,7 +8,6 @@ import jadx.core.dex.nodes.RootNode;
...
@@ -8,7 +8,6 @@ import jadx.core.dex.nodes.RootNode;
import
jadx.core.dex.visitors.IDexTreeVisitor
;
import
jadx.core.dex.visitors.IDexTreeVisitor
;
import
jadx.core.dex.visitors.SaveCode
;
import
jadx.core.dex.visitors.SaveCode
;
import
jadx.core.utils.ErrorsCounter
;
import
jadx.core.utils.ErrorsCounter
;
import
jadx.core.utils.exceptions.CodegenException
;
import
jadx.core.utils.exceptions.DecodeException
;
import
jadx.core.utils.exceptions.DecodeException
;
import
jadx.core.utils.exceptions.JadxRuntimeException
;
import
jadx.core.utils.exceptions.JadxRuntimeException
;
import
jadx.core.utils.files.InputFile
;
import
jadx.core.utils.files.InputFile
;
...
@@ -116,21 +115,12 @@ public final class Decompiler {
...
@@ -116,21 +115,12 @@ public final class Decompiler {
LOG
.
info
(
"processing ..."
);
LOG
.
info
(
"processing ..."
);
ThreadPoolExecutor
executor
=
(
ThreadPoolExecutor
)
Executors
.
newFixedThreadPool
(
threadsCount
);
ThreadPoolExecutor
executor
=
(
ThreadPoolExecutor
)
Executors
.
newFixedThreadPool
(
threadsCount
);
for
(
final
ClassNode
cls
:
root
.
getClasses
(
false
))
{
for
(
final
ClassNode
cls
:
root
.
getClasses
(
false
))
{
if
(
cls
.
getCode
()
==
null
)
{
executor
.
execute
(
new
Runnable
()
{
Runnable
job
=
new
Runnable
()
{
@Override
@Override
public
void
run
()
{
public
void
run
()
{
ProcessClass
.
process
(
cls
,
passList
);
ProcessClass
.
process
(
cls
,
passList
);
}
}
};
});
executor
.
execute
(
job
);
}
else
{
try
{
savePass
.
visit
(
cls
);
}
catch
(
CodegenException
e
)
{
LOG
.
error
(
"Can't save class {}"
,
cls
,
e
);
}
}
}
}
executor
.
shutdown
();
executor
.
shutdown
();
return
executor
;
return
executor
;
...
...
jadx-core/src/main/java/jadx/core/dex/visitors/DotGraphVisitor.java
View file @
4c4af792
...
@@ -23,15 +23,11 @@ import java.util.Set;
...
@@ -23,15 +23,11 @@ import java.util.Set;
public
class
DotGraphVisitor
extends
AbstractVisitor
{
public
class
DotGraphVisitor
extends
AbstractVisitor
{
private
static
final
String
NL
=
"\\l"
;
private
static
final
String
NL
=
"\\l"
;
private
static
final
boolean
PRINT_REGISTERS_STATES
=
false
;
private
final
File
dir
;
private
final
File
dir
;
private
final
boolean
useRegions
;
private
final
boolean
useRegions
;
private
final
boolean
rawInsn
;
private
final
boolean
rawInsn
;
private
CodeWriter
dot
;
private
CodeWriter
conn
;
public
DotGraphVisitor
(
File
outDir
,
boolean
useRegions
,
boolean
rawInsn
)
{
public
DotGraphVisitor
(
File
outDir
,
boolean
useRegions
,
boolean
rawInsn
)
{
this
.
dir
=
outDir
;
this
.
dir
=
outDir
;
this
.
useRegions
=
useRegions
;
this
.
useRegions
=
useRegions
;
...
@@ -47,9 +43,14 @@ public class DotGraphVisitor extends AbstractVisitor {
...
@@ -47,9 +43,14 @@ public class DotGraphVisitor extends AbstractVisitor {
if
(
mth
.
isNoCode
())
{
if
(
mth
.
isNoCode
())
{
return
;
return
;
}
}
dot
=
new
CodeWriter
();
new
DumpDotGraph
().
process
(
mth
);
conn
=
new
CodeWriter
();
}
private
class
DumpDotGraph
{
private
CodeWriter
dot
=
new
CodeWriter
();
private
CodeWriter
conn
=
new
CodeWriter
();
public
void
process
(
MethodNode
mth
)
{
dot
.
startLine
(
"digraph \"CFG for"
);
dot
.
startLine
(
"digraph \"CFG for"
);
dot
.
add
(
escape
(
mth
.
getParentClass
().
getFullName
()
+
"."
+
mth
.
getMethodInfo
().
getShortId
()));
dot
.
add
(
escape
(
mth
.
getParentClass
().
getFullName
()
+
"."
+
mth
.
getMethodInfo
().
getShortId
()));
dot
.
add
(
"\" {"
);
dot
.
add
(
"\" {"
);
...
@@ -61,7 +62,7 @@ public class DotGraphVisitor extends AbstractVisitor {
...
@@ -61,7 +62,7 @@ public class DotGraphVisitor extends AbstractVisitor {
processMethodRegion
(
mth
);
processMethodRegion
(
mth
);
}
else
{
}
else
{
for
(
BlockNode
block
:
mth
.
getBasicBlocks
())
{
for
(
BlockNode
block
:
mth
.
getBasicBlocks
())
{
processBlock
(
mth
,
block
);
processBlock
(
mth
,
block
,
false
);
}
}
}
}
...
@@ -131,25 +132,12 @@ public class DotGraphVisitor extends AbstractVisitor {
...
@@ -131,25 +132,12 @@ public class DotGraphVisitor extends AbstractVisitor {
dot
.
startLine
(
'}'
);
dot
.
startLine
(
'}'
);
}
else
if
(
region
instanceof
BlockNode
)
{
}
else
if
(
region
instanceof
BlockNode
)
{
processBlock
(
mth
,
(
BlockNode
)
region
);
processBlock
(
mth
,
(
BlockNode
)
region
,
false
);
}
}
}
private
void
processBlock
(
MethodNode
mth
,
BlockNode
block
)
{
processBlock
(
mth
,
block
,
false
);
}
}
private
void
processBlock
(
MethodNode
mth
,
BlockNode
block
,
boolean
error
)
{
private
void
processBlock
(
MethodNode
mth
,
BlockNode
block
,
boolean
error
)
{
String
attrs
=
attributesString
(
block
);
String
attrs
=
attributesString
(
block
);
if
(
PRINT_REGISTERS_STATES
)
{
if
(
block
.
getStartState
()
!=
null
)
{
if
(
attrs
.
length
()
!=
0
)
{
attrs
+=
"|"
;
}
attrs
+=
escape
(
"RS: "
+
block
.
getStartState
())
+
NL
;
attrs
+=
escape
(
"RE: "
+
block
.
getEndState
())
+
NL
;
}
}
dot
.
startLine
(
makeName
(
block
));
dot
.
startLine
(
makeName
(
block
));
dot
.
add
(
" [shape=record,"
);
dot
.
add
(
" [shape=record,"
);
if
(
error
)
{
if
(
error
)
{
...
@@ -189,7 +177,7 @@ public class DotGraphVisitor extends AbstractVisitor {
...
@@ -189,7 +177,7 @@ public class DotGraphVisitor extends AbstractVisitor {
return
attrs
.
toString
();
return
attrs
.
toString
();
}
}
private
static
String
makeName
(
IContainer
c
)
{
private
String
makeName
(
IContainer
c
)
{
String
name
;
String
name
;
if
(
c
instanceof
BlockNode
)
{
if
(
c
instanceof
BlockNode
)
{
name
=
"Node_"
+
((
BlockNode
)
c
).
getId
();
name
=
"Node_"
+
((
BlockNode
)
c
).
getId
();
...
@@ -218,7 +206,7 @@ public class DotGraphVisitor extends AbstractVisitor {
...
@@ -218,7 +206,7 @@ public class DotGraphVisitor extends AbstractVisitor {
}
}
}
}
private
static
String
escape
(
String
string
)
{
private
String
escape
(
String
string
)
{
return
string
return
string
.
replace
(
"\\"
,
""
)
// TODO replace \"
.
replace
(
"\\"
,
""
)
// TODO replace \"
.
replace
(
"/"
,
"\\/"
)
.
replace
(
"/"
,
"\\/"
)
...
@@ -229,4 +217,5 @@ public class DotGraphVisitor extends AbstractVisitor {
...
@@ -229,4 +217,5 @@ public class DotGraphVisitor extends AbstractVisitor {
.
replace
(
"|"
,
"\\|"
)
.
replace
(
"|"
,
"\\|"
)
.
replace
(
"\n"
,
NL
);
.
replace
(
"\n"
,
NL
);
}
}
}
}
}
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