Skip to content

Commit

Permalink
Merge pull request ethereum#1231 from ethereum/debugbreak
Browse files Browse the repository at this point in the history
Properly define trap_instruction
  • Loading branch information
chriseth authored Oct 15, 2016
2 parents e0bf199 + bc537c7 commit cc2a686
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions libdevcore/debugbreak.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,13 @@ static void __inline__ trap_instruction(void)
/* Has same known problem and workaround
* as Thumb mode */
}
#elif defined(ETH_EMSCRIPTEN)
enum { HAVE_TRAP_INSTRUCTION = 1, };
__attribute__((gnu_inline, always_inline))
static void __inline__ trap_instruction(void)
{
asm("debugger");
}
#else
enum { HAVE_TRAP_INSTRUCTION = 0, };
#endif
Expand All @@ -101,11 +108,7 @@ __attribute__((gnu_inline, always_inline))
static void __inline__ debug_break(void)
{
if (HAVE_TRAP_INSTRUCTION) {
#if defined(ETH_EMSCRIPTEN)
asm("debugger");
#else
trap_instruction();
#endif
} else if (DEBUG_BREAK_PREFER_BUILTIN_TRAP_TO_SIGTRAP) {
/* raises SIGILL on Linux x86{,-64}, to continue in gdb:
* (gdb) handle SIGILL stop nopass
Expand Down

0 comments on commit cc2a686

Please sign in to comment.