<div dir="ltr">Awesome stuff Ben.  I'll try to find some time to review these.</div><div class="gmail_extra"><br><div class="gmail_quote">On 22 November 2016 at 06:18, Ben Gamari <span dir="ltr"><<a href="mailto:ben@smart-cactus.org" target="_blank">ben@smart-cactus.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello fellow DWARF enthusiasts,<br>
<br>
Tonight I finally made something of a breakthrough on the DWARF front;<br>
after finding a small logic error in one of my patches I was able to get<br>
a full stack trace into and out of Haskell using the runtime system's<br>
native stack unwinder. This is quite exciting!<br>
<br>
Recall that up until now there have been a few issues which can lead to<br>
problems with unwinding,<br>
<br>
 * #11353: Unsafe foreign calls can require the NCG to make stack<br>
   pointer adjustments to accomodate native calling conventions. These<br>
   adjustments need to be taken into account when we generate unwinding<br>
   information.<br>
<br>
 * #11337: Stack fixups produced by CmmStackLayout aren't reflected in<br>
   unwinding information. Essentially this was a result of the fact that<br>
   our current unwinding implementation assumes that stack layout is<br>
   fixed over the course of a block.<br>
<br>
 * #11338: The region surrounding safe foreign calls doesn't get proper<br>
   unwinding information.<br>
<br>
I've solved all three of these in my branch, which I've rebased, split<br>
up, and posted to Phabricator. The result is quite a stack of<br>
differentials,<br>
<br>
 * D2740: OrdList: Add Foldable, Traversable instances<br>
<br>
   Some throat-clearing.<br>
<br>
 * D2735: Use newBlockId instead of newLabelC<br>
<br>
   Just some refactoring.<br>
<br>
 * D2737: NCGMonad: Add MonadUnique NatM instance<br>
<br>
   This will come in handy later.<br>
<br>
 * D2736: AsmCodeGen: Refactor worker in cmmNativeGens<br>
<br>
   More refactoring I did while trying to understand the dataflow in the<br>
   NCG.<br>
<br>
 * D2739: CmmCommonBlockElim: Ignore CmmUnwind nodes<br>
<br>
   This is a fix to what I believe is a bug which I noticed while<br>
   reading through the implementation.<br>
<br>
 * D2741: Generalize CmmUnwind and pass unwind information through NCG<br>
<br>
   This is the bulk of the change. Here we refactor the treatment of<br>
   unwinding information to provide the flexibility we will need to<br>
   address the issues described above and fix #11353. Review is badly<br>
   needed here.<br>
<br>
 * D2742: CmmLayoutStack: Add unwind information on stack fixups<br>
<br>
   Here we use the infrastructure provided in D2741 to fix #11337.<br>
<br>
 * D2743: StgCmmForeign: Emit debug information for safe foreign calls<br>
<br>
   Here we fix #11338 by adding unwind information to the safe foreign<br>
   call prologue/epilogue code.<br>
<br>
 * D2738: Cmm: Add support for undefined unwinding statements<br>
<br>
   Fix unwinding information for stg_stack_underflow_frames, which we<br>
   have no means of unwinding out of. For this we need to add support<br>
   for unwinding declarations which tell the underwinder to "forget"<br>
   about the value of a register.<br>
<br>
Reviews would be greatly appreciated.<br>
<br>
Cheers,<br>
<br>
 - Ben<br>
</blockquote></div><br></div>