diff --git a/pkg/proc/linutil/dynamic.go b/pkg/proc/linutil/dynamic.go index 6e041a40..b30cc87a 100644 --- a/pkg/proc/linutil/dynamic.go +++ b/pkg/proc/linutil/dynamic.go @@ -165,6 +165,8 @@ func ElfUpdateSharedObjects(p proc.Process) error { libs := []string{} + first := true + for { if r_map == 0 { break @@ -176,8 +178,13 @@ func ElfUpdateSharedObjects(p proc.Process) error { if err != nil { return err } - bi.AddImage(lm.name, lm.addr) + if !first || lm.addr != 0 { + // First entry is the executable, we don't need to add it, and doing so + // can cause duplicate entries due to base address mismatches. + bi.AddImage(lm.name, lm.addr) + } libs = append(libs, lm.name) + first = false r_map = lm.next } diff --git a/pkg/terminal/command.go b/pkg/terminal/command.go index 787a441b..49522e4e 100644 --- a/pkg/terminal/command.go +++ b/pkg/terminal/command.go @@ -2625,7 +2625,7 @@ func libraries(t *Term, ctx callContext, args string) error { for i := range libs { fmt.Fprintf(t.stdout, "%"+strconv.Itoa(d)+"d. %#x %s\n", i, libs[i].Address, libs[i].Path) if libs[i].LoadError != "" { - fmt.Fprintf(t.stdout, " Load error: %s", libs[i].LoadError) + fmt.Fprintf(t.stdout, " Load error: %s\n", libs[i].LoadError) } } return nil