Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 393834

Summary: Don't strip debug symbols from SWT
Product: [Eclipse Project] Platform Reporter: Krzysztof Daniel <krzysztof.daniel>
Component: SWTAssignee: Matthias Mailänder <matthias.mailaender>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: akurtakov, arunkumar.thondapu, betelgeuse, ericwill, info, krzysztof.daniel, matthias.mailaender, Silenio_Quarti, sravankumarl
Version: 4.2Keywords: triaged
Target Milestone: 4.9 M2   
Hardware: PC   
OS: Linux   
See Also: https://git.eclipse.org/r/124309
https://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=1df1be7c4bb508960a7308b328f53bdbc9cb769f
Whiteboard:
Attachments:
Description Flags
Don't strip by default and don't ignore system CFLAGS/LFLAGS none

Description Krzysztof Daniel CLA 2012-11-08 03:53:44 EST
Lack of debug symbols makes it difficult to debug crashes on Linux. Please add 
-g to CFLAGS 

--- make_linux.mak~  2012-11-01 13:51:27.511025877 +0000
+++ make_linux.mak   2012-11-01 15:26:13.182270072 +0000
@@ -106,7 +106,7 @@
 WEBKIT_OBJECTS = swt.o webkit.o webkit_structs.o webkit_stats.o
 GLX_OBJECTS = swt.o glx.o glx_structs.o glx_stats.o

 -CFLAGS = -O -Wall \
 +CFLAGS = -g --O Wall \
              -DSWT_VERSION=$(SWT_VERSION) \
              $(NATIVE_STATS) \
              -DLINUX -DGTK \


Other issue is that debug symbols are removed by using the -s flag in the same file 
>> -ifndef NO_STRIP
>> -    AWT_LFLAGS := $(AWT_LFLAGS) -s
>> -    MOZILLALFLAGS := $(MOZILLALFLAGS) -s
>> -    LFLAGS := $(LFLAGS) -s
>> -endif

It would be good to get rid off the whole NO_STRIP section or make it disabled (declare the NO_STRIP) by default.
Comment 1 Krzysztof Daniel CLA 2012-11-27 06:33:11 EST
*** Bug 389862 has been marked as a duplicate of this bug. ***
Comment 2 Krzysztof Daniel CLA 2012-12-18 04:07:32 EST
Any chance for this one?
Comment 3 Krzysztof Daniel CLA 2013-01-28 07:53:22 EST
hey guys,

any chance to get this into kepler?
Comment 4 Silenio Quarti CLA 2013-01-29 14:04:56 EST
The -s option was added to reduce the size of the binaries.  Adding the -g option will increase the size significantly as well. See below.  I do not think we should do this for production builds.  System libraries like gtk+ do not have symbols  either.  

We could add a debug env var (i.e. SWT_DEBUG) to enable debug (like NO_STRIP), but it would be off by default.

How useful would having symbols on the swt libraries given that they just wrap the OS APIs? Do you have a example of a stack with and without symbols?

Size without -g and with -s options (as is today):

-rw-rw-r-- 1 test test 473504 Jan 29 13:49 libswt-pi-gtk-4319.so

Size without -g and without -s options:

-rw-rw-r-- 1 test test 689680 Jan 29 13:50 libswt-pi-gtk-4319.so

Size with -g and without -s options:

-rw-rw-r-- 1 test test 1703776 Jan 29 13:50 libswt-pi-gtk-4319.so
Comment 5 Krzysztof Daniel CLA 2013-01-30 02:40:06 EST
(In reply to comment #4)

> How useful would having symbols on the swt libraries given that they just
> wrap the OS APIs? Do you have a example of a stack with and without symbols?

I get usually one report per week about Eclipse crash on Fedora 18 routed from java team with a message like: the problem is originating from swt/launcher. The problem is the root cause is not entirely Eclipse - it may be gtk or other libraries as well. The debugging infrastructure is needed in the first place. There is nothing worse than the message 'backtrace is unusable' due to the missing debug info.

I'd go even for the optionally enabled SWT_DEBUG given that I could enable it via environment variable (as a part of maven CBI build).
Comment 6 Matthias Mailänder CLA 2014-05-16 09:02:04 EDT
I suggest you make CFLAGS configurable with CFLAGS := CFLAGS [...] instead of overwriting them with hard-coded stuff. This way we can get rid of ugly patches like https://build.opensuse.org/package/view_file/Java:packages/eclipse-swt/libswt-optflags.patch?expand=1 that manually have to hack $(RPM_OPT_FLAGS) in. Linux distributions always want libraries to be compiled with debug symbols and strip them manually so they are stored in -debug packages and installed at users will.
Comment 7 Alexander Kurtakov CLA 2014-05-20 06:08:30 EDT
(In reply to Matthias Mailänder from comment #6)
> I suggest you make CFLAGS configurable with CFLAGS := CFLAGS [...] instead
> of overwriting them with hard-coded stuff. This way we can get rid of ugly
> patches like
> https://build.opensuse.org/package/view_file/Java:packages/eclipse-swt/
> libswt-optflags.patch?expand=1 that manually have to hack $(RPM_OPT_FLAGS)
> in. Linux distributions always want libraries to be compiled with debug
> symbols and strip them manually so they are stored in -debug packages and
> installed at users will.

I agree with this Matthias, please provide gerrit patch and once we are open for development again I'll push it.
Comment 8 Matthias Mailänder CLA 2014-11-15 15:18:38 EST
Created attachment 248682 [details]
Don't strip by default and don't ignore system CFLAGS/LFLAGS

Can't send you a merge request via Gerrit because of Bug 451701 at the moment.
Comment 9 Eric Williams CLA 2018-03-28 11:56:38 EDT
(In reply to Matthias Mailaender from comment #8)
> Created attachment 248682 [details]
> Don't strip by default and don't ignore system CFLAGS/LFLAGS
> 
> Can't send you a merge request via Gerrit because of Bug 451701 at the
> moment.

Gerrit is open again, please push the patch there and someone will review it in a reasonable time frame.
Comment 10 Eclipse Genie CLA 2018-06-10 11:35:32 EDT
New Gerrit change created: https://git.eclipse.org/r/124309
Comment 12 Alexander Kurtakov CLA 2018-06-14 07:14:05 EDT
Thanks for the patch Mathias.
Comment 13 Alexander Kurtakov CLA 2018-06-27 14:26:22 EDT
*** Bug 165097 has been marked as a duplicate of this bug. ***