diff --git a/README.html b/README.html index 39954cb2a..11c17bd3b 100644 --- a/README.html +++ b/README.html @@ -8,7 +8,7 @@ - <no title> — Arthas 3.4.5 文档 + <no title> — Arthas 3.4.6 文档 @@ -72,7 +72,7 @@
- 3.4.5 + 3.4.6
@@ -101,7 +101,8 @@
  • 招聘!
  • 技术征文
  • English Docs
  • -
  • 在线教程(推荐)
  • +
  • 在线教程(国内)
  • +
  • 在线教程(国外)
  • 安装
  • 下载
  • 快速入门
  • diff --git a/_sources/advanced-use.md.txt b/_sources/advanced-use.md.txt index b751cc77e..27138c8bc 100644 --- a/_sources/advanced-use.md.txt +++ b/_sources/advanced-use.md.txt @@ -8,6 +8,7 @@ * [cat](cat.md)——打印文件内容,和linux里的cat命令类似 * [echo](echo.md)--打印参数,和linux里的echo命令类似 * [grep](grep.md)——匹配查找,和linux里的grep命令类似 +* [base64](base64.md)——base64编码转换,和linux里的base64命令类似 * [tee](tee.md)——复制标准输入到标准输出和指定的文件,和linux里的tee命令类似 * [pwd](pwd.md)——返回当前的工作目录,和linux命令类似 * cls——清空当前屏幕区域 @@ -42,6 +43,7 @@ * [sm](sm.md)——查看已加载类的方法信息 * [jad](jad.md)——反编译指定已加载类的源码 * [mc](mc.md)——内存编译器,内存编译`.java`文件为`.class`文件 +* [retransform](retransform.md)——加载外部的`.class`文件,retransform到JVM里 * [redefine](redefine.md)——加载外部的`.class`文件,redefine到JVM里 * [dump](dump.md)——dump 已加载类的 byte code 到特定目录 * [classloader](classloader.md)——查看classloader的继承树,urls,类加载信息,使用classloader去getResource diff --git a/_sources/commands.md.txt b/_sources/commands.md.txt index a48066d8a..7077aacfc 100644 --- a/_sources/commands.md.txt +++ b/_sources/commands.md.txt @@ -22,6 +22,7 @@ * [jad](jad.md) * [classloader](classloader.md) * [mc](mc.md) +* [retransform](retransform.md) * [redefine](redefine.md) * [monitor](monitor.md) @@ -35,6 +36,7 @@ * [cat](cat.md) * [echo](echo.md) * [grep](grep.md) +* [base64](base64.md) * [tee](tee.md) * [pwd](pwd.md) * [options](options.md) diff --git a/_sources/faq.md.txt b/_sources/faq.md.txt index 2a7d679c7..4462e545d 100644 --- a/_sources/faq.md.txt +++ b/_sources/faq.md.txt @@ -9,6 +9,16 @@ [https://github.com/alibaba/arthas/issues/44](https://github.com/alibaba/arthas/issues/44) +##### trace/watch等命令能否增强jdk里的类? + +默认情况下会过滤掉`java.`开头的类,但可以通过参数开启。 + +```bash +options unsafe true +``` + +更多参考 [options](options.md) + ##### 怎么以`json`格式查看结果 ```bash @@ -25,4 +35,31 @@ options json-format true ##### 能不能查看内存里某个变量的值 -不能。但可以用一些技巧,用`tt`命令拦截到对象,或者从静态函数里取到对象。 \ No newline at end of file +不能。但可以用一些技巧,用`tt`命令拦截到对象,或者从静态函数里取到对象。 + + +##### 方法同名过滤 + +同名方法过滤可以通过匹配表达式,可以使用[表达式核心变量](advice-class.md)中所有变量作为已知条件,可以通过判断参数个数`params.length ==1`, 参数类型`params[0] instanceof java.lang.Integer`、返回值类型 `returnObj instanceof java.util.List` 等等一种或者多种组合进行过滤。 + +可以使用 `-v` 查看观察匹配表达式的执行结果 [https://github.com/alibaba/arthas/issues/1348](https://github.com/alibaba/arthas/issues/1348) + +例子[arthas-demo](quick-start.md) + +```bash +watch demo.MathGame primeFactors traceE '{params,returnObj,throwExp}' -v -n 5 -x 3 'params.length >0 && returnObj instanceof java.util.List' +``` + +##### 怎么watch、trace 构造函数 ? + +```bash +watch demo.MathGame '{params,returnObj,throwExp}' -v -n 5 -x 3 '1==1' +``` + + +##### java.lang.ClassFormatError: null、skywalking arthas 兼容使用 + +当出现这个错误日志`java.lang.ClassFormatError: null`,通常情况下都是被其他字节码工具修改过与arthas修改字节码不兼容。 + +比如: 使用 skywalking V8.1.0 以下版本 [无法trace、watch 被skywalking agent 增强过的类](https://github.com/alibaba/arthas/issues/1141), V8.1.0 以上版本可以兼容使用,更多参考skywalking配置 [skywalking compatible with other javaagent bytecode processing](https://github.com/apache/skywalking/blob/v8.1.0/docs/en/FAQ/Compatible-with-other-javaagent-bytecode-processing.md)。 + diff --git a/_sources/index.md.txt b/_sources/index.md.txt index 6bd8604b7..47fa3f149 100644 --- a/_sources/index.md.txt +++ b/_sources/index.md.txt @@ -31,7 +31,8 @@ Contents * [招聘!](https://mp.weixin.qq.com/s/k5jozrSgmyH0tcQfrDkxUQ) * [技术征文!](https://developer.aliyun.com/article/751641) * [English Docs](https://arthas.aliyun.com/doc/en/) -* [在线教程(推荐)](https://arthas.aliyun.com/doc/arthas-tutorials.html?language=cn) +* [在线教程(国内)](https://start.aliyun.com/handson-lab/#!category=arthas) +* [在线教程(国外)](https://arthas.aliyun.com/doc/arthas-tutorials.html?language=cn) * [安装](install-detail.md) * [下载](download.md) * [快速入门](quick-start.md) diff --git a/_sources/jad.md.txt b/_sources/jad.md.txt index 5fea91ed9..b4efd4a94 100644 --- a/_sources/jad.md.txt +++ b/_sources/jad.md.txt @@ -57,7 +57,7 @@ CharSequence { #### 反编译时只显示源代码 -默认情况下,反编译结果里会带有`ClassLoader`信息,通过`--source-only`选项,可以只打印源代码。方便和[mc](mc.md)/[redefine](redefine.md)命令结合使用。 +默认情况下,反编译结果里会带有`ClassLoader`信息,通过`--source-only`选项,可以只打印源代码。方便和[mc](mc.md)/[retransform](retransform.md)命令结合使用。 ``` $ jad --source-only demo.MathGame diff --git a/_sources/mc.md.txt b/_sources/mc.md.txt index a50c5b9a0..a479b56b3 100644 --- a/_sources/mc.md.txt +++ b/_sources/mc.md.txt @@ -30,6 +30,6 @@ Affect(row-cnt:1) cost in 346 ms mc -d /tmp/output /tmp/ClassA.java /tmp/ClassB.java ``` -编译生成`.class`文件之后,可以结合[redefine](redefine.md)命令实现热更新代码。 +编译生成`.class`文件之后,可以结合[retransform](retransform.md)命令实现热更新代码。 -> 注意,mc命令有可能失败。如果编译失败可以在本地编译好`.class`文件,再上传到服务器。具体参考[redefine](redefine.md)命令说明。 \ No newline at end of file +> 注意,mc命令有可能失败。如果编译失败可以在本地编译好`.class`文件,再上传到服务器。具体参考[retransform](retransform.md)命令说明。 \ No newline at end of file diff --git a/_sources/redefine.md.txt b/_sources/redefine.md.txt index 872d74cad..fcfc212d8 100644 --- a/_sources/redefine.md.txt +++ b/_sources/redefine.md.txt @@ -1,6 +1,8 @@ redefine === +> 推荐使用 [retransform](retransform.md) 命令 + [`mc-redefine`在线教程](https://arthas.aliyun.com/doc/arthas-tutorials?language=cn&id=command-mc-redefine) > 加载外部的`.class`文件,redefine jvm已加载的类。 @@ -9,6 +11,8 @@ redefine ### 常见问题 +> 推荐使用 [retransform](retransform.md) 命令 + * redefine的class不能修改、添加、删除类的field和method,包括方法参数、方法名称及返回值 * 如果mc失败,可以在本地开发环境编译好class文件,上传到目标系统,使用redefine热加载class @@ -28,9 +32,6 @@ redefine |---:|:---| |[c:]|ClassLoader的hashcode| |`[classLoaderClass:]`|指定执行表达式的 ClassLoader 的 class name| -|[p:]|外部的`.class`文件的完整路径,支持多个| - - ### 使用参考 diff --git a/_sources/tt.md.txt b/_sources/tt.md.txt index bb3ea4580..165d65c9e 100644 --- a/_sources/tt.md.txt +++ b/_sources/tt.md.txt @@ -175,6 +175,44 @@ Affect(row-cnt:1) cost in 14 ms. 你会发现结果虽然一样,但调用的路径发生了变化,由原来的程序发起变成了 Arthas 自己的内部线程发起的调用了。 + +#### 观察表达式 + +`-w, --watch-express` 观察时空隧道使用`ognl` 表达式 + +* 使用[表达式核心变量](advice-class.md)中所有变量作为已知条件编写表达式。 + +```bash +[arthas@10718]$ tt -t demo.MathGame run -n 5 +Press Q or Ctrl+C to abort. +Affect(class count: 1 , method count: 1) cost in 56 ms, listenerId: 1 + INDEX TIMESTAMP COST(ms) IS-RET IS-EXP OBJECT CLASS METHOD +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 1000 2021-01-08 21:54:17 0.901091 true false 0x7699a589 MathGame run +[arthas@10718]$ tt -w 'target.illegalArgumentCount' -x 1 -i 1000 +@Integer[60] +Affect(row-cnt:1) cost in 7 ms. +``` + +* 获取类的静态字段、调用类的静态方法 + +```bash +[arthas@10718]$ tt -t demo.MathGame run -n 5 +Press Q or Ctrl+C to abort. +Affect(class count: 1 , method count: 1) cost in 56 ms, listenerId: 1 + INDEX TIMESTAMP COST(ms) IS-RET IS-EXP OBJECT CLASS METHOD +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 1000 2021-01-08 21:54:17 0.901091 true false 0x7699a589 MathGame run +[arthas@10718]$ tt -w '@demo.MathGame@random.nextInt(100)' -x 1 -i 1000 +@Integer[46] +``` + +注意这里使用 `com.taobao.arthas.core.advisor.Advice#getLoader`加载,使用精确`classloader` [ognl](ognl.md)更好。 + + +高级用法 [获取spring context 调用bean 方法](https://github.com/alibaba/arthas/issues/482) + + - 需要强调的点 1. **ThreadLocal 信息丢失** diff --git a/_sources/watch.md.txt b/_sources/watch.md.txt index e843dbc7f..85937ac33 100644 --- a/_sources/watch.md.txt +++ b/_sources/watch.md.txt @@ -235,6 +235,23 @@ ts=2018-12-03 20:04:34; [cost=131.303498ms] result=@Integer[8] ts=2018-12-03 20:04:35; [cost=0.961441ms] result=@Integer[8] ``` +#### 获取类的静态字段、调用类的静态方法的例子 + +```bash +watch demo.MathGame * '{params,@demo.MathGame@random.nextInt(100)}' -v -n 1 -x 2 +[arthas@6527]$ watch demo.MathGame * '{params,@demo.MathGame@random.nextInt(100)}' -n 1 -x 2 +Press Q or Ctrl+C to abort. +Affect(class count: 1 , method count: 5) cost in 34 ms, listenerId: 3 +ts=2021-01-05 21:35:20; [cost=0.173966ms] result=@ArrayList[ + @Object[][ + @Integer[-138282], + ], + @Integer[89], +] +``` + +* 注意这里使用 `Thread.currentThread().getContextClassLoader()` 加载,使用精确`classloader` [ognl](ognl.md)更好。 + #### 排除掉指定的类 > watch/trace/monitor/stack/tt 命令都支持 `--exclude-class-pattern` 参数 diff --git a/_static/documentation_options.js b/_static/documentation_options.js index e6be489f9..9b381ba59 100644 --- a/_static/documentation_options.js +++ b/_static/documentation_options.js @@ -1,6 +1,6 @@ var DOCUMENTATION_OPTIONS = { URL_ROOT: document.getElementById("documentation_options").getAttribute('data-url_root'), - VERSION: '3.4.5', + VERSION: '3.4.6', LANGUAGE: 'zh_CN', COLLAPSE_INDEX: false, FILE_SUFFIX: '.html', diff --git a/advanced-use.html b/advanced-use.html index bb31ea4ba..ec705eb41 100644 --- a/advanced-use.html +++ b/advanced-use.html @@ -8,7 +8,7 @@ - 进阶使用 — Arthas 3.4.5 文档 + 进阶使用 — Arthas 3.4.6 文档 @@ -74,7 +74,7 @@
    - 3.4.5 + 3.4.6
    @@ -103,7 +103,8 @@
  • 招聘!
  • 技术征文
  • English Docs
  • -
  • 在线教程(推荐)
  • +
  • 在线教程(国内)
  • +
  • 在线教程(国外)
  • 安装
  • 下载
  • 快速入门
  • @@ -227,6 +228,7 @@
  • cat——打印文件内容,和linux里的cat命令类似

  • echo–打印参数,和linux里的echo命令类似

  • grep——匹配查找,和linux里的grep命令类似

  • +
  • base64——base64编码转换,和linux里的base64命令类似

  • tee——复制标准输入到标准输出和指定的文件,和linux里的tee命令类似

  • pwd——返回当前的工作目录,和linux命令类似

  • cls——清空当前屏幕区域

  • @@ -263,6 +265,7 @@
  • sm——查看已加载类的方法信息

  • jad——反编译指定已加载类的源码

  • mc——内存编译器,内存编译.java文件为.class文件

  • +
  • retransform——加载外部的.class文件,retransform到JVM里

  • redefine——加载外部的.class文件,redefine到JVM里

  • dump——dump 已加载类的 byte code 到特定目录

  • classloader——查看classloader的继承树,urls,类加载信息,使用classloader去getResource

  • diff --git a/advice-class.html b/advice-class.html index 905e42df1..5dfdfe0f8 100644 --- a/advice-class.html +++ b/advice-class.html @@ -8,7 +8,7 @@ - 表达式核心变量 — Arthas 3.4.5 文档 + 表达式核心变量 — Arthas 3.4.6 文档 @@ -72,7 +72,7 @@
    - 3.4.5 + 3.4.6
    @@ -101,7 +101,8 @@
  • 招聘!
  • 技术征文
  • English Docs
  • -
  • 在线教程(推荐)
  • +
  • 在线教程(国内)
  • +
  • 在线教程(国外)
  • 安装
  • 下载
  • 快速入门
  • diff --git a/agent.html b/agent.html index d1524052b..59aa8c179 100644 --- a/agent.html +++ b/agent.html @@ -8,7 +8,7 @@ - 以Java Agent的方式启动 — Arthas 3.4.5 文档 + 以Java Agent的方式启动 — Arthas 3.4.6 文档 @@ -74,7 +74,7 @@
    - 3.4.5 + 3.4.6
    @@ -103,7 +103,8 @@
  • 招聘!
  • 技术征文
  • English Docs
  • -
  • 在线教程(推荐)
  • +
  • 在线教程(国内)
  • +
  • 在线教程(国外)
  • 安装
  • 下载
  • 快速入门
  • diff --git a/arthas-properties.html b/arthas-properties.html index 6d86508e5..117056fc4 100644 --- a/arthas-properties.html +++ b/arthas-properties.html @@ -8,7 +8,7 @@ - Arthas Properties — Arthas 3.4.5 文档 + Arthas Properties — Arthas 3.4.6 文档 @@ -74,7 +74,7 @@
    - 3.4.5 + 3.4.6
    @@ -103,7 +103,8 @@
  • 招聘!
  • 技术征文
  • English Docs
  • -
  • 在线教程(推荐)
  • +
  • 在线教程(国内)
  • +
  • 在线教程(国外)
  • 安装
  • 下载
  • 快速入门
  • diff --git a/arthas3.html b/arthas3.html index 1d76b7444..cfc3183ef 100644 --- a/arthas3.html +++ b/arthas3.html @@ -8,7 +8,7 @@ - Arthas3.0的新特性 — Arthas 3.4.5 文档 + Arthas3.0的新特性 — Arthas 3.4.6 文档 @@ -72,7 +72,7 @@
    - 3.4.5 + 3.4.6
    @@ -101,7 +101,8 @@
  • 招聘!
  • 技术征文
  • English Docs
  • -
  • 在线教程(推荐)
  • +
  • 在线教程(国内)
  • +
  • 在线教程(国外)
  • 安装
  • 下载
  • 快速入门
  • diff --git a/arthas_3_0/new_feature.html b/arthas_3_0/new_feature.html index d0d53eae2..426847662 100644 --- a/arthas_3_0/new_feature.html +++ b/arthas_3_0/new_feature.html @@ -8,7 +8,7 @@ - Arthas 3.0新特性介绍 — Arthas 3.4.5 文档 + Arthas 3.0新特性介绍 — Arthas 3.4.6 文档 @@ -72,7 +72,7 @@
    - 3.4.5 + 3.4.6
    @@ -101,7 +101,8 @@
  • 招聘!
  • 技术征文
  • English Docs
  • -
  • 在线教程(推荐)
  • +
  • 在线教程(国内)
  • +
  • 在线教程(国外)
  • 安装
  • 下载
  • 快速入门
  • diff --git a/async.html b/async.html index 1c9d53689..ead8f5a31 100644 --- a/async.html +++ b/async.html @@ -8,7 +8,7 @@ - Arthas后台异步任务 — Arthas 3.4.5 文档 + Arthas后台异步任务 — Arthas 3.4.6 文档 @@ -74,7 +74,7 @@
    - 3.4.5 + 3.4.6
    @@ -103,7 +103,8 @@
  • 招聘!
  • 技术征文
  • English Docs
  • -
  • 在线教程(推荐)
  • +
  • 在线教程(国内)
  • +
  • 在线教程(国外)
  • 安装
  • 下载
  • 快速入门
  • diff --git a/batch-support.html b/batch-support.html index d795160ac..9353f097c 100644 --- a/batch-support.html +++ b/batch-support.html @@ -8,7 +8,7 @@ - 批处理功能 — Arthas 3.4.5 文档 + 批处理功能 — Arthas 3.4.6 文档 @@ -74,7 +74,7 @@
    - 3.4.5 + 3.4.6
    @@ -103,7 +103,8 @@
  • 招聘!
  • 技术征文
  • English Docs
  • -
  • 在线教程(推荐)
  • +
  • 在线教程(国内)
  • +
  • 在线教程(国外)
  • 安装
  • 下载
  • 快速入门
  • diff --git a/cat.html b/cat.html index 01f79ae04..129971040 100644 --- a/cat.html +++ b/cat.html @@ -8,7 +8,7 @@ - cat — Arthas 3.4.5 文档 + cat — Arthas 3.4.6 文档 @@ -74,7 +74,7 @@
    - 3.4.5 + 3.4.6
    @@ -103,7 +103,8 @@
  • 招聘!
  • 技术征文
  • English Docs
  • -
  • 在线教程(推荐)
  • +
  • 在线教程(国内)
  • +
  • 在线教程(国外)
  • 安装
  • 下载
  • 快速入门
  • @@ -127,6 +128,7 @@
  • jad
  • classloader
  • mc
  • +
  • retransform
  • redefine
  • monitor
  • watch
  • @@ -137,6 +139,7 @@
  • cat
  • echo
  • grep
  • +
  • base64
  • tee
  • pwd
  • options
  • diff --git a/classloader.html b/classloader.html index f928e4384..e574bebcb 100644 --- a/classloader.html +++ b/classloader.html @@ -8,7 +8,7 @@ - classloader — Arthas 3.4.5 文档 + classloader — Arthas 3.4.6 文档 @@ -74,7 +74,7 @@
    - 3.4.5 + 3.4.6
    @@ -103,7 +103,8 @@
  • 招聘!
  • 技术征文
  • English Docs
  • -
  • 在线教程(推荐)
  • +
  • 在线教程(国内)
  • +
  • 在线教程(国外)
  • 安装
  • 下载
  • 快速入门
  • @@ -139,6 +140,7 @@
  • mc
  • +
  • retransform
  • redefine
  • monitor
  • watch
  • @@ -149,6 +151,7 @@
  • cat
  • echo
  • grep
  • +
  • base64
  • tee
  • pwd
  • options
  • diff --git a/commands.html b/commands.html index 9fb07bad4..90da36b08 100644 --- a/commands.html +++ b/commands.html @@ -8,7 +8,7 @@ - 命令列表 — Arthas 3.4.5 文档 + 命令列表 — Arthas 3.4.6 文档 @@ -74,7 +74,7 @@
    - 3.4.5 + 3.4.6
    @@ -103,7 +103,8 @@
  • 招聘!
  • 技术征文
  • English Docs
  • -
  • 在线教程(推荐)
  • +
  • 在线教程(国内)
  • +
  • 在线教程(国外)
  • 安装
  • 下载
  • 快速入门
  • @@ -127,6 +128,7 @@
  • jad
  • classloader
  • mc
  • +
  • retransform
  • redefine
  • monitor
  • watch
  • @@ -137,6 +139,7 @@
  • cat
  • echo
  • grep
  • +
  • base64
  • tee
  • pwd
  • options
  • @@ -243,6 +246,7 @@
  • jad
  • classloader
  • mc
  • +
  • retransform
  • redefine
  • monitor
  • watch
  • @@ -253,6 +257,7 @@
  • cat
  • echo
  • grep
  • +
  • base64
  • tee
  • pwd
  • options
  • diff --git a/contact-us.html b/contact-us.html index 54d919acd..21642b746 100644 --- a/contact-us.html +++ b/contact-us.html @@ -8,7 +8,7 @@ - 联系我们 — Arthas 3.4.5 文档 + 联系我们 — Arthas 3.4.6 文档 @@ -73,7 +73,7 @@
    - 3.4.5 + 3.4.6
    @@ -102,7 +102,8 @@
  • 招聘!
  • 技术征文
  • English Docs
  • -
  • 在线教程(推荐)
  • +
  • 在线教程(国内)
  • +
  • 在线教程(国外)
  • 安装
  • 下载
  • 快速入门
  • diff --git a/dashboard.html b/dashboard.html index 31532d626..609d5ba31 100644 --- a/dashboard.html +++ b/dashboard.html @@ -8,7 +8,7 @@ - dashboard — Arthas 3.4.5 文档 + dashboard — Arthas 3.4.6 文档 @@ -74,7 +74,7 @@
    - 3.4.5 + 3.4.6
    @@ -103,7 +103,8 @@
  • 招聘!
  • 技术征文
  • English Docs
  • -
  • 在线教程(推荐)
  • +
  • 在线教程(国内)
  • +
  • 在线教程(国外)
  • 安装
  • 下载
  • 快速入门
  • @@ -136,6 +137,7 @@
  • jad
  • classloader
  • mc
  • +
  • retransform
  • redefine
  • monitor
  • watch
  • @@ -146,6 +148,7 @@
  • cat
  • echo
  • grep
  • +
  • base64
  • tee
  • pwd
  • options
  • diff --git a/docker.html b/docker.html index 7791f517f..ca612df92 100644 --- a/docker.html +++ b/docker.html @@ -8,7 +8,7 @@ - Docker — Arthas 3.4.5 文档 + Docker — Arthas 3.4.6 文档 @@ -74,7 +74,7 @@
    - 3.4.5 + 3.4.6
    @@ -103,7 +103,8 @@
  • 招聘!
  • 技术征文
  • English Docs
  • -
  • 在线教程(推荐)
  • +
  • 在线教程(国内)
  • +
  • 在线教程(国外)
  • 安装
  • 下载
  • 快速入门
  • diff --git a/download.html b/download.html index 8f2f17860..bb9ccc623 100644 --- a/download.html +++ b/download.html @@ -8,7 +8,7 @@ - 下载 — Arthas 3.4.5 文档 + 下载 — Arthas 3.4.6 文档 @@ -74,7 +74,7 @@
    - 3.4.5 + 3.4.6
    @@ -103,7 +103,8 @@
  • 招聘!
  • 技术征文
  • English Docs
  • -
  • 在线教程(推荐)
  • +
  • 在线教程(国内)
  • +
  • 在线教程(国外)
  • 安装
  • 下载