Hacker News new | ask | show | jobs
by deepanjanroy 3482 days 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.
1 comments

Yeah, 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/ms6...

[1] https://stackoverflow.com/questions/173618/is-there-a-portab...