News for hackers. Stuff that matters.
Re:Two handy GDB breakpoint tricks by JoshTriplett on Monday January 29, 2024 @07:02AM (#39175325)
(deleted)
Re:Two handy GDB breakpoint tricks by Lyrex on Monday January 29, 2024 @07:29AM (#39175482)
Are you sure? The article makes the point that the nop is actually required for this to work in GDB because the instruction pointer might otherwise point at an entirely different scope.

I have to admit I didn't try it out though. Maybe this changed in the meantime and it is not needed anymore.

Re:Two handy GDB breakpoint tricks by tom_ on Monday January 29, 2024 @05:49PM (#39183867)
See also this comment in the Unreal Engine code about putting a nop in before as well: https://github.com/EpicGames/UnrealEngine/blob/26677ca1b3c97...

    // Q: Why is there a __nop() before __debugbreak()?
    // A: VS' debug engine has a bug where it will silently swallow explicit
    // breakpoint interrupts when single-step debugging either line-by-line or
    // over call instructions. This can hide legitimate reasons to trap. Asserts
    // for example, which can appear as if the did not fire, leaving a programmer
    // unknowingly debugging an undefined process.
(This comment has been there for at least a couple of years, and I don't know if it still applies to the newest version of Visual Studio.)