Yaakov (Cygwin/X | 21 Jun 2012 08:24
Picon
Gravatar

[RFC] cygport: split debuginfo packages

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

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

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?

TIA,

(Continue reading)

Corinna Vinschen | 21 Jun 2012 11:03
Favicon

Re: [RFC] cygport: split debuginfo packages

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).
(Continue reading)

Corinna Vinschen | 21 Jun 2012 11:34
Favicon

Re: [RFC] cygport: split debuginfo packages

On Jun 21 11:03, Corinna Vinschen wrote:
> 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);
(Continue reading)

Yaakov (Cygwin/X | 21 Jun 2012 21:47
Picon
Gravatar

Re: [RFC] cygport: split debuginfo packages

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 
(Continue reading)

Corinna Vinschen | 22 Jun 2012 11:50
Favicon

Re: [RFC] cygport: split debuginfo packages

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

Hmm, too bad.  In theory it should be possible to tweak the tool to work
on PE-COFF files as well.  After all, we also use Dwarf2 debug
information, so the core of the application is the same.  Just the way
how to read and write the sections has to be changed.  Could be a bit
tricky, though.

(Continue reading)

Christopher Faylor | 21 Jun 2012 14:56
Favicon

Re: [RFC] cygport: split debuginfo packages

On Thu, Jun 21, 2012 at 01:24:36AM -0500, 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;

Why is this necessary?  The path to the debuginfo file is supposed to be
in the executable.  cygwin1.dll doesn't use cygdrive.

cgf

Jon TURNEY | 21 Jun 2012 16:21
Picon
Favicon
Gravatar

Re: [RFC] cygport: split debuginfo packages

On 21/06/2012 13:56, Christopher Faylor wrote:
> On Thu, Jun 21, 2012 at 01:24:36AM -0500, 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;
> 
> Why is this necessary?  The path to the debuginfo file is supposed to be
> in the executable.  cygwin1.dll doesn't use cygdrive.

The .gnu_debuglink section is supposed to contain a filename, not a pathname.
 It's up to the debugger to work out where the file is.

[1] http://sourceware.org/gdb/onlinedocs/gdb/Separate-Debug-Files.html

Christopher Faylor | 21 Jun 2012 18:10
Favicon

Re: [RFC] cygport: split debuginfo packages

On Thu, Jun 21, 2012 at 03:21:49PM +0100, Jon TURNEY wrote:
>On 21/06/2012 13:56, Christopher Faylor wrote:
>> On Thu, Jun 21, 2012 at 01:24:36AM -0500, 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;
>> 
>> Why is this necessary?  The path to the debuginfo file is supposed to be
>> in the executable.  cygwin1.dll doesn't use cygdrive.
>
>The .gnu_debuglink section is supposed to contain a filename, not a pathname.
> It's up to the debugger to work out where the file is.
>
>[1] http://sourceware.org/gdb/onlinedocs/gdb/Separate-Debug-Files.html

Ah, ok.  Thanks.  You'd think that I would know this since I maintain gdb
and set up cygwin1.dbg.

cgf

(Continue reading)

Ken Brown | 22 Jun 2012 17:23
Picon
Favicon

Re: [RFC] cygport: split debuginfo packages

On 6/21/2012 2:24 AM, Yaakov (Cygwin/X) wrote:
> Attached is a first draft of a patch to support split debuginfo packages
> automatically in cygport.

Thanks for doing this.  I tested it on my emacs package, and the build 
seemed to work as expected except for two minor glitches:

* In line 82 of your patch, "-d" should be "-f".

* In line 174 of your patch, "-f" should be "-d".

Ken

Yaakov (Cygwin/X | 29 Jun 2012 21:48
Picon
Gravatar

Re: [RFC] cygport: split debuginfo packages

On Thu, 2012-06-21 at 01:24 -0500, Yaakov (Cygwin/X) wrote:
> Attached is a first draft of a patch to support split debuginfo packages 
> automatically in cygport.

Second draft patch attached.

Yaakov

Attachment (0001-debuginfo.patch): text/x-patch, 7576 bytes
Ken Brown | 30 Jun 2012 18:49
Picon
Favicon

Re: [RFC] cygport: split debuginfo packages

On 6/29/2012 3:48 PM, Yaakov (Cygwin/X) wrote:
> On Thu, 2012-06-21 at 01:24 -0500, Yaakov (Cygwin/X) wrote:
>> Attached is a first draft of a patch to support split debuginfo packages
>> automatically in cygport.
>
> Second draft patch attached.

I tested this on my emacs build, and it worked great.  One very minor 
annoyance was that gdb gave a warning "Source file is more recent than 
executable" the first time a breakpoint was hit.  I think you could 
avoid such warnings by using 'install -p' in __prepdebugsrc, but I 
haven't tested this.

Ken

Jon TURNEY | 7 Jul 2012 15:10
Picon
Favicon
Gravatar

Re: [RFC] cygport: split debuginfo packages

On 29/06/2012 20:48, Yaakov (Cygwin/X) wrote:
> On Thu, 2012-06-21 at 01:24 -0500, Yaakov (Cygwin/X) wrote:
>> Attached is a first draft of a patch to support split debuginfo packages 
>> automatically in cygport.
> 
> Second draft patch attached.

This works fine.  Thanks.

I was going to suggest the use of objcopy --compress-debug-sections, but it
appears that does nothing for PE/COFF files at the moment [1] :-(

[1] http://sourceware.org/bugzilla/show_bug.cgi?id=14067

Achim Gratz | 17 Jul 2012 20:36
Picon

Re: [RFC] cygport: split debuginfo packages

Yaakov (Cygwin/X) writes:
> 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:

The automatic generation of the packages works great, thank you.

Looking at the resulting proliferation of packages I'm beginning to
think however that the debuginfo packages should perhaps be treated like
the source packages (including "foreign" debuginfo) and the associated
handling in genini/upset/setup just like source packages, too.

So if there's a source package package-version-src.tar.bz2, then the
debuginfo package would be called package-version-debuginfo.tar.bz2 and
it would be selected from libpackage if that had package as a foreign
source.  I hope this description makes sense...

Regards,
Achim.
--

-- 
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+

SD adaptation for Waldorf Blofeld V1.15B11:
http://Synth.Stromeko.net/Downloads.html#WaldorfSDada

Christopher Faylor | 17 Jul 2012 20:39
Favicon

Re: [RFC] cygport: split debuginfo packages

On Tue, Jul 17, 2012 at 08:36:48PM +0200, Achim Gratz wrote:
>Yaakov (Cygwin/X) writes:
>> 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:
>
>The automatic generation of the packages works great, thank you.
>
>Looking at the resulting proliferation of packages I'm beginning to
>think however that the debuginfo packages should perhaps be treated like
>the source packages (including "foreign" debuginfo) and the associated
>handling in genini/upset/setup just like source packages, too.
>
>So if there's a source package package-version-src.tar.bz2, then the
>debuginfo package would be called package-version-debuginfo.tar.bz2 and
>it would be selected from libpackage if that had package as a foreign
>source.  I hope this description makes sense...

Maybe the .debuginfo files should be in a "Debug" category.

cgf

Achim Gratz | 17 Jul 2012 21:48
Picon

Re: [RFC] cygport: split debuginfo packages

Christopher Faylor writes:
> Maybe the .debuginfo files should be in a "Debug" category.

I don't think that would be the right thing to do.  It would only be of
help if the debuginfo packages were not shown in the other categories
together with the installation packages, but a flat Debug category seems
even less appealing.  It should be possible to get the debuginfo for
"this package" directly from the package selection, not rummaging around
in the Debug category trying to find something that looks like it might
be related to "that package".

Regards,
Achim.
--

-- 
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+

Factory and User Sound Singles for Waldorf Blofeld:
http://Synth.Stromeko.net/Downloads.html#WaldorfSounds

Christopher Faylor | 17 Jul 2012 21:55
Favicon

Re: [RFC] cygport: split debuginfo packages

On Tue, Jul 17, 2012 at 09:48:31PM +0200, Achim Gratz wrote:
>Christopher Faylor writes:
>> Maybe the .debuginfo files should be in a "Debug" category.
>
>I don't think that would be the right thing to do.  It would only be of
>help if the debuginfo packages were not shown in the other categories
>together with the installation packages, but a flat Debug category seems
>even less appealing.  It should be possible to get the debuginfo for
>"this package" directly from the package selection, not rummaging around
>in the Debug category trying to find something that looks like it might
>be related to "that package".

Ok, let me put it this way.  I'm not keenly interested in spending time
updating setup.exe and the setup.ini generation tools for special case
handling of debuginfo.

Maybe that helps clarify things.

cgf

Yaakov (Cygwin/X | 17 Jul 2012 22:25
Picon
Gravatar

Re: [RFC] cygport: split debuginfo packages

On 2012-07-17 13:39, Christopher Faylor wrote:
> On Tue, Jul 17, 2012 at 08:36:48PM +0200, Achim Gratz wrote:
>> So if there's a source package package-version-src.tar.bz2, then the
>> debuginfo package would be called package-version-debuginfo.tar.bz2 and
>> it would be selected from libpackage if that had package as a foreign
>> source.  I hope this description makes sense...
>
> Maybe the .debuginfo files should be in a "Debug" category.

They already are:

http://cygwin.com/ml/cygwin-apps/2012-06/msg00071.html
http://cygwin-ports.git.sourceforge.net/git/gitweb.cgi?p=cygwin-ports/cygport;a=blob;f=lib/pkg_pkg.cygpart;h=e745df4;hb=HEAD#l501

Yaakov


Gmane