Is there a portable equivalent to DebugBreak()/__debugbreak?

后端 未结 10 1213
野性不改
野性不改 2020-12-01 08:49

In MSVC, DebugBreak() or __debugbreak cause a debugger to break. On x86 it is equivalent to writing \"_asm int 3\", on x64 it is something different. When compiling with gcc

10条回答
  •  北荒
    北荒 (楼主)
    2020-12-01 09:35

    If you are trying to debug a crash-related condition, good old fashioned abort() will give you a call stack on most platforms. Downside is that you can't continue from the current PC, which you probably don't want to do anyway.

    http://www.cplusplus.com/reference/cstdlib/abort/

提交回复
热议问题