Skip to content

Commit

Permalink
Only enable debugger on X86 and X64, when not ARM. Fixes #72.
Browse files Browse the repository at this point in the history
  • Loading branch information
Anders D. Johnson committed Jun 17, 2015
1 parent 9555122 commit 2a4954c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion DCIntrospect/DCIntrospect.m
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,11 @@ static bool AmIBeingDebugged(void)
#if TARGET_CPU_ARM
#define DEBUGSTOP(signal) __asm__ __volatile__ ("mov r0, %0\nmov r1, %1\nmov r12, %2\nswi 128\n" : : "r"(getpid ()), "r"(signal), "r"(37) : "r12", "r0", "r1", "cc");
#define DEBUGGER do { int trapSignal = AmIBeingDebugged () ? SIGINT : SIGSTOP; DEBUGSTOP(trapSignal); if (trapSignal == SIGSTOP) { DEBUGSTOP (SIGINT); } } while (false);
#else
#elif TARGET_CPU_X86 || TARGET_CPU_X86_64
#define DEBUGGER do { int trapSignal = AmIBeingDebugged () ? SIGINT : SIGSTOP; __asm__ __volatile__ ("pushl %0\npushl %1\npush $0\nmovl %2, %%eax\nint $0x80\nadd $12, %%esp" : : "g" (trapSignal), "g" (getpid ()), "n" (37) : "eax", "cc"); } while (false);
#else
#define DEBUGGER
#warning "Debugger disabled."
#endif

@interface DCIntrospect ()
Expand Down

0 comments on commit 2a4954c

Please sign in to comment.