nickng / dingo-hunter

Static analyser for finding Deadlocks in Go
Apache License 2.0
316 stars 28 forks source link

can't analyze etcd #3

Open heyitsanthony opened 8 years ago

heyitsanthony commented 8 years ago

I try

[anthony@go/src/github.com/coreos/etcd]$ dingo-hunter main.go

and get (truncated):

++ call.toplevel init()
++ call.toplevel main()
++ call github.com/coreos/etcd/etcdmain.Main()
++ call github.com/coreos/etcd/etcdmain.checkSupportArch()
++ call os.LookupEnv(key:caller[???."ETCD_UNSUPPORTED_...":string] = Undefined)
++ call syscall.Getenv(key:caller[os.LookupEnv.key] = Undefined)
   # t0 = Alloc local string (value) of type string
   # t1 = Alloc local bool (found) of type bool
++ call (*sync.Once).Do()
-- return from (*sync.Once).Do (0 retvals)
++ call builtin len(key) # TODO (handle builtin)
   # t4 = t3 == 0:int
   # store *syscall.Getenv.t0 = ???."":string of type string
   # store *syscall.Getenv.t1 = ???.false:bool of type bool
   # *t0 = *local string (value) (not found)
   # *t1 = *local bool (found) (not found)
++ call (*sync.RWMutex).RLock()
-- return from (*sync.RWMutex).RLock (0 retvals)
   syscall.Getenv.t8 = *env (global) of type *map[string]int
    ^ i.e. ???.env@0
   # *env = *syscall.env/???.env (not found, type=map[string]int)
   # unhandled t9 = t8[key],ok
   # t10 = extract t9 #0 of type int
   # t11 = extract t9 #1 of type bool
   syscall.Getenv.t16 = *envs (global) of type *[]string
    ^ i.e. ???.envs@0
   syscall.Getenv.t16 = *envs (array)
   syscall.Getenv.t17 = &t16(=???.envs@0)[&{{{35341377088} 10 6393472 0 [35341401984]} 35341145680 0}] of type *string
     ^ accessed for the first time: use t17 as elem definition
   # *t17 = *&t16[t10]/syscall.Getenv.t17 (not found, type=string)
++ call builtin len(t18) # TODO (handle builtin)
   # t25 = t23 < t24
   # unhandled t19 = t18[t23]
   # t20 = t19 == 61:byte
   # t26 = t23 + 1:int
   # store *syscall.Getenv.t0 = syscall.Getenv.t27 of type string
   # store *syscall.Getenv.t1 = ???.true:bool of type bool
++ call (*sync.RWMutex).RUnlock()
-- return from (*sync.RWMutex).RUnlock (0 retvals)
   # *t0 = *local string (value) (not found)
   # *t1 = *local bool (found) (not found)
   # t30 = t23 + 1:int
   # store *syscall.Getenv.t0 = ???."":string of type string
   # store *syscall.Getenv.t1 = ???.false:bool of type bool
++ call (*sync.RWMutex).RUnlock()
-- return from (*sync.RWMutex).RUnlock (0 retvals)
   # *t0 = *local string (value) (not found)
   # *t1 = *local bool (found) (not found)
   # store *syscall.Getenv.t0 = ???."":string of type string
   # store *syscall.Getenv.t1 = ???.false:bool of type bool
++ call (*sync.RWMutex).RUnlock()
-- return from (*sync.RWMutex).RUnlock (0 retvals)
   # *t0 = *local string (value) (not found)
   # *t1 = *local bool (found) (not found)
-- return from syscall.Getenv (2 retvals)
   os.LookupEnv.t1 = extract t0[#0] == Undefined
   os.LookupEnv.t2 = extract t0[#1] == Undefined
-- return from os.LookupEnv (2 retvals)
   github.com/coreos/etcd/etcdmain.checkSupportArch.t1 = extract t0[#0] == Undefined
   github.com/coreos/etcd/etcdmain.checkSupportArch.t2 = extract t0[#1] == Undefined
   # t16 = t1 == "amd64":string
   github.com/coreos/etcd/etcdmain.checkSupportArch.t3 = *plog (global) of type **github.com/coreos/pkg/capnslog.PackageLogger
    ^ i.e. ???.plog@0
   # *plog = *github.com/coreos/etcd/etcdmain.plog/???.plog (not found, type=*github.com/coreos/pkg/capnslog.PackageLogger)
   github.com/coreos/etcd/etcdmain.checkSupportArch.t4 = Alloc (array@heap) of type *[1]interface{} (1 elems) at /Users/anthony/go/src/github.com/coreos/etcd/etcdmain/etcd.go:627:102
   github.com/coreos/etcd/etcdmain.checkSupportArch.t5 = &t4(=github.com/coreos/etcd/etcdmain.checkSupportArch.t4@0)[&{6393472 0}] of type *interface{}
     ^ accessed for the first time: use t5 as elem definition
   # github.com/coreos/etcd/etcdmain.checkSupportArch.t6 <- make interface{} <- string (t1)
   # store *github.com/coreos/etcd/etcdmain.checkSupportArch.t5 = github.com/coreos/etcd/etcdmain.checkSupportArch.t6 of type interface{}
++ call (*github.com/coreos/pkg/capnslog.PackageLogger).Warningf(p:caller[github.com/coreos/etcd/etcdmain.checkSupportArch.t3] = Undefined, format:caller[???."running etcd on u...":string] = Undefined, args:caller[github.com/coreos/etcd/etcdmain.checkSupportArch.t7] = Undefined)
++ call fmt.Sprintf()
-- Return from fmt.Sprintf (builtin/ext) with a single value
-- return from fmt.Sprintf (1 retvals)
   (*github.com/coreos/pkg/capnslog.PackageLogger).Warningf.t1 = Alloc (array@heap) of type *[1]interface{} (1 elems) at /Users/anthony/go/src/github.com/coreos/pkg/capnslog/pkg_logger.go:107:64
   (*github.com/coreos/pkg/capnslog.PackageLogger).Warningf.t2 = &t1(=(*github.com/coreos/pkg/capnslog.PackageLogger).Warningf.t1@0)[&{6393472 0}] of type *interface{}
     ^ accessed for the first time: use t2 as elem definition
   # (*github.com/coreos/pkg/capnslog.PackageLogger).Warningf.t3 <- make interface{} <- string (t0)
   # store *(*github.com/coreos/pkg/capnslog.PackageLogger).Warningf.t2 = (*github.com/coreos/pkg/capnslog.PackageLogger).Warningf.t3 of type interface{}
++ call (*github.com/coreos/pkg/capnslog.PackageLogger).internalLog(p:caller[(*github.com/coreos/pkg/capnslog.PackageLogger).Warningf.p] = Undefined, depth:caller[???.2:int] = Undefined, inLevel:caller[???.1:github.com/coreos/pkg/capnslog.LogLevel] = Undefined, entries:caller[(*github.com/coreos/pkg/capnslog.PackageLogger).Warningf.t4] = Undefined)
[and so on]
nickng commented 8 years ago

Related to #8, where tool refuses to continue analysis when encountering unknown SSA value. It's possible to continue without the value.