Should Druntime and Phobos be built with -gs ?

Vladimir Panteleev vladimir at thecybershadow.net
Mon Dec 3 23:47:43 PST 2012


I've recently updated my watchdog wrapper script which starts D 
services to use gdb and disable rt_trapExceptions. My intention 
was to bypass D's standard exception handler and let gdb handle 
uncaught exceptions, and perhaps print better stack traces 
including function arguments and line numbers. However, this was 
the result:

Program received signal SIGSEGV, Segmentation fault.
0x0000000000531f7c in rt.deh2.terminate() ()
#0  0x0000000000531f7c in rt.deh2.terminate() ()
No symbol table info available.
#1  0x00000000004ffebf in _d_throwc ()
No symbol table info available.
#2  0x0000000000000002 in ?? ()
No symbol table info available.
#3  0x0000000000000002 in ?? ()
No symbol table info available.
#4  0x000000000078e030 in ?? ()
No symbol table info available.
#5  0x000000000000001d in ?? ()
No symbol table info available.
#6  0x0000000000000002 in ?? ()
No symbol table info available.
#7  0x0000000000000000 in ?? ()
No symbol table info available.

I assume that the stack frames under _d_throwc are not accessible 
because _d_throwc does not create a stack frame, as Druntime is 
built with -release but not -gs. (To clarify, stack frames are 
disabled by -release unless -gs is specified, in which case 
they're always emitted.)

Should the Phobos and Druntime makefiles be changed to include 
-gs in the release DFLAGS? I haven't noticed any difference in 
performance from timing the Druntime unittests. In theory, 
enabling it should provide a better out-of-the-box debugging 
experience at a negligible performance/filesize cost.


More information about the Digitalmars-d mailing list