mirror of
https://github.com/alibaba/arthas.git
synced 2024-04-21 10:21:39 +00:00
1.3 KiB
1.3 KiB
Dump the bytecode for the particular classes to the specified directory.
Usage
Loading class bytecode without specifying a directory
dump java.lang.String{{execute T2}}
dump demo.*{{execute T2}}
Loading class bytecode with specifying a directory
dump -d /tmp/output java.lang.String{{execute T2}}
- Specify classLoader
Note that the hashcode changes, you need to check the current ClassLoader information first, and extract the hashcode corresponding to the ClassLoader.
if you use-c{{}} , you have to manually type hashcode by-c <hashcode>{{}} .
For classloader with only one instance, it can be specified by--classLoaderClass{{}} using class name, which is more convenient to use.
dump --classLoaderClass jdk.internal.loader.ClassLoaders$AppClassLoader demo.*{{execute T2}}
- PS: Here the classLoaderClass in java 8 is sun.misc.Launcher$AppClassLoader, while in java 11 it's jdk.internal.loader.ClassLoaders$AppClassLoader. Currently killercoda using java 11.
The value of --classloaderclass{{}} is the class name of classloader. It can only work when it matches a unique classloader instance. The purpose is to facilitate the input of general commands. However, -c <hashcode>{{}} is dynamic.