Regarding stripping and -g

bearophile bearophileHUGS at lycos.com
Wed Jun 19 02:54:23 PDT 2013


David Nadlinger:

> If you build with -g, the debug version of druntime/Phobos is 
> linked instead.

I see.


>> Is it a good idea to make ldmd2 also strip the exe binary if 
>> the -g switch is not used?
>
> Probably not, as that typically also makes backtraces rather 
> unusable.

On Windows32 with dmd the backtraces are unusable if you don't 
compile with -g.

This is a little program:

void main() {
     throw new Exception(null);
}


If you compile it with dmd -g you get at run-time:

object.Exception at test.d(2)
----------------
0x00402044 in _Dmain at ...\test.d(2)
0x0040292C in extern (C) int rt.dmain2._d_run_main(int, char**, 
extern (C) int function(char[][])*).void runMain()
0x004029BC in extern (C) int rt.dmain2._d_run_main(int, char**, 
extern (C) int function(char[][])*).void runAll()
...


If you don't use -g:

object.Exception at test.d(2)
----------------
0x0040203D
0x00402914
0x00402231
0x00402054
...


Bye,
bearophile


More information about the digitalmars-d-ldc mailing list