Skip to content

Commit 403cba2

Browse files
rokupsactondev
authored andcommitted
Internals: Implement a continuable IM_DEBUG_BREAK on GCC for common archs. (ocornut#2673)
1 parent 84829d6 commit 403cba2

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

imgui_internal.h

+11-4
Original file line numberDiff line numberDiff line change
@@ -253,12 +253,19 @@ namespace ImStb
253253
#endif
254254

255255
// Debug Tools
256-
// Use 'Metrics->Tools->Item Picker' to break into the call-stack of a specific item.
256+
// Use 'Metrics/Debugger->Tools->Item Picker' to break into the call-stack of a specific item.
257+
// This will call IM_DEBUG_BREAK() which you may redefine yourself. See https://github.com/scottt/debugbreak for more reference.
257258
#ifndef IM_DEBUG_BREAK
258-
#if defined(__clang__)
259-
#define IM_DEBUG_BREAK() __builtin_debugtrap()
260-
#elif defined (_MSC_VER)
259+
#if defined (_MSC_VER)
261260
#define IM_DEBUG_BREAK() __debugbreak()
261+
#elif defined(__clang__)
262+
#define IM_DEBUG_BREAK() __builtin_debugtrap()
263+
#elif defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
264+
#define IM_DEBUG_BREAK() __asm__ volatile("int $0x03")
265+
#elif defined(__GNUC__) && defined(__thumb__)
266+
#define IM_DEBUG_BREAK() __asm__ volatile(".inst 0xde01")
267+
#elif defined(__GNUC__) defined(__arm__) && !defined(__thumb__)
268+
#define IM_DEBUG_BREAK() __asm__ volatile(".inst 0xe7f001f0");
262269
#else
263270
#define IM_DEBUG_BREAK() IM_ASSERT(0) // It is expected that you define IM_DEBUG_BREAK() into something that will break nicely in a debugger!
264271
#endif

0 commit comments

Comments
 (0)