sc
查看jvm已加载的类信息(Search Class简写)
命令选项
命令选项 | 描述 |
---|---|
-c, --classloader <hash> | 指定ClassLoader的哈希值 |
--classLoaderClass <class-name> | 指定ClassLoader的类名 |
-cs, --classLoaderStr <class-str> | 指定class的ClassLoader#toString() 返回值 |
-d, --details | 输出当前类的详细信息,包括这个类所加载的原始文件来源、类的声明、加载的 ClassLoader 等详细信息。 如果一个类被多个 ClassLoader 所加载,则会出现多次 |
-x, --expand <level> | 指定输出静态变量时属性的遍历深度,默认为0 |
-f, --feild | 列出所有成员字段,需要配合-d使用 |
-n, --limits <number> | 最大匹配类数量展示,默认100 |
-E, --regex | 开启正则匹配,默认是通配符匹配 |
-h, --help | 帮助 |
<class-pattern> | 类匹配模式 |
示例
bash
# 查看类详情
[arthas@13728]$ sc -d demo.MathGame
class-info demo.MathGame
code-source /C:/Users/A/.arthas/lib/3.6.6/arthas/math-game.jar
name demo.MathGame
isInterface false
isAnnotation false
isEnum false
isAnonymousClass false
isArray false
isLocalClass false
isMemberClass false
isPrimitive false
isSynthetic false
simple-name MathGame
modifier public
annotation
interfaces
super-class +-java.lang.Object
class-loader +-jdk.internal.loader.ClassLoaders$AppClassLoader@6d06d69c
+-jdk.internal.loader.ClassLoaders$PlatformClassLoader@6a056a05
classLoaderHash 6d06d69c
Affect(row-cnt:1) cost in 4 ms.
# 查看类详情、字段
[arthas@13728]$ sc -df demo.MathGame
class-info demo.MathGame
code-source /C:/Users/A/.arthas/lib/3.6.6/arthas/math-game.jar
name demo.MathGame
isInterface false
isAnnotation false
isEnum false
isAnonymousClass false
isArray false
isLocalClass false
isMemberClass false
isPrimitive false
isSynthetic false
simple-name MathGame
modifier public
annotation
interfaces
super-class +-java.lang.Object
class-loader +-jdk.internal.loader.ClassLoaders$AppClassLoader@6d06d69c
+-jdk.internal.loader.ClassLoaders$PlatformClassLoader@6a056a05
classLoaderHash 6d06d69c
fields name random
type java.util.Random
modifier private,static
value java.util.Random@177eabd5
name illegalArgumentCount
type int
modifier private
Affect(row-cnt:1) cost in 3 ms.
# 展开静态字段层级
[arthas@13728]$ sc -dfx 2 demo.MathGame
class-info demo.MathGame
code-source /C:/Users/A/.arthas/lib/3.6.6/arthas/math-game.jar
name demo.MathGame
isInterface false
isAnnotation false
isEnum false
isAnonymousClass false
isArray false
isLocalClass false
isMemberClass false
isPrimitive false
isSynthetic false
simple-name MathGame
modifier public
annotation
interfaces
super-class +-java.lang.Object
class-loader +-jdk.internal.loader.ClassLoaders$AppClassLoader@6d06d69c
+-jdk.internal.loader.ClassLoaders$PlatformClassLoader@6a056a05
classLoaderHash 6d06d69c
fields name random
type java.util.Random
modifier private,static
value @Random[
serialVersionUID=@Long[3905348978240129619],
seed=@AtomicLong[
serialVersionUID=@Long[1927816293512124184],
VM_SUPPORTS_LONG_CAS=@Boolean[true],
U=@Unsafe[jdk.internal.misc.Unsafe@374742d3],
VALUE=@Long[16],
value=@Long[123332722620040],
serialVersionUID=@Long[-8742448824652078965],
],
multiplier=@Long[25214903917],
addend=@Long[11],
mask=@Long[281474976710655],
DOUBLE_UNIT=@Double[1.1102230246251565E-16],
BadBound=@String[bound must be positive],
BadRange=@String[bound must be greater than origin]
,
BadSize=@String[size must be non-negative],
seedUniquifier=@AtomicLong[
serialVersionUID=@Long[1927816293512124184],
VM_SUPPORTS_LONG_CAS=@Boolean[true],
U=@Unsafe[jdk.internal.misc.Unsafe@374742d3],
VALUE=@Long[16],
value=@Long[9105146733113736444],
serialVersionUID=@Long[-8742448824652078965],
],
nextNextGaussian=@Double[0.0],
haveNextNextGaussian=@Boolean[false],
serialPersistentFields=@ObjectStreamField[][
@ObjectStreamField[J seed],
@ObjectStreamField[D nextNextGaussian],
@ObjectStreamField[Z haveNextNextGaussian],
],
unsafe=@Unsafe[
seedOffset=@Long[24],
]
name illegalArgumentCount
type int
modifier private
Affect(row-cnt:1) cost in 15 ms.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
提示
- class-pattern 支持全限定名,如 com.taobao.test.AAA,也支持 com/taobao/test/AAA 这样的格式
- sc默认开启了子类匹配功能(dump命令也一样),也就是说所ss有当前类的子类也会被搜索出来,想要精确的匹配,请打开options disable-sub-class true开关