I'm trying to debug memory issue on Go, i.e. RSS keeps on increasing, no leak is found via pprof, most likely is due to Go not returning memory to OS when it's freed (classic scavenger issue in Go: https://github.com/golang/go/issues/30333)
I'm trying to understand how the memory is allocated into heap and when they are deallocated.
strace doesn't help much so far, so I'm trying to use ltrace
ltrace -e malloc+free go run main.go
Unfortunately, it immediately crashes the program.
Any ideas how to use ltrace on go program? or it's not possible at all?
go->malloc(56) = 0x1f4f010
libpthread.so.0->free(nil) = <void>
go->free(0x1f4f010) = <void>
go->malloc(24) = 0x1f4f050
go->malloc(24) = 0x1f4f2c0
go->malloc(24) = 0x1f4f2c0
go->malloc(24) = 0x1f4f2c0
SIGILL: illegal instruction
PC=0x4aeb5e m=4 sigcode=2
goroutine 9 [syscall]:
syscall.Syscall6(0xf7, 0x1, 0x5865, 0xc000166dc8, 0x1000004, 0x0, 0x0, 0x4d0601, 0xc0003edf20, 0xc000166e08)
/usr/local/go/src/syscall/asm_linux_amd64.s:44 +0x5 fp=0xc000166d78 sp=0xc000166d70 pc=0x4aeb35
os.(*Process).blockUntilWaitable(0xc000027b30, 0x203000, 0xc0002d0000, 0x2)
/usr/local/go/src/os/wait_waitid.go:31 +0x98 fp=0xc000166e68 sp=0xc000166d78 pc=0x4d4db8
os.(*Process).wait(0xc000027b30, 0xa842a0, 0xa842a8, 0xa84298)
/usr/local/go/src/os/exec_unix.go:22 +0x39 fp=0xc000166ee0 sp=0xc000166e68 pc=0x4cca69
os.(*Process).Wait(...)
/usr/local/go/src/os/exec.go:125
os/exec.(*Cmd).Wait(0xc000325b80, 0x0, 0x0)
/usr/local/go/src/os/exec/exec.go:501 +0x60 fp=0xc000166f58 sp=0xc000166ee0 pc=0x50bbc0
os/exec.(*Cmd).Run(0xc000325b80, 0xc000260e10, 0x27)
/usr/local/go/src/os/exec/exec.go:341 +0x5c fp=0xc000166f80 sp=0xc000166f58 pc=0x50b05c
cmd/go/internal/work.(*Builder).toolID(0xc0000a55e0, 0xa3c61a, 0x7, 0xb, 0xc0001673c8)
/usr/local/go/src/cmd/go/internal/work/buildid.go:193 +0x44d fp=0xc000167170 sp=0xc000166f80 pc=0x83a51d
cmd/go/internal/work.(*Builder).buildActionID(0xc0000a55e0, 0xc0002e9400, 0x0, 0x0, 0x0, 0x0)
/usr/local/go/src/cmd/go/internal/work/exec.go:242 +0x1215 fp=0xc000167588 sp=0xc000167170 pc=0x840c15
cmd/go/internal/work.(*Builder).build(0xc0000a55e0, 0xc0002e9400, 0x0, 0x0)
/usr/local/go/src/cmd/go/internal/work/exec.go:397 +0x52a6 fp=0xc000167e30 sp=0xc000167588 pc=0x847606
cmd/go/internal/work.(*Builder).Do.func2(0xc0002e9400)
/usr/local/go/src/cmd/go/internal/work/exec.go:117 +0x36d fp=0xc000167ef0 sp=0xc000167e30 pc=0x87666d
cmd/go/internal/work.(*Builder).Do.func3(0xc000028d60, 0xc0000a55e0, 0xc0003d9740)
/usr/local/go/src/cmd/go/internal/work/exec.go:177 +0x79 fp=0xc000167fc8 sp=0xc000167ef0 pc=0x876799
runtime.goexit()
/usr/local/go/src/runtime/asm_amd64.s:1357 +0x1 fp=0xc000167fd0 sp=0xc000167fc8 pc=0x45c4c1
created by cmd/go/internal/work.(*Builder).Do
/usr/local/go/src/cmd/go/internal/work/exec.go:164 +0x3a1
goroutine 1 [semacquire]:
sync.runtime_Semacquire(0xc000028d68)
/usr/local/go/src/runtime/sema.go:56 +0x42
sync.(*WaitGroup).Wait(0xc000028d60)
/usr/local/go/src/sync/waitgroup.go:130 +0x64
cmd/go/internal/work.(*Builder).Do(0xc0000a55e0, 0xc000152dc0)
/usr/local/go/src/cmd/go/internal/work/exec.go:186 +0x3c5
cmd/go/internal/run.runRun(0xea3d40, 0xc0000201a0, 0x1, 0x1)
/usr/local/go/src/cmd/go/internal/run/run.go:143 +0x54d
main.main()
/usr/local/go/src/cmd/go/main.go:189 +0x57f
goroutine 6 [syscall]:
os/signal.signal_recv(0x0)
/usr/local/go/src/runtime/sigqueue.go:147 +0x9c
os/signal.loop()
/usr/local/go/src/os/signal/signal_unix.go:23 +0x22
created by os/signal.init.0
/usr/local/go/src/os/signal/signal_unix.go:29 +0x41
goroutine 10 [runnable]:
os/exec.(*Cmd).Start.func1(0xc000325b80, 0xc0003d97e0)
/usr/local/go/src/os/exec/exec.go:434
created by os/exec.(*Cmd).Start
/usr/local/go/src/os/exec/exec.go:434 +0x608
goroutine 11 [runnable]:
os/exec.(*Cmd).Start.func1(0xc000325b80, 0xc0003d9820)
/usr/local/go/src/os/exec/exec.go:434
created by os/exec.(*Cmd).Start
/usr/local/go/src/os/exec/exec.go:434 +0x608
rax 0xf0013d48
rbx 0xc000030000
rcx 0xffffffffffffffff
rdx 0xc000166dc8
rdi 0x1
rsi 0x5865
rbp 0xc000166e58
rsp 0xc000166d70
r8 0x0
r9 0x0
r10 0x1000004
r11 0x202
r12 0xf1
r13 0x0
r14 0xb16d58
r15 0x0
rip 0x4aeb5e
rflags 0x10286
cs 0x33
fs 0x0
gs 0x0
+++ exited (status 2) +++
Related
With go mod tidy I've updated protobuf to github.com//golang/protobuf#v1.4.0
my project uses github.com/ericchiang/k8s#v1.2.0
I build binary and when I try to run it I'm getting this panic error:
panic: mismatching message name: got k8s.io.kubernetes.pkg.watch.versioned.Event, want github.com/ericchiang.k8s.watch.versioned.Event
goroutine 1 [running]:
google.golang.org/protobuf/internal/impl.legacyLoadMessageDesc(0x1f8d6c0, 0x1b85dc0, 0x1ce794f, 0x2f, 0x0, 0x0)
/home/andriy/go/pkg/mod/google.golang.org/protobuf#v1.21.0/internal/impl/legacy_message.go:136 +0x882
google.golang.org/protobuf/internal/impl.legacyLoadMessageInfo(0x1f8d6c0, 0x1b85dc0, 0x1ce794f, 0x2f, 0x4f7b57)
/home/andriy/go/pkg/mod/google.golang.org/protobuf#v1.21.0/internal/impl/legacy_message.go:48 +0xbd
google.golang.org/protobuf/internal/impl.Export.LegacyMessageTypeOf(0x1f4f0a0, 0x0, 0x1ce794f, 0x2f, 0xc000399360, 0xc0000a00d0)
/home/andriy/go/pkg/mod/google.golang.org/protobuf#v1.21.0/internal/impl/legacy_export.go:35 +0xa5
github.com/golang/protobuf/proto.RegisterType(0x1f4f0a0, 0x0, 0x1ce794f, 0x2f)
/home/andriy/go/pkg/mod/github.com/golang/protobuf#v1.4.0-rc.4.0.20200313231945-b860323f09d0/proto/registry.go:186 +0x4d
github.com/ericchiang/k8s/watch/versioned.init.0()
/home/andriy/go/pkg/mod/github.com/ericchiang/k8s#v1.2.0/watch/versioned/generated.pb.go:70 +0x4b
is there anyway to fix this, or should I downgrade protobuf to v1.3.5
I met the same problem as you,you can go directly to the error path to change the name. Replace the github.com/ericchiang.k8s.watch.versioned.Event in generated.pb.go's init() function with k8s.io.kubernetes.pkg.watch.versioned.Event.
My setup:
Win 10 home host, Virtualbox, Minikube.exe, Kubectl.exe, Docker Toolbox
which also create "default" VM in Virtualbox.
I need this setup for learning. I wanna do this
I have installed the Docker Toolbox which created "default" VM in Virtualbox & it's working properly.
I have used
minikube start --kubernetes-version="v1.4.0" --vm-driver="virtualbox" --show-libmachine-logs --alsologtostderr
From here
& I am getting this :
missing apiserver.crt in the minikube VM.
I do not have the localkube folder too.
I cannot manage to work together the ==>
Docker Toolbox + Minikube + Kubectl
under Win 10 Home with Virtualbox.
C:\Users\Kolly>minikube start --kubernetes-version="v1.7.5" --vm-driver="virtualbox" --alsologtostderr --v=7
C:\Users\Kolly>minikube start --alsologtostderr --v=7
Starting local Kubernetes v1.6.4 cluster...
Starting VM...
I1003 21:34:44.154518 4796 cluster.go:71] Machine exists!
Migrating to config v0
Migrating to config v1
Migrating to config v2
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x10 pc=0x8812cf]
goroutine 1 [running]:
panic(0x17498e0, 0xc042004090)
/usr/local/go/src/runtime/panic.go:500 +0x1af
k8s.io/minikube/vendor/github.com/docker/machine/libmachine/host.MigrateHostV2ToHostV3(0xc04200a400, 0xc042458000, 0x1f, 0x21f, 0x18fc74d, 0x1, 0x0)
/var/lib/jenkins/go/src/k8s.io/minikube/_gopath/src/k8s.io/minikube/vendor/github.com/docker/machine/libmachine/host/migrate_v2_v3.go:26 +0x15f
k8s.io/minikube/vendor/github.com/docker/machine/libmachine/host.MigrateHost(0xc0420f2000, 0xc042458000, 0x1f, 0x21f, 0x21f, 0x0, 0x0, 0x21)
/var/lib/jenkins/go/src/k8s.io/minikube/_gopath/src/k8s.io/minikube/vendor/github.com/docker/machine/libmachine/host/migrate.go:109 +0x950
k8s.io/minikube/vendor/github.com/docker/machine/libmachine/persist.Filestore.loadConfig(0xc042414300, 0x18, 0xc04236d460, 0x1e, 0xc04236d460, 0x1e, 0xc0420f2000, 0x21, 0x1902a95)
/var/lib/jenkins/go/src/k8s.io/minikube/_gopath/src/k8s.io/minikube/vendor/github.com/docker/machine/libmachine/persist/filestore.go:122 +0x15f
k8s.io/minikube/vendor/github.com/docker/machine/libmachine/persist.Filestore.Load(0xc042414300, 0x18, 0xc04236d460, 0x1e, 0xc04236d460, 0x1e, 0x1902a95, 0x8, 0xc0425310a0, 0x526444, ...)
/var/lib/jenkins/go/src/k8s.io/minikube/_gopath/src/k8s.io/minikube/vendor/github.com/docker/machine/libmachine/persist/filestore.go:158 +0x21e
k8s.io/minikube/pkg/minikube/machine.(*LocalClient).Load(0xc0420f6880, 0x1902a95, 0x8, 0x16b0b80, 0xc0422de260, 0x0)
/var/lib/jenkins/go/src/k8s.io/minikube/_gopath/src/k8s.io/minikube/pkg/minikube/machine/client.go:142 +0x6b
k8s.io/minikube/pkg/minikube/cluster.StartHost(0x3b8d2a0, 0xc0420f6880, 0xc04239ed40, 0x40, 0x800, 0x2, 0x4e20, 0xc0422fca10, 0xa, 0x1900e4e, ...)
/var/lib/jenkins/go/src/k8s.io/minikube/_gopath/src/k8s.io/minikube/pkg/minikube/cluster/cluster.go:72 +0x163
k8s.io/minikube/cmd/minikube/cmd.runStart.func1(0x0, 0x3bef460)
/var/lib/jenkins/go/src/k8s.io/minikube/_gopath/src/k8s.io/minikube/cmd/minikube/cmd/start.go:125 +0x83
k8s.io/minikube/pkg/util.RetryAfter(0x5, 0xc0421b24e0, 0x77359400, 0xf, 0x0)
/var/lib/jenkins/go/src/k8s.io/minikube/_gopath/src/k8s.io/minikube/pkg/util/utils.go:88 +0x6b
k8s.io/minikube/cmd/minikube/cmd.runStart(0x3be1860, 0xc042395ee0, 0x0, 0x2)
/var/lib/jenkins/go/src/k8s.io/minikube/_gopath/src/k8s.io/minikube/cmd/minikube/cmd/start.go:131 +0x76e
k8s.io/minikube/vendor/github.com/spf13/cobra.(*Command).execute(0x3be1860, 0xc042395d60, 0x2, 0x2, 0x3be1860, 0xc042395d60)
/var/lib/jenkins/go/src/k8s.io/minikube/_gopath/src/k8s.io/minikube/vendor/github.com/spf13/cobra/command.go:603 +0x440
k8s.io/minikube/vendor/github.com/spf13/cobra.(*Command).ExecuteC(0x3be0dc0, 0x3c0ec00, 0xc0425cdeb8, 0x47ed13)
/var/lib/jenkins/go/src/k8s.io/minikube/_gopath/src/k8s.io/minikube/vendor/github.com/spf13/cobra/command.go:689 +0x36e
k8s.io/minikube/vendor/github.com/spf13/cobra.(*Command).Execute(0x3be0dc0, 0x0, 0x0)
/var/lib/jenkins/go/src/k8s.io/minikube/_gopath/src/k8s.io/minikube/vendor/github.com/spf13/cobra/command.go:648 +0x32
k8s.io/minikube/cmd/minikube/cmd.Execute()
/var/lib/jenkins/go/src/k8s.io/minikube/_gopath/src/k8s.io/minikube/cmd/minikube/cmd/root.go:111 +0x34
main.main()
/var/lib/jenkins/go/src/k8s.io/minikube/_gopath/src/k8s.io/minikube/cmd/minikube/main.go:38 +0x79
This is the first time I have had to make calls to native libraries from Go.
I am trying to setup event hooks with the windows libraries to listen for network interface changes, so far I have been successful with setting up a listener with NotifyAddrChange.
Now I am trying with NotifyIpInterfaceChange with the following code
package main
import (
"golang.org/x/sys/windows"
"log"
"syscall"
"unsafe"
)
var (
modiphlpapi = windows.NewLazySystemDLL("iphlpapi.dll")
procNotifyIpInterfaceChange = modiphlpapi.NewProc("NotifyIpInterfaceChange")
)
type context struct{}
func main() {
log.Printf("Loaded [iphlpapi.dll] at {%#v}", modiphlpapi.Handle())
log.Printf("Found [NotifyIpInterfaceChange] at {%#v}", procNotifyIpInterfaceChange.Addr())
context := &context{}
interfaceChange := windows.Handle(0)
ret, _, errNum := procNotifyIpInterfaceChange.Call(syscall.AF_UNSPEC, syscall.NewCallback(callback), uintptr(unsafe.Pointer(context)), 0, uintptr(interfaceChange))
log.Printf("%#v %#v", ret, errNum)
}
func callback(callerContext, row, notificationType uintptr) uintptr {
log.Printf("callback invoked by Windows API (%#v %#v %#v)", callerContext, row, notificationType)
return 0
}
The code compiles fine and starts up without any issue, the problem happens once the function is invoke, then I get the following exception
D:\>event-listen_type2.exe
2017/06/22 22:12:39 Loaded [iphlpapi.dll] at {0x7ffac96f0000}
2017/06/22 22:12:39 Found [NotifyIpInterfaceChange] at {0x7ffac96f7e20}
Exception 0xc0000005 0x1 0x0 0x7ffac96f7edb
PC=0x7ffac96f7edb
syscall.Syscall6(0x7ffac96f7e20, 0x5, 0x0, 0x454170, 0x54d360, 0x0, 0x0, 0x0, 0xc042015350, 0xc042015300, ...)
/usr/local/Cellar/go/1.8.3/libexec/src/runtime/syscall_windows.go:174 +0x6b
github.com/LiamHaworth/windows-network-events/vendor/golang.org/x/sys/windows.(*Proc).Call(0xc04203a620, 0xc042050300, 0x5, 0x5, 0x30, 0x4b12e0, 0x1, 0xc042050300)
/Users/liam/git/go_path/src/github.com/LiamHaworth/windows-network-events/vendor/golang.org/x/sys/windows/dll_windows.go:139 +0x5c1
github.com/LiamHaworth/windows-network-events/vendor/golang.org/x/sys/windows.(*LazyProc).Call(0xc042050270, 0xc042050300, 0x5, 0x5, 0x1, 0xc04201a000, 0xc04202df78, 0x4043a3)
/Users/liam/git/go_path/src/github.com/LiamHaworth/windows-network-events/vendor/golang.org/x/sys/windows/dll_windows.go:309 +0x66
main.main()
/Users/liam/git/go_path/src/github.com/LiamHaworth/windows-network-events/main_windows.go:25 +0x229
rax 0x0
rbx 0xc3f10
rcx 0x1fb5cd87abfd0000
rdi 0x0
rsi 0x454170
rbp 0xc04202dc00
rsp 0x8fdf0
r8 0x8fb78
r9 0x7ffac96fb4c0
r10 0x0
r11 0x8fcf0
r12 0x0
r13 0xffffffee
r14 0x0
r15 0xaa
rip 0x7ffac96f7edb
rflags 0x10246
cs 0x33
fs 0x53
gs 0x2b
From some googling I know that exception type 0xc0000005 is a access violation thrown by the CPU when a program tries to access memory not allocated to it but looking through my code I can't tell where that is happening. All pointers passed are for items in the application.
Any help here would be magnificent.
According to documentation, the latest parameter of NotifyIpInterfaceChange is both in/out and need to be a pointer to HANDLE. Change the system call to:
ret, _, errNum := procNotifyIpInterfaceChange.Call(syscall.AF_UNSPEC,
syscall.NewCallback(callback),
uintptr(unsafe.Pointer(context)),
0,
uintptr(unsafe.Pointer(&interfaceChange))) //this must be pointer
EDIT:
As mentioned in the comment and this go-nuts discussion, for multi-threaded callback, import "C" need to be added, even if we don't use cgo.
Currently trying out Google Cloud with Go, and I'm having the most bizarre issue I have ever seen.
I have made an ultra simple "hello world" app that just prints out some text to the browser. It compiles perfectly with "go build", and even deploys to Google Cloud and runs there just fine, but when I use "goapp serve" to run it locally it randomly crashes when I start it, with a huge stack trace and the message:
fatal error: unexpected signal during runtime execution
[signal 0xb code=0x1 addr=0xb01dfacedebac1e pc=0xf47b]
When I get the error, I simply run "goapp serve" again, and after a few tries it somehow magically decides to work. Other times, if I can't get it to run after 10-20 tries, I simply make a micro change in the code somewhere, like editing a string, changing a single character, and then it runs just fine locally. Whaaaaat!?!?!?
I'm so baffled how this is even possible. I seems that "goapp serve" is extremely fragile. It's Google official local development server, so I would expect it to be a little more stable, or at least give some more human readable clues.
I have searched all over and can't find anything related to this.
Any ideas how or what is causing this?
Here is the stack trace:
ERROR go_runtime.py:181] Failed to build Go application: (Executed command: /usr/local/go_appengine/goroot/bin/go-app-builder -app_base /Users/kieran/Go/src/hello/main -arch 6 -dynamic -goroot /usr/local/go_appengine/goroot -nobuild_files ^^$ -unsafe -gopath /Users/kieran/Go -binary_name _go_app -extra_imports appengine_internal/init -work_dir /var/folders/w3/wrcy8wfn3gzbnphs0cq6yw9r0000gn/T/tmpf_Nrsvappengine-go-bin -gcflags -I,/usr/local/go_appengine/goroot/pkg/darwin_amd64_appengine -ldflags -L,/usr/local/go_appengine/goroot/pkg/darwin_amd64_appengine main.go)
fatal error: unexpected signal during runtime execution
[signal 0xb code=0x1 addr=0xb01dfacedebac1e pc=0xf47b]
runtime stack:
runtime.throw(0x2c4ac0, 0x2a)
/private/var/folders/9y/ppk2fnqj5lscwqw_l6lhdrx8005bt1/T/appengine/go_appengine/goroot/src/runtime/panic.go:547 +0x90
runtime.sigpanic()
/private/var/folders/9y/ppk2fnqj5lscwqw_l6lhdrx8005bt1/T/appengine/go_appengine/goroot/src/runtime/sigpanic_unix.go:12 +0x5a
runtime.unlock(0x3aa0c0)
/private/var/folders/9y/ppk2fnqj5lscwqw_l6lhdrx8005bt1/T/appengine/go_appengine/goroot/src/runtime/lock_sema.go:107 +0x14b
runtime.(*mheap).alloc_m(0x3aa0c0, 0x1, 0x20000000020, 0x8a5178)
/private/var/folders/9y/ppk2fnqj5lscwqw_l6lhdrx8005bt1/T/appengine/go_appengine/goroot/src/runtime/mheap.go:492 +0x314
runtime.(*mheap).alloc.func1()
/private/var/folders/9y/ppk2fnqj5lscwqw_l6lhdrx8005bt1/T/appengine/go_appengine/goroot/src/runtime/mheap.go:502 +0x41
runtime.systemstack(0xc820039e58)
/private/var/folders/9y/ppk2fnqj5lscwqw_l6lhdrx8005bt1/T/appengine/go_appengine/goroot/src/runtime/asm_amd64.s:307 +0xab
runtime.(*mheap).alloc(0x3aa0c0, 0x1, 0x10000000020, 0xf11f)
/private/var/folders/9y/ppk2fnqj5lscwqw_l6lhdrx8005bt1/T/appengine/go_appengine/goroot/src/runtime/mheap.go:503 +0x63
runtime.(*mcentral).grow(0x3ac190, 0x0)
/private/var/folders/9y/ppk2fnqj5lscwqw_l6lhdrx8005bt1/T/appengine/go_appengine/goroot/src/runtime/mcentral.go:209 +0x93
runtime.(*mcentral).cacheSpan(0x3ac190, 0x8a5178)
/private/var/folders/9y/ppk2fnqj5lscwqw_l6lhdrx8005bt1/T/appengine/go_appengine/goroot/src/runtime/mcentral.go:89 +0x47d
runtime.(*mcache).refill(0x406c20, 0x20, 0x8a5178)
/private/var/folders/9y/ppk2fnqj5lscwqw_l6lhdrx8005bt1/T/appengine/go_appengine/goroot/src/runtime/mcache.go:119 +0xcc
runtime.mallocgc.func2()
/private/var/folders/9y/ppk2fnqj5lscwqw_l6lhdrx8005bt1/T/appengine/go_appengine/goroot/src/runtime/malloc.go:642 +0x2b
runtime.systemstack(0xc820012000)
/private/var/folders/9y/ppk2fnqj5lscwqw_l6lhdrx8005bt1/T/appengine/go_appengine/goroot/src/runtime/asm_amd64.s:291 +0x79
runtime.mstart()
/private/var/folders/9y/ppk2fnqj5lscwqw_l6lhdrx8005bt1/T/appengine/go_appengine/goroot/src/runtime/proc.go:1051
goroutine 1 [running]:
runtime.systemstack_switch()
/private/var/folders/9y/ppk2fnqj5lscwqw_l6lhdrx8005bt1/T/appengine/go_appengine/goroot/src/runtime/asm_amd64.s:245 fp=0xc8200329d0 sp=0xc8200329c8
runtime.mallocgc(0x480, 0x25c640, 0xc800000000, 0xc820074240)
/private/var/folders/9y/ppk2fnqj5lscwqw_l6lhdrx8005bt1/T/appengine/go_appengine/goroot/src/runtime/malloc.go:643 +0x869 fp=0xc820032aa8 sp=0xc8200329d0
runtime.newarray(0x25c640, 0x18, 0x152be8)
/private/var/folders/9y/ppk2fnqj5lscwqw_l6lhdrx8005bt1/T/appengine/go_appengine/goroot/src/runtime/malloc.go:798 +0xc9 fp=0xc820032ae8 sp=0xc820032aa8
runtime.makeslice(0x1e6920, 0x18, 0x18, 0x0, 0x0, 0x0)
/private/var/folders/9y/ppk2fnqj5lscwqw_l6lhdrx8005bt1/T/appengine/go_appengine/goroot/src/runtime/slice.go:32 +0x165 fp=0xc820032b38 sp=0xc820032ae8
cmd/link/internal/ld.readsym(0xc820074240, 0xc825a9e1a0, 0xc821107850, 0x8, 0xc821ecb360, 0x4c)
/private/var/folders/9y/ppk2fnqj5lscwqw_l6lhdrx8005bt1/T/appengine/go_appengine/goroot/src/cmd/link/internal/ld/objfile.go:239 +0xba6 fp=0xc820032f80 sp=0xc820032b38
cmd/link/internal/ld.ldobjfile(0xc820074240, 0xc825a9e1a0, 0xc821107850, 0x8, 0xbf902, 0xc821ecb360, 0x4c)
/private/var/folders/9y/ppk2fnqj5lscwqw_l6lhdrx8005bt1/T/appengine/go_appengine/goroot/src/cmd/link/internal/ld/objfile.go:147 +0xa62 fp=0xc820033190 sp=0xc820032f80
cmd/link/internal/ld.ldobj(0xc825a9e1a0, 0xc821107850, 0x8, 0xbf93e, 0xc821ecb360, 0x4c, 0xc82326a050, 0x44, 0x1, 0x0)
/private/var/folders/9y/ppk2fnqj5lscwqw_l6lhdrx8005bt1/T/appengine/go_appengine/goroot/src/cmd/link/internal/ld/lib.go:1351 +0x1569 fp=0xc820033400 sp=0xc820033190
cmd/link/internal/ld.objfile(0xc82409ce70)
/private/var/folders/9y/ppk2fnqj5lscwqw_l6lhdrx8005bt1/T/appengine/go_appengine/goroot/src/cmd/link/internal/ld/lib.go:847 +0x10d9 fp=0xc820033710 sp=0xc820033400
cmd/link/internal/ld.loadlib()
/private/var/folders/9y/ppk2fnqj5lscwqw_l6lhdrx8005bt1/T/appengine/go_appengine/goroot/src/cmd/link/internal/ld/lib.go:513 +0x5ce fp=0xc8200339f0 sp=0xc820033710
cmd/link/internal/ld.Ldmain()
/private/var/folders/9y/ppk2fnqj5lscwqw_l6lhdrx8005bt1/T/appengine/go_appengine/goroot/src/cmd/link/internal/ld/pobj.go:214 +0x1cd3 fp=0xc820033e70 sp=0xc8200339f0
cmd/link/internal/amd64.Main()
/private/var/folders/9y/ppk2fnqj5lscwqw_l6lhdrx8005bt1/T/appengine/go_appengine/goroot/src/cmd/link/internal/amd64/obj.go:44 +0x19 fp=0xc820033e78 sp=0xc820033e70
main.main()
/private/var/folders/9y/ppk2fnqj5lscwqw_l6lhdrx8005bt1/T/appengine/go_appengine/goroot/src/cmd/link/main.go:27 +0x36f fp=0xc820033f50 sp=0xc820033e78
runtime.main()
/private/var/folders/9y/ppk2fnqj5lscwqw_l6lhdrx8005bt1/T/appengine/go_appengine/goroot/src/runtime/proc.go:188 +0x2b0 fp=0xc820033fa0 sp=0xc820033f50
runtime.goexit()
/private/var/folders/9y/ppk2fnqj5lscwqw_l6lhdrx8005bt1/T/appengine/go_appengine/goroot/src/runtime/asm_amd64.s:1998 +0x1 fp=0xc820033fa8 sp=0xc820033fa0
I ran ltrace on a Word processor and opened a sample file, but surprisingly got only two calls.
__libc_start_main(0x8048820, 1, 0xbfe08844, 0x8048850, 0x80488b0 <unfinished ...>
_ZN10AP_UnixApp4mainEPKciPPc(0x8048910, 1, 0xbfe08844, 0xb61feff4, 0x8048850) = 0
+++ exited (status 0) +++
Shouldn't ltrace print all library calls?
The problem is that ltrace only intercepts calls from the main executable (abiword here) to other shared libraries, but does not intercept calls from one shared library to another.
For abiword, the main function doesn't actually do much:
(gdb) disas main
Dump of assembler code for function main:
0x0000000000400a70 <+0>: mov %rsi,%rdx
0x0000000000400a73 <+3>: mov %edi,%esi
0x0000000000400a75 <+5>: mov $0x400b6c,%edi
0x0000000000400a7a <+10>: jmpq 0x400950 <_ZN10AP_UnixApp4mainEPKciPPc#plt>
End of assembler dump.
As you can see, it simply does a return AP_UnixApp::main(argc, "abiword", argv);, and all the real activity happens in the library that implements AP_UnixApp::main (in my case, in /usr/lib/libabiword-2.8.so).
On a Fedora system, you can try using frysk instead. In particular, this:
ftrace -sym '*' abiword
produces a (very long) trace, beginning with:
528.528 attached /usr/bin/abiword
528.528 call #libpthread.so.0#_init(0x1, 0x7fffa8ba5bd8, 0x7fffa8ba5be8, 0x7fffa8ba5be8, 0x1f25bc2, 0x7)
528.528 call #libpthread.so.0#__pthread_initialize_minimal(0x1, 0x7fffa8ba5bd8, 0x7fffa8ba5be8, 0x7fffa8ba5be8, 0x1f25bc2, 0x7)
528.528 call #libpthread.so.0#__libc_sigaction(0x20, 0x7fffa8ba5a70, 0x0, 0x0, 0x1f25bc2, 0x7)
528.528 call #libpthread.so.0#__libc_sigaction(0x21, 0x7fffa8ba5a70, 0x0, 0x7f32501f27b0, 0x0, 0x7)
528.528 call #libc.so.6#getrlimit(0x3, 0x7fffa8ba5b10, 0x3f, 0x40, 0x0, 0x7) = 0
528.528 call #libc.so.6#sysconf(0x1e, 0x7fffa8ba5b10, 0x3f, 0x30220e7b17, 0x0, 0x7)
528.528 call #libc.so.6#getpagesize(0x1e, 0x7fffa8ba5b10, 0xfffffffffff51435, 0x30220e7b17, 0x0, 0x7) = 4096
528.528 leave #libc.so.6#sysconf = 4096
528.528 call #libc.so.6#__libc_dl_error_tsd(0x1e, 0x7fffa8ba5b10, 0x800000, 0x2a40, 0x0, 0x7) = 139854069229848
...
Ftrace documentation here.