[RFC] cygport: split debuginfo packages

Yaakov (Cygwin/X) yselkowitz@users.sourceforge.net
Thu Jun 21 19:47:00 GMT 2012


On 2012-06-21 04:03, Corinna Vinschen wrote:
> On Jun 21 01:24, Yaakov (Cygwin/X) wrote:
>> 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.

Thanks for tracking that down.

>> 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?

Fedora -debuginfo packages include referenced sources in a 
package-specific subdir of /usr/src/debug.  There are several reasons 
for this:

* packages may be built anywhere on the system (a single location is 
required to be useful by all);
* relying on -src means -debuginfo isn't usable by itself (requires an 
extra installation step);
* sources generated during the build won't be found (this is why 
__prepdebugsrc checks in $B as well as $S for sources).

It seems RPM solves this dilemma by changing the encoded 
debug-prefix-map on the fly[1], but that program is ELF-specific.

>> 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...

That is a pain, as all but the smallest packages have sources in more 
than one (sub)directory.  But now that you mention it, substitute-path 
would be a feasible solution in most cases.

So the question is, are package maintainers okay with an additional 
directory or substitute-path for in-tree debugging, or can we find an 
equivalent to RPM's debugedit?

>> 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?

There is no difference in objdump -h output between the results of any 
of the --strip-* options, but the file sizes definitely change, e.g.:

unstripped        4766253 bytes
split .dbg file   3765748
--strip-debug     1479875
--strip-unneeded  1069624
--strip-all       1024014

(This is before --add-gnu-debuglink, which adds 527 bytes.)

Unfortunately, the manpages aren't clear; what exactly is meant by 
"symbols needed for relocation processing" and "[non-debugging] symbols 
that are not needed for relocation processing"?


Yaakov

[1] http://rpm.org/gitweb?p=rpm.git;a=blob;f=tools/debugedit.c;hb=HEAD



More information about the Cygwin-apps mailing list