DWARF patches for 8.2

Ben Gamari ben at smart-cactus.org
Tue Nov 22 06:18:55 UTC 2016


Hello fellow DWARF enthusiasts,

Tonight I finally made something of a breakthrough on the DWARF front;
after finding a small logic error in one of my patches I was able to get
a full stack trace into and out of Haskell using the runtime system's
native stack unwinder. This is quite exciting!

Recall that up until now there have been a few issues which can lead to
problems with unwinding,

 * #11353: Unsafe foreign calls can require the NCG to make stack
   pointer adjustments to accomodate native calling conventions. These
   adjustments need to be taken into account when we generate unwinding
   information.

 * #11337: Stack fixups produced by CmmStackLayout aren't reflected in
   unwinding information. Essentially this was a result of the fact that
   our current unwinding implementation assumes that stack layout is
   fixed over the course of a block.

 * #11338: The region surrounding safe foreign calls doesn't get proper
   unwinding information.

I've solved all three of these in my branch, which I've rebased, split
up, and posted to Phabricator. The result is quite a stack of
differentials,

 * D2740: OrdList: Add Foldable, Traversable instances

   Some throat-clearing.

 * D2735: Use newBlockId instead of newLabelC

   Just some refactoring.

 * D2737: NCGMonad: Add MonadUnique NatM instance

   This will come in handy later.

 * D2736: AsmCodeGen: Refactor worker in cmmNativeGens

   More refactoring I did while trying to understand the dataflow in the
   NCG.

 * D2739: CmmCommonBlockElim: Ignore CmmUnwind nodes

   This is a fix to what I believe is a bug which I noticed while
   reading through the implementation.

 * D2741: Generalize CmmUnwind and pass unwind information through NCG

   This is the bulk of the change. Here we refactor the treatment of
   unwinding information to provide the flexibility we will need to
   address the issues described above and fix #11353. Review is badly
   needed here.

 * D2742: CmmLayoutStack: Add unwind information on stack fixups

   Here we use the infrastructure provided in D2741 to fix #11337.

 * D2743: StgCmmForeign: Emit debug information for safe foreign calls

   Here we fix #11338 by adding unwind information to the safe foreign
   call prologue/epilogue code.

 * D2738: Cmm: Add support for undefined unwinding statements

   Fix unwinding information for stg_stack_underflow_frames, which we
   have no means of unwinding out of. For this we need to add support
   for unwinding declarations which tell the underwinder to "forget"
   about the value of a register.

Reviews would be greatly appreciated.

Cheers,

 - Ben
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 454 bytes
Desc: not available
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20161122/b9a9c74a/attachment.sig>


More information about the ghc-devs mailing list