|
|
@@ -7,6 +7,7 @@ import (
|
|
|
"debug/elf"
|
|
|
"errors"
|
|
|
"fmt"
|
|
|
+ "github.com/cilium/ebpf"
|
|
|
"github.com/coroot/coroot-node-agent/ebpftracer/tracer"
|
|
|
"os"
|
|
|
"regexp"
|
|
|
@@ -138,7 +139,20 @@ func (t *Tracer) AttachTlsUprobes4Java(pid uint32) []link.Link {
|
|
|
var links []link.Link
|
|
|
// 733f8cc7aaa0 fd0 Lsun/net/www/protocol/http/HttpURLConnection;::setRequestProperty
|
|
|
// 参考: l, err := exe.Uprobe(s.Name, t.uprobes["uprobe_Transport_roundTrip"], &link.UprobeOptions{Address: address})
|
|
|
- link, err := exe.Uprobe("Lsun/net/www/protocol/http/HttpURLConnection;::setRequestProperty", t.uprobes["uprobe_HttpURLConnection::setRequestProperty"], &link.UprobeOptions{Address: 0x733f8cc7aaa0})
|
|
|
+ spec := &ebpf.ProgramSpec{
|
|
|
+ Name:"Lsun/net/www/protocol/http/HttpURLConnection;::setRequestProperty",
|
|
|
+ AttachTo: "uprobe_HttpURLConnection_setRequestProperty";
|
|
|
+ }
|
|
|
+ println("&ebpf.ProgramSpec: ", spec)
|
|
|
+ prog, err := ebpf.NewProgram(spec) // func NewProgram(spec *ProgramSpec) (*Program, error) {
|
|
|
+ if err != nil {
|
|
|
+ fmt.Println("NewProgram: ", err)
|
|
|
+ }
|
|
|
+
|
|
|
+ // prog = t.uprobes["uprobe_HttpURLConnection::setRequestProperty"] //
|
|
|
+ fmt.Println("OpenExecutable error: ", prog)
|
|
|
+
|
|
|
+ link, err := exe.Uprobe("Lsun/net/www/protocol/http/HttpURLConnection;::setRequestProperty", prog, &link.UprobeOptions{Address: 0x733f8cc7aaa0})
|
|
|
if err != nil {
|
|
|
fmt.Println("exe.Uprobe error: ", err) // 报错: TODO: exe.Uprobe error: prog cannot be nil: invalid input
|
|
|
return nil
|