From dd2a59a9a4a0cee044d066f9553c4535d5b36cd0 Mon Sep 17 00:00:00 2001 From: aarzilli Date: Wed, 27 Nov 2019 17:06:13 +0100 Subject: [PATCH] proc/native: call ElfUpdateSharedObjects after Attach When attaching to a process in linux ElfUpdateSharedObjects will be called for the first time during the call to updateThreadList, unfortunately it won't do anything because the dynamic section of the base elf executable needs to have been read first and that's done when we initialize the BinaryInfo object (which happens later during the call to initialize). --- pkg/proc/native/proc_linux.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkg/proc/native/proc_linux.go b/pkg/proc/native/proc_linux.go index 9a0beca8..f481c705 100644 --- a/pkg/proc/native/proc_linux.go +++ b/pkg/proc/native/proc_linux.go @@ -118,6 +118,13 @@ func Attach(pid int, debugInfoDirs []string) (*Process, error) { dbp.Detach(false) return nil, err } + + // ElfUpdateSharedObjects can only be done after we initialize because it + // needs an initialized BinaryInfo object to work. + err = linutil.ElfUpdateSharedObjects(dbp) + if err != nil { + return nil, err + } return dbp, nil } -- GitLab