3 ms·
I recently learned you can do a similar thing with C/C++ too. Programmatically raise a SIGINT when running under gdb, and gdb will intercept that signal, at whi
by deepanjanroy 10y ago
I recently learned you can do a similar thing with C/C++ too. Programmatically raise a SIGINT when running under gdb, and gdb will intercept that signal, at which point you can step through the code.
- therein 10y agoYeah, in Windows you have the `DebugBreak/__debugbreak()` function [0]. For POSIX you have `raise(SIGTRAP)` or gcc you have `__builtin_trap()` which actually has some caveats. [1] [0] https://msdn.microsoft.com/en-us/library/windows/desktop/ms679297(v=vs.85).aspx https://msdn.microsoft.com/en-us/library/windows/desktop/ms6... [1] https://stackoverflow.com/questions/173618/is-there-a-portable-equivalent-to-debugbreak-debugbreak https://stackoverflow.com/questions/173618/is-there-a-portab...