Stack traces in ghci

Dominic Steinitz dominic at steinitz.org
Mon Dec 5 12:20:30 UTC 2016


I am trying to debug a package in which there is a divide by 0 error and attempting to use Simon Marlow’s stack traces: https://simonmar.github.io/posts/2016-02-12-Stack-traces-in-GHCi.html. However ghci is complaining about  missing symbols. What do I need to add to the command line to coax ghci into giving me a stack trace? 

> ~/Dropbox/Private/Stochastic/demo $ ghci -fexternal-interpreter -prof fe-handling-example.o -i../../monad-bayes/src  -package-db=.cabal-sandbox/x86_64-osx-ghc-8.0.1-packages.conf.d
> GHCi, version 8.0.1: http://www.haskell.org/ghc/  :? for help
> Prelude> :l app/Main.hs
> [ 1 of 16] Compiling Control.Monad.Bayes.LogDomain ( ../../monad-bayes/src/Control/Monad/Bayes/LogDomain.hs, interpreted )
> [ 2 of 16] Compiling Control.Monad.Bayes.Primitive ( ../../monad-bayes/src/Control/Monad/Bayes/Primitive.hs, interpreted )
> [ 3 of 16] Compiling Control.Monad.Bayes.Class ( ../../monad-bayes/src/Control/Monad/Bayes/Class.hs, interpreted )
> [ 4 of 16] Compiling Control.Monad.Bayes.Sampler ( ../../monad-bayes/src/Control/Monad/Bayes/Sampler.hs, interpreted )
> [ 5 of 16] Compiling Control.Monad.Bayes.Sequential ( ../../monad-bayes/src/Control/Monad/Bayes/Sequential.hs, interpreted )
> [ 6 of 16] Compiling Control.Monad.Bayes.Prior ( ../../monad-bayes/src/Control/Monad/Bayes/Prior.hs, interpreted )
> [ 7 of 16] Compiling Control.Monad.Bayes.Rejection ( ../../monad-bayes/src/Control/Monad/Bayes/Rejection.hs, interpreted )
> [ 8 of 16] Compiling Control.Monad.Bayes.Weighted ( ../../monad-bayes/src/Control/Monad/Bayes/Weighted.hs, interpreted )
> [ 9 of 16] Compiling Control.Monad.Bayes.Population ( ../../monad-bayes/src/Control/Monad/Bayes/Population.hs, interpreted )
> [10 of 16] Compiling Control.Monad.Bayes.Deterministic ( ../../monad-bayes/src/Control/Monad/Bayes/Deterministic.hs, interpreted )
> [11 of 16] Compiling Control.Monad.Bayes.Conditional ( ../../monad-bayes/src/Control/Monad/Bayes/Conditional.hs, interpreted )
> [12 of 16] Compiling Control.Monad.Bayes.Dist ( ../../monad-bayes/src/Control/Monad/Bayes/Dist.hs, interpreted )
> [13 of 16] Compiling Control.Monad.Bayes.Coprimitive ( ../../monad-bayes/src/Control/Monad/Bayes/Coprimitive.hs, interpreted )
> [14 of 16] Compiling Control.Monad.Bayes.Trace ( ../../monad-bayes/src/Control/Monad/Bayes/Trace.hs, interpreted )
> [15 of 16] Compiling Control.Monad.Bayes.Inference ( ../../monad-bayes/src/Control/Monad/Bayes/Inference.hs, interpreted )
> [16 of 16] Compiling Main             ( app/Main.hs, interpreted )
> 
> app/Main.hs:92:7: warning: [-Wunused-matches]
>     Defined but not used: ‘a’
> 
> app/Main.hs:92:9: warning: [-Wunused-matches]
>     Defined but not used: ‘prevP’
> 
> app/Main.hs:92:15: warning: [-Wunused-matches]
>     Defined but not used: ‘prevZ’
> 
> app/Main.hs:106:5: warning: [-Wunused-do-bind]
>     A do-notation statement discarded a result of type ‘GHC.Prim.Any’
>     Suppress this warning by saying
>       ‘_ <- ($)
>               error (++) "You are here " (++) show state (++) " " show p_obs’
> Ok, modules loaded: Main, Control.Monad.Bayes.LogDomain, Control.Monad.Bayes.Primitive, Control.Monad.Bayes.Class, Control.Monad.Bayes.Population, Control.Monad.Bayes.Conditional, Control.Monad.Bayes.Inference, Control.Monad.Bayes.Sampler, Control.Monad.Bayes.Rejection, Control.Monad.Bayes.Weighted, Control.Monad.Bayes.Sequential, Control.Monad.Bayes.Trace, Control.Monad.Bayes.Dist, Control.Monad.Bayes.Prior, Control.Monad.Bayes.Deterministic, Control.Monad.Bayes.Coprimitive.
> *Main> main
> ghc-iserv-prof: 
> lookupSymbol failed in relocateSection (relocate external)
> /Users/dom/Dropbox/Private/Stochastic/demo/.cabal-sandbox/lib/x86_64-osx-ghc-8.0.1/hmatrix-0.18.0.0-7aYEqJARQEvKYNyM4UGAPZ/libHShmatrix-0.18.0.0-7aYEqJARQEvKYNyM4UGAPZ_p.a: unknown symbol `___ieee_divdc3'
> ghc-iserv-prof: Could not on-demand load symbol '_vectorScan'
> 
> ghc-iserv-prof: 
> lookupSymbol failed in relocateSection (relocate external)
> /Users/dom/Dropbox/Private/Stochastic/demo/.cabal-sandbox/lib/x86_64-osx-ghc-8.0.1/hmatrix-0.18.0.0-7aYEqJARQEvKYNyM4UGAPZ/libHShmatrix-0.18.0.0-7aYEqJARQEvKYNyM4UGAPZ_p.a: unknown symbol `_vectorScan'
> ghc-iserv-prof: Could not on-demand load symbol '_hmatrixzm0zi18zi0zi0zm7aYEqJARQEvKYNyM4UGAPZZ_InternalziVectorizzed_constantAux_closure'
> 
> ghc-iserv-prof: 
> lookupSymbol failed in relocateSection (relocate external)
> /Users/dom/Dropbox/Private/Stochastic/demo/.cabal-sandbox/lib/x86_64-osx-ghc-8.0.1/hmatrix-0.18.0.0-7aYEqJARQEvKYNyM4UGAPZ/libHShmatrix-0.18.0.0-7aYEqJARQEvKYNyM4UGAPZ_p.a: unknown symbol `_hmatrixzm0zi18zi0zi0zm7aYEqJARQEvKYNyM4UGAPZZ_InternalziVectorizzed_constantAux_closure'
> ghc-iserv-prof: Could not on-demand load symbol '_hmatrixzm0zi18zi0zi0zm7aYEqJARQEvKYNyM4UGAPZZ_InternalziMatrix_Matrix_con_info'
> 
> ghc-iserv-prof: 
> lookupSymbol failed in relocateSection (relocate external)
> /Users/dom/Dropbox/Private/Stochastic/demo/.cabal-sandbox/lib/x86_64-osx-ghc-8.0.1/hmatrix-0.18.0.0-7aYEqJARQEvKYNyM4UGAPZ/libHShmatrix-0.18.0.0-7aYEqJARQEvKYNyM4UGAPZ_p.a: unknown symbol `_hmatrixzm0zi18zi0zi0zm7aYEqJARQEvKYNyM4UGAPZZ_InternalziMatrix_Matrix_con_info'
> ghc-iserv-prof: Could not on-demand load symbol '_hmatrixzm0zi18zi0zi0zm7aYEqJARQEvKYNyM4UGAPZZ_InternalziElement_zgzl_info'
> 
> ghc-iserv-prof: 
> lookupSymbol failed in relocateSection (relocate external)
> /Users/dom/Dropbox/Private/Stochastic/demo/.cabal-sandbox/lib/x86_64-osx-ghc-8.0.1/hmatrix-0.18.0.0-7aYEqJARQEvKYNyM4UGAPZ/libHShmatrix-0.18.0.0-7aYEqJARQEvKYNyM4UGAPZ_p.a: unknown symbol `_hmatrixzm0zi18zi0zi0zm7aYEqJARQEvKYNyM4UGAPZZ_InternalziElement_zgzl_info'
> ghc-iserv-prof: Could not on-demand load symbol '_hmatrixzm0zi18zi0zi0zm7aYEqJARQEvKYNyM4UGAPZZ_InternalziUtil_zdfIndexableVectorDouble_closure'
> 
> 
> ByteCodeLink.lookupCE
> During interactive linking, GHCi couldn't find the following symbol:
>   hmatrixzm0zi18zi0zi0zm7aYEqJARQEvKYNyM4UGAPZZ_InternalziUtil_zdfIndexableVectorDouble_closure
> This may be due to you not asking GHCi to load extra object files,
> archives or DLLs needed by your current session.  Restart GHCi, specifying
> the missing library using the -L/path/to/object/dir and -lmissinglibname
> flags, or simply by naming the relevant files on the GHCi command line.
> Alternatively, this link failure might indicate a bug in GHCi.
> If you suspect the latter, please send a bug report to:
>   glasgow-haskell-bugs at haskell.org



Dominic Steinitz
dominic at steinitz.org
http://idontgetoutmuch.wordpress.com



More information about the Glasgow-haskell-users mailing list