Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
2301_76393173
jadx
提交
db892adf
J
jadx
项目概览
2301_76393173
/
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,体验更适合开发者的 AI 搜索 >>
提交
db892adf
编写于
8月 27, 2019
作者:
S
Skylot
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: don't run class process from visitors to avoid deadlock (#743)
上级
1cbaad3e
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
48 addition
and
45 deletion
+48
-45
jadx-core/src/main/java/jadx/core/ProcessClass.java
jadx-core/src/main/java/jadx/core/ProcessClass.java
+1
-3
jadx-core/src/main/java/jadx/core/codegen/InsnGen.java
jadx-core/src/main/java/jadx/core/codegen/InsnGen.java
+5
-18
jadx-core/src/main/java/jadx/core/dex/nodes/ClassNode.java
jadx-core/src/main/java/jadx/core/dex/nodes/ClassNode.java
+23
-12
jadx-core/src/main/java/jadx/core/dex/nodes/MethodNode.java
jadx-core/src/main/java/jadx/core/dex/nodes/MethodNode.java
+8
-8
jadx-core/src/main/java/jadx/core/dex/nodes/ProcessState.java
...-core/src/main/java/jadx/core/dex/nodes/ProcessState.java
+9
-1
jadx-core/src/main/java/jadx/core/dex/nodes/RootNode.java
jadx-core/src/main/java/jadx/core/dex/nodes/RootNode.java
+0
-1
jadx-core/src/main/java/jadx/core/dex/visitors/ModVisitor.java
...core/src/main/java/jadx/core/dex/visitors/ModVisitor.java
+0
-1
jadx-core/src/test/java/jadx/tests/api/IntegrationTest.java
jadx-core/src/test/java/jadx/tests/api/IntegrationTest.java
+2
-1
未找到文件。
jadx-core/src/main/java/jadx/core/ProcessClass.java
浏览文件 @
db892adf
...
...
@@ -14,7 +14,6 @@ import static jadx.core.dex.nodes.ProcessState.LOADED;
import
static
jadx
.
core
.
dex
.
nodes
.
ProcessState
.
NOT_LOADED
;
import
static
jadx
.
core
.
dex
.
nodes
.
ProcessState
.
PROCESS_COMPLETE
;
import
static
jadx
.
core
.
dex
.
nodes
.
ProcessState
.
PROCESS_STARTED
;
import
static
jadx
.
core
.
dex
.
nodes
.
ProcessState
.
UNLOADED
;
public
final
class
ProcessClass
{
...
...
@@ -27,8 +26,7 @@ public final class ProcessClass {
process
(
topParentClass
);
return
;
}
if
(
cls
.
getState
()
==
PROCESS_COMPLETE
||
cls
.
getState
()
==
UNLOADED
)
{
if
(
cls
.
getState
().
isProcessed
())
{
// nothing to do
return
;
}
...
...
jadx-core/src/main/java/jadx/core/codegen/InsnGen.java
浏览文件 @
db892adf
...
...
@@ -591,10 +591,8 @@ public class InsnGen {
private
void
makeConstructor
(
ConstructorInsn
insn
,
CodeWriter
code
)
throws
CodegenException
{
ClassNode
cls
=
mth
.
dex
().
resolveClass
(
insn
.
getClassType
());
if
(
cls
!=
null
)
{
cls
.
loadAndProcess
();
}
if
(
cls
!=
null
&&
cls
.
isAnonymous
()
&&
!
fallback
)
{
cls
.
ensureProcessed
();
inlineAnonymousConstructor
(
code
,
cls
,
insn
);
return
;
}
...
...
@@ -787,21 +785,10 @@ public class InsnGen {
*/
private
boolean
processOverloadedArg
(
CodeWriter
code
,
InsnNode
insn
,
MethodNode
callMth
,
InsnArg
arg
,
int
origPos
)
{
List
<
ArgType
>
argTypes
=
callMth
.
getArgTypes
();
if
(
argTypes
==
null
)
{
// try to load class
callMth
.
getParentClass
().
loadAndProcess
();
argTypes
=
callMth
.
getArgTypes
();
}
ArgType
origType
;
if
(
argTypes
==
null
)
{
mth
.
addComment
(
"JADX INFO: used method not loaded: "
+
callMth
+
", types can be incorrect"
);
origType
=
callMth
.
getMethodInfo
().
getArgumentsTypes
().
get
(
origPos
);
}
else
{
origType
=
argTypes
.
get
(
origPos
);
if
(
origType
.
isGenericType
()
&&
!
callMth
.
getParentClass
().
equals
(
mth
.
getParentClass
()))
{
// cancel cast
return
false
;
}
ArgType
origType
=
argTypes
.
get
(
origPos
);
if
(
origType
.
isGenericType
()
&&
!
callMth
.
getParentClass
().
equals
(
mth
.
getParentClass
()))
{
// cancel cast
return
false
;
}
ArgType
castType
=
null
;
if
(
insn
instanceof
CallMthInterface
&&
origType
.
containsGenericType
())
{
...
...
jadx-core/src/main/java/jadx/core/dex/nodes/ClassNode.java
浏览文件 @
db892adf
...
...
@@ -110,9 +110,10 @@ public class ClassNode extends LineAttrNode implements ILoadable, ICodeNode {
}
loadAnnotations
(
cls
);
initAccessFlags
(
cls
);
parseClassSignature
();
setFieldsTypesFromSignature
();
methods
.
forEach
(
MethodNode:
:
initMethodTypes
);
int
sfIdx
=
cls
.
getSourceFileIndex
();
if
(
sfIdx
!=
DexNode
.
NO_INDEX
)
{
...
...
@@ -120,21 +121,26 @@ public class ClassNode extends LineAttrNode implements ILoadable, ICodeNode {
addSourceFilenameAttr
(
fileName
);
}
// restore original access flags from dalvik annotation if present
int
accFlagsValue
;
Annotation
a
=
getAnnotation
(
Consts
.
DALVIK_INNER_CLASS
);
if
(
a
!=
null
)
{
accFlagsValue
=
(
Integer
)
a
.
getValues
().
get
(
"accessFlags"
);
}
else
{
accFlagsValue
=
cls
.
getAccessFlags
();
}
this
.
accessFlags
=
new
AccessInfo
(
accFlagsValue
,
AFType
.
CLASS
);
buildCache
();
}
catch
(
Exception
e
)
{
throw
new
JadxRuntimeException
(
"Error decode class: "
+
clsInfo
,
e
);
}
}
/**
* Restore original access flags from Dalvik annotation if present
*/
private
void
initAccessFlags
(
ClassDef
cls
)
{
int
accFlagsValue
;
Annotation
a
=
getAnnotation
(
Consts
.
DALVIK_INNER_CLASS
);
if
(
a
!=
null
)
{
accFlagsValue
=
(
Integer
)
a
.
getValues
().
get
(
"accessFlags"
);
}
else
{
accFlagsValue
=
cls
.
getAccessFlags
();
}
this
.
accessFlags
=
new
AccessInfo
(
accFlagsValue
,
AFType
.
CLASS
);
}
// empty synthetic class
public
ClassNode
(
DexNode
dex
,
String
name
,
int
accessFlags
)
{
this
.
dex
=
dex
;
...
...
@@ -247,8 +253,13 @@ public class ClassNode extends LineAttrNode implements ILoadable, ICodeNode {
this
.
addAttr
(
new
SourceFileAttr
(
fileName
));
}
public
void
loadAndProcess
()
{
ProcessClass
.
process
(
this
);
public
void
ensureProcessed
()
{
ClassNode
topClass
=
getTopParentClass
();
ProcessState
topState
=
topClass
.
getState
();
if
(!
topState
.
isProcessed
())
{
throw
new
JadxRuntimeException
(
"Expected class to be processed at this point,"
+
" class: "
+
topClass
+
", state: "
+
topState
);
}
}
public
synchronized
ICodeInfo
decompile
()
{
...
...
jadx-core/src/main/java/jadx/core/dex/nodes/MethodNode.java
浏览文件 @
db892adf
...
...
@@ -121,14 +121,15 @@ public class MethodNode extends LineAttrNode implements ILoadable, ICodeNode {
if
(
noCode
)
{
regsCount
=
0
;
codeSize
=
0
;
initMethodTypes
();
// TODO: registers not needed without code
initArguments
(
this
.
argTypes
);
return
;
}
DexNode
dex
=
parentClass
.
dex
();
Code
mthCode
=
dex
.
readCode
(
methodData
);
this
.
regsCount
=
mthCode
.
getRegistersSize
();
init
MethodTypes
(
);
init
Arguments
(
this
.
argTypes
);
InsnDecoder
decoder
=
new
InsnDecoder
(
this
);
decoder
.
decodeInsns
(
mthCode
);
...
...
@@ -172,7 +173,7 @@ public class MethodNode extends LineAttrNode implements ILoadable, ICodeNode {
}
}
p
rivate
void
initMethodTypes
()
{
p
ublic
void
initMethodTypes
()
{
List
<
ArgType
>
types
=
parseSignature
();
if
(
types
==
null
)
{
this
.
retType
=
mthInfo
.
getReturnType
();
...
...
@@ -180,7 +181,6 @@ public class MethodNode extends LineAttrNode implements ILoadable, ICodeNode {
}
else
{
this
.
argTypes
=
types
;
}
initArguments
(
this
.
argTypes
);
}
@Nullable
...
...
@@ -253,11 +253,11 @@ public class MethodNode extends LineAttrNode implements ILoadable, ICodeNode {
}
}
/**
* Return null only if method not yet loaded
*/
@Nullable
@NotNull
public
List
<
ArgType
>
getArgTypes
()
{
if
(
argTypes
==
null
)
{
throw
new
JadxRuntimeException
(
"Method types not initialized: "
+
this
);
}
return
argTypes
;
}
...
...
jadx-core/src/main/java/jadx/core/dex/nodes/ProcessState.java
浏览文件 @
db892adf
...
...
@@ -6,5 +6,13 @@ public enum ProcessState {
PROCESS_STARTED
,
PROCESS_COMPLETE
,
GENERATED
,
UNLOADED
UNLOADED
;
public
boolean
isLoaded
()
{
return
this
!=
NOT_LOADED
;
}
public
boolean
isProcessed
()
{
return
this
==
PROCESS_COMPLETE
||
this
==
GENERATED
||
this
==
UNLOADED
;
}
}
jadx-core/src/main/java/jadx/core/dex/nodes/RootNode.java
浏览文件 @
db892adf
...
...
@@ -276,7 +276,6 @@ public class RootNode {
public
List
<
GenericInfo
>
getClassGenerics
(
ArgType
type
)
{
ClassNode
classNode
=
resolveClass
(
ClassInfo
.
fromType
(
this
,
type
));
if
(
classNode
!=
null
)
{
classNode
.
loadAndProcess
();
return
classNode
.
getGenerics
();
}
NClass
clsDetails
=
getClsp
().
getClsDetails
(
type
);
...
...
jadx-core/src/main/java/jadx/core/dex/visitors/ModVisitor.java
浏览文件 @
db892adf
...
...
@@ -275,7 +275,6 @@ public class ModVisitor extends AbstractVisitor {
if
(!
mth
.
getParentClass
().
getInnerClasses
().
contains
(
classNode
))
{
return
;
}
classNode
.
loadAndProcess
();
Map
<
InsnArg
,
FieldNode
>
argsMap
=
getArgsToFieldsMapping
(
callMthNode
,
co
);
if
(
argsMap
.
isEmpty
()
&&
!
callMthNode
.
getArgRegs
().
isEmpty
())
{
return
;
...
...
jadx-core/src/test/java/jadx/tests/api/IntegrationTest.java
浏览文件 @
db892adf
...
...
@@ -27,6 +27,7 @@ import jadx.api.ICodeInfo;
import
jadx.api.JadxArgs
;
import
jadx.api.JadxDecompiler
;
import
jadx.api.JadxInternalAccess
;
import
jadx.core.ProcessClass
;
import
jadx.core.codegen.CodeGen
;
import
jadx.core.codegen.CodeWriter
;
import
jadx.core.dex.attributes.AFlag
;
...
...
@@ -223,7 +224,7 @@ public abstract class IntegrationTest extends TestUtils {
}
protected
void
decompileWithoutUnload
(
JadxDecompiler
jadx
,
ClassNode
cls
)
{
cls
.
loadAndProcess
(
);
ProcessClass
.
process
(
cls
);
generateClsCode
(
cls
);
// don't unload class
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录