<div dir="auto">Have you looked at <div dir="auto"><a href="https://www.haskell.org/ghc/blog/20200403-dwarf-1.html">https://www.haskell.org/ghc/blog/20200403-dwarf-1.html</a> or other docs online ?</div></div><div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Feb 20, 2024 at 7:40 PM Clinton Mead <<a href="mailto:clintonmead@gmail.com">clintonmead@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi All<br><br>I've noticed this is a quiet mailing list recently, but I couldn't find a more appropriate place to ask this question. Please say if there's somewhere else I should be asking.<br><br>It's my understanding that one can get GHC executables to dump backtraces of all their running threads to stderr upon receiving SIGQUIT. And the way to do that is to build with 'libdw' support.<div><br></div><div>We have a build system using Nix, and we're unfortunately a bit behind on GHC 9.2.2 atm, but in anycase, I noticed in a Nix develop shell when I run `ghc --info | grep libdw` I get:</div><div><br></div><div><span style="color:rgb(29,28,29);font-family:Monaco,Menlo,Consolas,"Courier New",monospace;font-size:12px;font-variant-ligatures:none;background-color:rgba(29,28,29,0.04)">,("RTS expects libdw","NO")</span><br></div><div><br></div><div>So I instead added the following to my Haskell package overrides:<br></div><div><br></div><div><span style="color:rgb(29,28,29);font-family:Monaco,Menlo,Consolas,"Courier New",monospace;font-size:12px;font-variant-ligatures:none;background-color:rgba(29,28,29,0.04)">ghc =
old.ghc.overrideAttrs (oldAttrs: {
configureFlags = oldAttrs.configureFlags ++
[
"--with-libdw-includes=${<a href="http://pkgs.elfutils.dev" target="_blank">pkgs.elfutils.dev</a>}/include"
"--with-libdw-libraries=${pkgs.elfutils.out}/lib"
"--enable-dwarf-unwind"
];
buildInputs = oldAttrs.buildInputs ++ [pkgs.elfutils];
});</span><br></div><div><br></div><div>I basically copy/pastaed this from <a href="https://github.com/input-output-hk/haskell.nix/blob/master/compiler/ghc/default.nix" target="_blank">https://github.com/input-output-hk/haskell.nix/blob/master/compiler/ghc/default.nix</a><br><br>And this seems to work, now when I run `ghc --info` I get:<br><br><span style="color:rgb(29,28,29);font-family:Monaco,Menlo,Consolas,"Courier New",monospace;font-size:12px;font-variant-ligatures:none;background-color:rgba(29,28,29,0.04)">,("RTS expects libdw","YES")</span><br><br>But despite building with this version of GHC, still when I send `SIGQUIT` to a process built with this version of GHC, I just get the message:<br><br><span style="color:rgb(28,28,28);font-family:"Noto Sans",Arial,sans-serif;font-size:14px">"This build does not support backtraces."</span><br><br>Now I have also been building my packages with `-g`, passing `--enable-debug-info` etc, although it's my understanding that what I've done just with building GHC with `--enable-dwarf-unwind` _should_ be enough to get a backtrace upon SIGQUIT, it might just be a poor one if the debugging symbols aren't added.<br><br>But clearly I've missed something if it's not working. I'm not quite sure what set of circumstances the message <span style="color:rgb(28,28,28);font-family:"Noto Sans",Arial,sans-serif;font-size:14px">"This build does not support backtraces"</span> is displayed? Is there a runtime check to see whether the "libdw" library is actually in the library path, in addition to the requirement that GHC be built with libdw support? If that's the case, perhaps as I'm running this on NixOS I need to add something to my executable's LD_LIBRARY_PATH or something? Or is there some option I need to give GHC/Cabal to ensure that backtrace support is added to the executable's runtime as well as making sure I've compiled with GHC that's compiled with libdw support? Or is there some other runtime RTS option I need to give to my executable?<br><br>As you can see, I'm completely lost about how to move forward on this, so any help would be very much appreciated.<br><br>Thanks,<br>Clinton</div></div>
_______________________________________________<br>
Glasgow-haskell-users mailing list<br>
<a href="mailto:Glasgow-haskell-users@haskell.org" target="_blank">Glasgow-haskell-users@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/glasgow-haskell-users" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/glasgow-haskell-users</a><br>
</blockquote></div></div>