GitXplorerGitXplorer
h

Java-Agent-Loader

public
0 stars
0 forks
1 issues

Commits

List of commits on branch main.
Verified
818c5285ddec80b43433c82b4ff601f9a0cd84f0

Create README.md

hhengyoush committed a year ago
Unverified
185dd944c45824bf1de4acb28d5e0a7019a9061b

delete build target

hhengyoush committed a year ago
Unverified
38d2c5810cd98bf83b13aa0d64af31fdd4295825

init commit

hhengyoush committed a year ago

README

The README file for this repository.

Java-Agent-Loader

不需要JVM就可以attach指定java agent到指定JVM中

使用方法

./agent_loader {pid} /path/to/your-agent.jar

实现原理

JVM利用了Unix Domain Socket跨进程通信的机制,JVM指定了一个文件创建socket,由用户写入命令到socket,JVM从其中读取命令执行并返回响应。 其详细步骤如下所述:

  1. java_pid文件 2.创建attach_pid文件 3.发送QUIT信号,等待JVM创建java_pid文件
  2. connect socket
  3. write命令 protocol version + cmd + args
  4. read response