Skip to content
  • Peter Wortmann's avatar
    Generate DWARF unwind information · edd6d676
    Peter Wortmann authored
    This tells debuggers such as GDB how to "unwind" a program state,
    which allows them to walk the stack up.
    
    Notes:
    
    * The code is quite general, perhaps unnecessarily so. Unless we get
      more unwind information, only the first case of pprSetUnwind will
      get used - and pprUnwindExpr and pprUndefUnwind will never be
      called. It just so happens that this is a point where we can get a
      lot of features cheaply, even if we don't use them.
    
    * When determining what location to show for a return address, most
      debuggers check the map for "rip-1", assuming that's where the
      "call" instruction is. For tables-next-to-code, that happens to
      always be the end of an info table. We therefore cheat a bit here by
      shifting .debug_frame information so it covers the end of the info
      table, as well as generating a .loc directive for the info table
      data.
    
      Debuggers will still show the wrong label for the return address,
      though.  Haven't found a way around that one yet.
    
    (From Phabricator D396)
    edd6d676