digitalmars.D.learn - DMD flag -gs and -gx
- =?UTF-8?B?Tm9yZGzDtnc=?= (5/5) May 13 2016 What role does the DMD flags -gs and -gx play?
- Rene Zwanenburg (12/14) May 13 2016 IIRC, not emitting a stack frame is an optimization which
What role does the DMD flags -gs and -gx play? The documentation says -gs always emit stack frame -gx add stack stomp code which I don't know what it means.
May 13 2016
On Friday, 13 May 2016 at 10:19:04 UTC, Nordlöw wrote:-gs always emit stack frameIIRC, not emitting a stack frame is an optimization which confuses debuggers. So I think this can be used to make optimized builds a bit easier to debug.-gx add stack stomp codeAfter a function returns the stack normally still contains the local variables of that function, but they can be overwritten at any time (which is why it's unsafe to escape references to stack variables from a function). Using this switch will cause the compiler to overwrite the stack with bogus values before returning, which will help with early detection of bugs like the above. It can also be useful in security contexts where a function operates on sensitive data.
May 13 2016