May 13, 2016 DMD flag -gs and -gx | ||||
---|---|---|---|---|
| ||||
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 Re: DMD flag -gs and -gx | ||||
---|---|---|---|---|
| ||||
Posted in reply to Nordlöw | On Friday, 13 May 2016 at 10:19:04 UTC, Nordlöw wrote: > -gs always emit stack frame IIRC, 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 code After 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. |
Copyright © 1999-2021 by the D Language Foundation