Skip to content

Commit

Permalink
fix bugs.
Browse files Browse the repository at this point in the history
uprobe hooked for every process without PID.

Signed-off-by: CFC4N <cfc4n.cs@gmail.com>
  • Loading branch information
cfc4n committed Mar 14, 2022
1 parent 19e0997 commit ed00674
Showing 1 changed file with 1 addition and 17 deletions.
18 changes: 1 addition & 17 deletions probe.go
Original file line number Diff line number Diff line change
Expand Up @@ -634,22 +634,6 @@ func (p *Probe) attachUprobe() error {
// compute the offset if it was not provided
if p.UprobeOffset == 0 {
p.funcName = p.AttachToFuncName
//if len(p.AttachToFuncName) <= 0 {
// // find the offset of the first symbol matching the provided pattern
// funcName = fmt.Sprintf("^%s$", funcName)
// pattern, err := regexp.Compile(funcName)
// if err != nil {
// return errors.New(fmt.Sprintf("error:%v , failed to compile pattern %s", err, funcName))
// }
//
// // Retrieve dynamic symbol offset
// offsets, err := FindSymbolOffsets(p.BinaryPath, pattern)
// if err != nil {
// return errors.New(fmt.Sprintf("error:%v , couldn't find symbol matching %s in %s", err, pattern.String(), p.BinaryPath))
// }
// p.UprobeOffset = offsets[0].Value
// p.funcName = offsets[0].Name
//}
}

ex, err := link.OpenExecutable(p.BinaryPath)
Expand All @@ -658,7 +642,7 @@ func (p *Probe) attachUprobe() error {
}
opts := &link.UprobeOptions{
Offset: p.UprobeOffset,
PID: p.attachPID,
//PID: p.attachPID,
}
var kp link.Link
if isRet {
Expand Down

0 comments on commit ed00674

Please sign in to comment.