Skip to content

Commit

Permalink
Internals: Implement a continuable IM_DEBUG_BREAK on GCC for common a…
Browse files Browse the repository at this point in the history
…rchs. (ocornut#2673)
  • Loading branch information
rokups authored and actondev committed Nov 26, 2021
1 parent 84829d6 commit 403cba2
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions imgui_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -253,12 +253,19 @@ namespace ImStb
#endif

// Debug Tools
// Use 'Metrics->Tools->Item Picker' to break into the call-stack of a specific item.
// Use 'Metrics/Debugger->Tools->Item Picker' to break into the call-stack of a specific item.
// This will call IM_DEBUG_BREAK() which you may redefine yourself. See https://github.com/scottt/debugbreak for more reference.
#ifndef IM_DEBUG_BREAK
#if defined(__clang__)
#define IM_DEBUG_BREAK() __builtin_debugtrap()
#elif defined (_MSC_VER)
#if defined (_MSC_VER)
#define IM_DEBUG_BREAK() __debugbreak()
#elif defined(__clang__)
#define IM_DEBUG_BREAK() __builtin_debugtrap()
#elif defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
#define IM_DEBUG_BREAK() __asm__ volatile("int $0x03")
#elif defined(__GNUC__) && defined(__thumb__)
#define IM_DEBUG_BREAK() __asm__ volatile(".inst 0xde01")
#elif defined(__GNUC__) defined(__arm__) && !defined(__thumb__)
#define IM_DEBUG_BREAK() __asm__ volatile(".inst 0xe7f001f0");
#else
#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!
#endif
Expand Down

0 comments on commit 403cba2

Please sign in to comment.