Opened 12 years ago

Closed 11 years ago

Last modified 7 years ago

#34831 closed defect (fixed)

eliminate missing symbols from gdb compatible compilers

Reported by: seanfarley (Sean Farley) Owned by: jeremyhu (Jeremy Huddleston Sequoia)
Priority: Normal Milestone:
Component: ports Version: 2.1.1
Keywords: Cc: mww@…, erickt@…, tenomoto (Takeshi Enomoto), nonstop.server@…, su-v, darylew@…, cooljeanius (Eric Gallager)
Port: apple-gcc40 apple-gcc42 gcc42 gcc43 gcc44 gcc45 gcc46 gcc47 gcc48 clang-2.9 clang-3.0 clang-3.1 clang-3.2 dragonegg-3.0 dragonegg-3.1 dragonegg-3.2 llvm-2.9 llvm-3.0 llvm-3.1 llvm-3.2 llvm-gcc42 g95

Description

The hundreds of lines of output of missing object files causes much grief and, in some cases, will prevent debugging entirely.

The goal of this patch is to completely get rid of all warnings and errors due to missing symbols. The importance of this is high since all compilers are effected and this in turn affects *any* user compiled code.

For compilers that are gdb compatible (c, c++, and fortran), the portfile needs to keep the debug symbols. This patch fixes dsymutil being called for apple-gcc4{0,2}, gcc4{2,3,4,5,6,7,8}, {clang,llvm}-{2.9,3.0,3.1}, llvm-gcc42, g95, and dragonegg-3.{0,1,2}. Alternatively, as suggested by Jeremy, each portfile could strip the symbols from the compiler's shared libraries. This could work but I don't know how to implement this method off the top of my head.

Attached to this ticket is:

1) patch that calls dsymutil for each port

2) a simple test program

3) the gdb output of (2)

Attachments (4)

dsymutil.patch (21.8 KB) - added by seanfarley (Sean Farley) 12 years ago.
call dsymutil for each gcc-derived port
test.c (122 bytes) - added by seanfarley (Sean Farley) 12 years ago.
simple test code
test.c.gdb (29.2 KB) - added by seanfarley (Sean Farley) 12 years ago.
gdb output of test.c
strip.patch (10.3 KB) - added by seanfarley (Sean Farley) 12 years ago.
strip debug symbols from compilers

Download all attachments as: .zip

Change History (24)

Changed 12 years ago by seanfarley (Sean Farley)

Attachment: dsymutil.patch added

call dsymutil for each gcc-derived port

Changed 12 years ago by seanfarley (Sean Farley)

Attachment: test.c added

simple test code

Changed 12 years ago by seanfarley (Sean Farley)

Attachment: test.c.gdb added

gdb output of test.c

comment:1 Changed 12 years ago by nonstop.server@…

Cc: nonstop.server@… added

Cc Me!

comment:2 Changed 12 years ago by su-v

Cc: suv-sf@… added

Cc Me!

comment:3 Changed 12 years ago by darylew@…

Cc: darylew@… added

Cc Me!

comment:4 Changed 12 years ago by mf2k (Frank Schima)

Owner: changed from macports-tickets@… to jeremyhu@…
Port: apple-gcc40,apple-gcc42,gcc42,gcc43,gcc44,gcc45,gcc46,gcc47,gcc48,clang-2.9,clang-3.0,clang-3.1,clang-3.2,dragonegg-3.0,dragonegg-3.1,dragonegg-3.2,llvm-2.9,llvm-3.0,llvm-3.1,llvm-3.2,llvm-gcc42,g95apple-gcc40 apple-gcc42 gcc42 gcc43 gcc44 gcc45 gcc46 gcc47 gcc48 clang-2.9 clang-3.0 clang-3.1 clang-3.2 dragonegg-3.0 dragonegg-3.1 dragonegg-3.2 llvm-2.9 llvm-3.0 llvm-3.1 llvm-3.2 llvm-gcc42 g95

comment:5 Changed 12 years ago by jeremyhu (Jeremy Huddleston Sequoia)

No, using dsymutil is not the answer. E

See #34491:

If you want to debug gcc47's runtime bits, then use '-k' to keep those object files around. If you are just concerned about the messages printed by gdb, then perhaps we should just strip those object files.

comment:6 in reply to:  5 Changed 12 years ago by seanfarley (Sean Farley)

Replying to jeremyhu@…:

See #34491:

If you are just concerned about the messages printed by gdb, then perhaps we should just strip those object files.

Right, but how does one safely do that?

comment:7 Changed 12 years ago by jeremyhu (Jeremy Huddleston Sequoia)

See the man page for strip, or use -s if you use install.

Changed 12 years ago by seanfarley (Sean Farley)

Attachment: strip.patch added

strip debug symbols from compilers

comment:8 Changed 12 years ago by seanfarley (Sean Farley)

This turned out to be easier than I thought it would be. The hardest part was compiling *every* compiler to test. I tested each C and Fortran compiler and all versions worked. There were no warning messages and no hanging when attaching a debugger. Let me know if this version of the patch (strip.patch) works for MacPorts.

comment:9 Changed 12 years ago by jeremyhu (Jeremy Huddleston Sequoia)

I am going to be gone for 2 weeks, but this looks good to me if someone else wants to commit the strip.patch

comment:10 in reply to:  9 Changed 12 years ago by seanfarley (Sean Farley)

Replying to jeremyhu@…:

I am going to be gone for 2 weeks, but this looks good to me if someone else wants to commit the strip.patch

Any update for getting strip.patch committed?

comment:11 Changed 12 years ago by jeremyhu (Jeremy Huddleston Sequoia)

Yeah, I was on vacation for a month and came back to an inbox 1-month long. You will need to be patient, sorry. I'll get to these issues based on priority, or someone else can certainly commit it if they are willing to test.

comment:12 Changed 12 years ago by seanfarley (Sean Farley)

Gotcha. No worries, I was just checking in :-)

comment:13 Changed 12 years ago by jmroot (Joshua Root)

Cc: mww@… erickt@… mfeiri@… takeshi@… added

comment:14 Changed 11 years ago by mfeiri

Cc: mfeiri@… removed

comment:15 Changed 11 years ago by tenomoto (Takeshi Enomoto)

Committed the patch for g95 in r101293.

comment:16 in reply to:  15 Changed 11 years ago by seanfarley (Sean Farley)

Replying to takeshi@…:

Committed the patch for g95 in r101293.

Thanks! Jeremy, would you have any objection to me rebasing and applying this patches myself?

comment:17 Changed 11 years ago by cooljeanius (Eric Gallager)

Cc: egall@… added

Cc Me!

comment:18 Changed 11 years ago by jeremyhu (Jeremy Huddleston Sequoia)

I should roll this into the libgcc changes.

comment:19 Changed 11 years ago by jeremyhu (Jeremy Huddleston Sequoia)

Resolution: fixed
Status: newclosed

r109291 should take care of this.

comment:20 Changed 7 years ago by RJVB (René Bertin)

Am I right that this modification and the stripping of port:libgcc's libraries is relevant only for OS versions where gdb is the default debugger?

EDIT: yes, it is. A quick check with unstripped libgcc libraries (but without their .o files) shows that lldb doesn't mind.

gdb on the other hand still minds, but it also complains about missing object files from all other shared libraries being pulled in. But in my experience it isn't usable on OS X 10.9 (and later, undoubtedly). I'd propose to drop the stripping for ${os.major} >= 13 as that information could have its use. I'll include that in my proposed modifications to port:libgcc (and port:gcc7).

Last edited 7 years ago by RJVB (René Bertin) (previous) (diff)
Note: See TracTickets for help on using tickets.