Add "nop" to IM_DEBUG_BREAK macro to work around GDB bug #7266
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There are two issues here - first, this macro uses AT&T specific syntax with $, which is not necessary. Also, some assemblers (nasm) emit different bytes for "int 3" and "int3" (cd 03 vs cc), so it's better to use "int3" for consistency.
More importantly, GDB (as of 14.1) has some failing assertion whenever stepping after hitting a lone "int3" instruction. This makes it practically useless, as is. For some reason, putting a nop afterwards as a workaround is okay.
Related discussions:
https://sourceware.org/bugzilla/show_bug.cgi?id=31194
https://lists.sr.ht/~skeeto/public-inbox/%3C2d3d7662a361ddd049f7dc65b94cecdd%40disroot.org%3E
Also, clang's __builtin_debugtrap() runs into this same issue with GDB. I feel uncomfortable commenting the
__builtin_debugtrap()
line out, but if it's desired, I'll do so.Of course, there's also the possibility this change is entirely undesired and can be fixed on my end by defining this macro "properly" on my own.