[RFC] cygport: split debuginfo packages

Corinna Vinschen corinna-cygwin@cygwin.com
Thu Jun 21 09:03:00 GMT 2012

On Jun 21 01:24, Yaakov (Cygwin/X) wrote:
> Attached is a first draft of a patch to support split debuginfo
> packages automatically in cygport.  I'm looking for comments and
> suggestions, particularly on the following:
> 1) I propose adding a Debug category for all -debuginfo packages.
> 2) This places the debuginfo from e.g. /usr/bin/cygfoo-X.dll into
> /usr/lib/debug/usr/bin/cygfoo-X.dbg.  Unfortunately, when gdb finds
> library dependencies, they show up as e.g.
> /cygdrive/c/cygwin/bin/cygfoo-X.dll instead of as in /usr/bin,
> causing gdb to not find the debug file.  There are at least three
> solutions to this:
> a. Fix (cygwin or) gdb to use /usr paths over /cygdrive/c/cygwin paths;

I just had a quick look into this issue and it turns out that GDB
doesn't use cygwin_conv_path in all circumstances.  Rather, it uses
realpath in most circumstances.

The problem is a long standing behaviour (since 2005) of realpath:
A DOS path is always converted to its /cygdrive equivalent.

I think the right thing to do here is to fix realpath.  It just has
to be done carefully so as not to re-introduce the bugs fixed by
introducing this behaviour back then.

> b. Move debug files to a .debug subdirectory (e.g.
> /usr/bin/.debug/cygfoo-X.dbg);
> c. Move debug files alongside binaries (e.g. /usr/bin/cygfoo-X.dbg).

The upside of c is that debug files alongside the binaries always works.
The downside is the enormous clutter in /bin.  I'll fix realpath in the
first place and then we can see how /usr/lib/debug works out, I guess.

> 3) Sources referenced by the .dbg files are placed under
> /usr/src/debug/${PF}, as indicated by the -fdebug-prefix-map flags.

I don't quite understand that.  The sources are not part of the
debuginfo package.  And usually you'd want to reference the sources
from your builds.  Wouldn't /usr/src/${PVR}/src make more sense?

> Unfortunately, this breaks in-tree debugging (e.g. a noinst test or
> sample application).  AFAICS, binutils doesn't support changing the
> debug-prefix-map after the fact.  Does anyone have any suggestions
> on how to handle this?

Well, there's the "dir" command on the GDB command line...

> 4) The resulting binaries are somewhat larger, having only been
> --strip-debug'ed; what more is lost by --strip-unneeded or
> --strip-all to justify the larger binaries?

I don't know.  Did you look with objdump -h what the difference is?


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

More information about the Cygwin-apps mailing list