[patch] support -gdwarf-2 when creating cygwin1.dbg

Corinna Vinschen corinna-cygwin@cygwin.com
Wed Apr 18 13:43:00 GMT 2007

On Apr 18 09:23, Christopher Faylor wrote:
> On Wed, Apr 18, 2007 at 06:17:59AM -0700, Brian Dessent wrote:
> >Christopher Faylor wrote:
> >
> >> Thanks for doing this.  Please check in.  Can we switch to dwarf-2 by
> >> default in the cygwin makefile(s)?
> >
> >I thought about that, but the problem is anything you do to *FLAGS in
> >winsup/cygwin won't affect flags used in the other dirs like libiberty
> >or newlib, and so unless you set CXXFLAGS and CFLAGS when you do
> >toplevel configure, you'll end up with a mish-mash of some stabs and
> >some DW2 in the .dbg file.
> So, maybe a top-level configure option would be useful?  At the very least
> we can get rid of the -gstabs specific use in configure.
> >Corinna Vinschen wrote:
> >
> >> As long as we use a 3.x or 4.0.x gcc it should be ok.  Later gcc's
> >> explicitely switch off the generation of a DW_CFA_offset column in the
> >> .debug_frame CIE header information, which breaks backtracing in GDB.
> >
> >Hmm, I think I read something about that on the gcc list.  Is this just
> >a case of gcc switching to doing TheActualRightThing and gdb not having
> >being updated yet?

GDB's frame unwinding works fine, *iff* the DW_CFA_offset column is

> >> There's an explicit
> >> 
> >> #define DWARF2_UNWIND_INFO 0
> >> 
> >> in gcc/config/i386/cygming.h right now.  The accompanying comment is
> >
> >Aren't we talking about two different things here?  That's for unwinding
> >during exception handling, but you can still leave that at 0 (and use
> >--enable-sjlj-exceptions) and still get the benefit of -gdwarf-2 for
> >gdb's consumption.

Don't ask me about exception handling :}

I debugged Cygwin native GDB a couple of days ago with code created by
gcc 4.2.  It turned out that the DWARF2_UNWIND_INFO define set to 0
resulted in the DW_CFA_offset column missing.  The result is that GDB is
unable to get the return address on the stack when using the dwarf2
frame sniffer.  Setting DWARF2_UNWIND_INFO to 1 in gcc/config/i386/cygming.h
results in gcc emitting the missing DW_CFA_offset column and GDB is happy
again.  Older gcc's <= 4.0.1 always created the DW_CFA_offset column, so
GDB is always happy with the created debug info.

> IIRC, this is turned on because of funkiness with exception unwinding in
> DLLs.

I'm not at all fluent with this stuff.  Is that really important
for Cygwin?


Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

More information about the Cygwin-patches mailing list