mirror of
https://github.com/alibaba/arthas.git
synced 2026-11-30 07:32:57 +00:00
update doc
This commit is contained in:
1 parent
0eb32d0980
commit
0fe1ab45cd
12 files changed
+130
-4
No files matched your search
@@ -0,0 +1,9 @@
|
||||
cat
|
||||
===
|
||||
|
||||
> 打印文件内容,和linux里的cat命令类似。
|
||||
|
||||
|
||||
```bash
|
||||
$ cat /tmp/a.txt
|
||||
```
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
* [jad](jad.md)
|
||||
* [classloader](classloader.md)
|
||||
* [mc](mc.md)
|
||||
* [redefine](redefine.md)
|
||||
|
||||
* [monitor](monitor.md)
|
||||
@@ -24,6 +25,8 @@
|
||||
* [stack](stack.md)
|
||||
* [tt](tt.md)
|
||||
|
||||
* [cat](cat.md)
|
||||
* [pwd](pwd.md)
|
||||
* [options](options.md)
|
||||
|
||||
### Arthas 基础命令
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
cat
|
||||
===
|
||||
|
||||
> Concatenate and print files
|
||||
|
||||
|
||||
```bash
|
||||
$ cat /tmp/a.txt
|
||||
```
|
||||
@@ -16,6 +16,7 @@ All Commands
|
||||
|
||||
* [jad](jad.md)
|
||||
* [classloader](classloader.md)
|
||||
* [mc](mc.md)
|
||||
* [redefine](redefine.md)
|
||||
|
||||
* [monitor](monitor.md)
|
||||
@@ -24,6 +25,8 @@ All Commands
|
||||
* [stack](stack.md)
|
||||
* [tt](tt.md)
|
||||
|
||||
* [cat](cat.md)
|
||||
* [pwd](pwd.md)
|
||||
* [options](options.md)
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
mc
|
||||
===
|
||||
|
||||
> Memory compiler, compiles java files into bytecode and class files in memory.
|
||||
|
||||
```bash
|
||||
mc /tmp/Test.java
|
||||
```
|
||||
|
||||
The classloader can be specified with the `-c` option:
|
||||
|
||||
```bash
|
||||
mc -c 327a647b /tmp/Test.java
|
||||
```
|
||||
|
||||
The output directory can be specified with the `-d` option:
|
||||
|
||||
```bash
|
||||
mc -d /tmp/output /tmp/ClassA.java /tmp/ClassB.java
|
||||
```
|
||||
|
||||
After compiling the `.class` file, you can use the [`redefine`](redefine.md) command to re-define the loaded classes in JVM.
|
||||
@@ -0,0 +1,9 @@
|
||||
pwd
|
||||
===
|
||||
|
||||
> Return working directory name
|
||||
|
||||
|
||||
```bash
|
||||
$ pwd
|
||||
```
|
||||
@@ -18,10 +18,25 @@ Reference: [Instrumentation#redefineClasses](https://docs.oracle.com/javase/8/do
|
||||
### Usage
|
||||
|
||||
```bash
|
||||
redefine -p /tmp/Test.class
|
||||
redefine -c 327a647b -p /tmp/Test.class /tmp/Test$Inner.class
|
||||
redefine /tmp/Test.class
|
||||
redefine -c 327a647b /tmp/Test.class /tmp/Test$Inner.class
|
||||
```
|
||||
|
||||
### Use with the jad/mc command
|
||||
|
||||
```bash
|
||||
jad --source-only com.example.demo.arthas.user.UserController > /tmp/UserController.java
|
||||
|
||||
mc /tmp/UserController.java -d /tmp
|
||||
|
||||
redefine /tmp/com/example/demo/arthas/user/UserController.class
|
||||
```
|
||||
|
||||
* Use `jad` command to decompile bytecode, and then you can use other editors, such as vim to modify the source code.
|
||||
* `mc` command to compile the modified code
|
||||
* Load new bytecode with `redefine` command
|
||||
|
||||
|
||||
### Restrictions of the redefine command
|
||||
|
||||
* New field/method is not allowed
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
Release Notes
|
||||
=============
|
||||
|
||||
v3.1.0
|
||||
---
|
||||
|
||||
* [https://github.com/alibaba/arthas/releases/tag/arthas-all-3.1.0](https://github.com/alibaba/arthas/releases/tag/arthas-all-3.1.0)
|
||||
|
||||
|
||||
v3.0.5
|
||||
---
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
mc
|
||||
===
|
||||
|
||||
> Memory Compiler/内存编绎器,编绎`.java`文件生成`.class`。
|
||||
|
||||
```bash
|
||||
mc /tmp/Test.java
|
||||
```
|
||||
|
||||
可以通过`-c`参数指定classloader:
|
||||
|
||||
```bash
|
||||
mc -c 327a647b /tmp/Test.java
|
||||
```
|
||||
|
||||
可以通过`-d`命令指定输出目录:
|
||||
|
||||
```bash
|
||||
mc -d /tmp/output /tmp/ClassA.java /tmp/ClassB.java
|
||||
```
|
||||
|
||||
编绎生成`.class`文件之后,可以结合[`redefine`](redefine.md)命令实现热更新代码。
|
||||
@@ -0,0 +1,9 @@
|
||||
pwd
|
||||
===
|
||||
|
||||
> 返回当前的工作目录,和linux命令类似
|
||||
|
||||
|
||||
```bash
|
||||
$ pwd
|
||||
```
|
||||
@@ -19,10 +19,24 @@ redefine
|
||||
### 使用参考
|
||||
|
||||
```bash
|
||||
redefine -p /tmp/Test.class
|
||||
redefine -c 327a647b -p /tmp/Test.class /tmp/Test\$Inner.class
|
||||
redefine /tmp/Test.class
|
||||
redefine -c 327a647b /tmp/Test.class /tmp/Test\$Inner.class
|
||||
```
|
||||
|
||||
### 结合 jad/mc 命令使用
|
||||
|
||||
```bash
|
||||
jad --source-only com.example.demo.arthas.user.UserController > /tmp/UserController.java
|
||||
|
||||
mc /tmp/UserController.java -d /tmp
|
||||
|
||||
redefine /tmp/com/example/demo/arthas/user/UserController.class
|
||||
```
|
||||
|
||||
* jad命令反编绎,然后可以用其它编绎器,比如vim来修改源码
|
||||
* mc命令来内存编绎修改过的代码
|
||||
* 用redefine命令加载新的字节码
|
||||
|
||||
### redefine的限制
|
||||
|
||||
* 不允许新增加field/method
|
||||
|
||||
@@ -2,6 +2,12 @@
|
||||
Release Notes
|
||||
===
|
||||
|
||||
v3.1.0
|
||||
---
|
||||
|
||||
* [https://github.com/alibaba/arthas/releases/tag/arthas-all-3.1.0](https://github.com/alibaba/arthas/releases/tag/arthas-all-3.1.0)
|
||||
|
||||
|
||||
v3.0.5
|
||||
---
|
||||
|
||||
|
||||
Reference in new issue
Block a user