So, like, what's up with libdw, exactly?
http://downloads.haskell.org/~ghc/8.2.1/docs/html/users_guide/debug-info.html
TL;DR Build your code with -g and GHC includes dwarf debugging information. libdw is used for interpreting dwarf information and backtrace support. You can send SIGUSR2 to a compiled program to get it to dump stack traces on stderr. You can also use this module to get backtraces programmatically as you wish. It requires Linux, and a custom GHC.
This module is still fairly experimental and I believe Ben only got DWARF information working reliably in the 8.2.x branch (there's simply a terse "More reliable DWARF debug information" in the release notes). It's new enough that it's not really surprising nobody is using it yet...
More on reddit.comc - How to find the function DIE (Debugging Information Entry) using libdw, given an eip (instruction pointer)? - Stack Overflow
How does Libby work?
How seriously do you take LIB?
Videos
» pip install libdw
The mysterious module GHC.ExecutionStack states
Your GHC must have been built with libdw support for this to work.
user@host:~$ ghc --info | grep libdw
,("RTS expects libdw","YES")
Using stack at least, even with the latest GHC 8.2 nightly snapshot, I instead get this:
$ stack exec -- ghc --info | grep libdw
47: ,("RTS expects libdw","NO")
and indeed, testing out the snippet in the module's documentation simply prints out Nothing.
Now, apart from the source code for protolude, it would appear that absolutely no open-source code imports GHC.ExecutionStack. There is barely any documentation on what this should look like, and more importantly, whether I have to build my own version of GHC to enable this feature.
I'm just looking for pain-free stack traces. +RTS -xc spurts out a thousand stack traces a second as it appears that GHC uses exceptions for multithreading and/or STM, and -xc seems to print out a stack trace even if the exception was caught (I'm guessing here -- -xc's output is too noisy to be useful). Even using profiling is not entirely useful, as now the uncaught exception I'm trying to fix is printed without an accompanying stack trace; moreover, I would like to leave stack traces on permanently, and I don't want to enable profiling in my final build.
Does anyone have any experience with this module, or some background knowledge as to why this functionality appears to be disabled by default? Remember, I'm trying to get full, permanently-on stack traces, which I can use to debug code running on production, so that I'm not left stumped when some random code throws a terse "*** Exception: Prelude.undefined" at me...
Thoughts and prayers?
http://downloads.haskell.org/~ghc/8.2.1/docs/html/users_guide/debug-info.html
TL;DR Build your code with -g and GHC includes dwarf debugging information. libdw is used for interpreting dwarf information and backtrace support. You can send SIGUSR2 to a compiled program to get it to dump stack traces on stderr. You can also use this module to get backtraces programmatically as you wish. It requires Linux, and a custom GHC.
This module is still fairly experimental and I believe Ben only got DWARF information working reliably in the 8.2.x branch (there's simply a terse "More reliable DWARF debug information" in the release notes). It's new enough that it's not really surprising nobody is using it yet...
Which OS are you using? Apparently libdw comes from the elfutils package, which seems really specific to Linux.
Since I don't see anything in GHC's mk/build.mk documentation about either libdw nor elfutils, my guess is that the build system simply checks whether elfutils is installed on your machine in order to determine whether to enable libdw or not.
So, my recommendation is: use Linux, install elfutils, rebuild GHC.