update faq.md

This commit is contained in:
hengyunabc
2022-04-13 15:23:26 +08:00
parent cb36bdfe21
commit 989728d5ea
2 changed files with 21 additions and 2 deletions
+10 -1
View File
@@ -24,7 +24,7 @@ com.sun.tools.attach.AttachNotSupportedException: Unable to open socket file: ta
##### Can commands such as trace/watch enhance the classes in jdk?
By default, classes beginning with `java.` are filtered out, but they can be turned on:
By default, classes beginning with `java.` or the classes loaded by the `Bootstrap ClassLoader` are filtered out, but they can be turned on:
```bash
options unsafe true
@@ -32,6 +32,7 @@ options unsafe true
See more at [options](options.md)
> To support the jars appended by java.lang.instrument.Instrumentation#appendToBootstrapClassLoaderSearch need to enable unsafe.
##### How to view the result in `json` format
@@ -70,6 +71,14 @@ watch demo.MathGame primeFactors '{params,returnObj,throwExp}' 'params.length >0
watch demo.MathGame <init> '{params,returnObj,throwExp}' -v
```
##### How to watch or trace inner classes?
In the JVM specification the name of inner classes is `OuterClass$InnerClass`.
```bash
watch OuterClass$InnerClass
````
##### Enter Unicode characters
Convert Unicode characters to `\u` representation:
+11 -1
View File
@@ -23,7 +23,7 @@ com.sun.tools.attach.AttachNotSupportedException: Unable to open socket file: ta
4. 更多情况参考: [https://github.com/alibaba/arthas/issues/347](https://github.com/alibaba/arthas/issues/347)
##### trace/watch等命令能否增强jdk里的类?
默认情况下会过滤掉`java.`开头的类,但可以通过参数开启。
默认情况下会过滤掉`java.`开头的类和被`BootStrap ClassLoader`加载的类。可以通过参数开启。
```bash
options unsafe true
@@ -31,6 +31,8 @@ options unsafe true
更多参考 [options](options.md)
> 通过 java.lang.instrument.Instrumentation#appendToBootstrapClassLoaderSearch append到`Bootstrap ClassLoader`的jar包需要开启unsafe。
##### 怎么以`json`格式查看结果
```bash
@@ -69,6 +71,14 @@ watch demo.MathGame primeFactors '{params,returnObj,throwExp}' 'params.length >0
watch demo.MathGame <init> '{params,returnObj,throwExp}' -v
```
##### 怎样watch、trace内部类?
在JVM规范里内部类的格式是`OuterClass$InnerClass`
```bash
watch OuterClass$InnerClass
```
##### 输入中文/Unicode字符
把中文/Unicode字符转为`\u`表示方法: