On Wed, Apr 18, 2007 at 05:44:25AM -0700, Brian Dessent wrote: > >The attached patch allows for dllfixdbg to copy DWARF-2 debug sections >into the .dbg file. There was also an (accidently?) duplicated section >in the cygwin.sc linker script that I removed while I was there. > >The advantages of being able to build newlib/winsup with -gdwarf-2 in >C/CXXFLAGS are a ~38% smaller .dbg file, but more importantly a much >more pleasant debugger experience. gdb is not nearly as confused about >the sigfe/sigbe signal wrappers, and can unwind the stack cleanly all >the way up to mainCRTStartup() even when stepping through deep internal >cygwin1.dll guts. > >Here's an example from a simple hello world exe. With -gdwarf-2: > >(gdb) bt >#0 fstat64 (fd=1, buf=0x22afd0) > at /usr/src/sourceware/winsup/cygwin/syscalls.cc:1102 >#1 0x610b4928 in _fstat64_r (ptr=0x50001, fd=327681, buf=0x50001) > at /usr/src/sourceware/winsup/cygwin/syscalls.cc:1115 >#2 0x61107174 in __smakebuf_r (ptr=0x22d008, fp=0x611114f8) > at /usr/src/sourceware/newlib/libc/stdio/makebuf.c:53 >#3 0x6110667b in __swsetup_r (ptr=0x50001, fp=0x611114f8) > at /usr/src/sourceware/newlib/libc/stdio/wsetup.c:67 >#4 0x610f21a6 in _vfprintf_r (data=0x22d008, fp=0x611114f8, > fmt0=0x402000 "Hello world\n", ap=0x22cca4 "/") > at /usr/src/sourceware/newlib/libc/stdio/vfprintf.c:547 >#5 0x610ff208 in printf ( > fmt=0x22eea8e0 <Address 0x22eea8e0 out of bounds>) > at /usr/src/sourceware/newlib/libc/stdio/printf.c:51 >#6 0x610a5498 in _sigfe () > at /usr/src/sourceware/winsup/cygwin/cygserver.h:82 >#7 0x00000009 in ?? () >#8 0x61005efa in dll_crt0_1 () > at /usr/src/sourceware/winsup/cygwin/dcrt0.cc:943 >#9 0x61004216 in _cygtls::call2 (this=0x22ce64, > func=0x610052a0 <dll_crt0_1(void*)>, arg=0x0, buf=0x22cdd0) > at /usr/src/sourceware/winsup/cygwin/cygtls.cc:74 >#10 0x61004290 in _cygtls::call (func=0x610a5498 <_sigbe>, arg=0x0) > at /usr/src/sourceware/winsup/cygwin/cygtls.cc:67 >#11 0x61005171 in _dll_crt0 () > at /usr/src/sourceware/winsup/cygwin/dcrt0.cc:956 >#12 0x004010e3 in cygwin_crt0 (f=0x401040 <main>) > at /usr/src/sourceware/winsup/cygwin/lib/cygwin_crt0.c:32 >#13 0x0040103d in mainCRTStartup () > at /usr/src/sourceware/winsup/cygwin/crt0.c:51 > >Exact same breakpoint, -g (stabs): > >(gdb) bt >#0 fstat64 (fd=1628141592, buf=0x1) > at /usr/src/sourceware/winsup/cygwin/syscalls.cc:1102 >#1 0x611b5708 in _libntdll_a_iname () from /bin/cygwin1.dll >#2 0x00000000 in ?? () > >Brian >2007-04-18 Brian Dessent <[EMAIL PROTECTED]> > > * cygwin.sc: Remove duplicated .debug_macinfo section. > * dllfixdbg: Also copy DWARF-2 sections into .dbg file.
Thanks for doing this. Please check in. Can we switch to dwarf-2 by default in the cygwin makefile(s)? cgf