domesticcatsoftware / DCIntrospect

Small library of visual debugging tools for iOS.
domesticcat.com.au/projects/introspect
MIT License
2.18k stars 267 forks source link

error: unknown register name 'eax' in asm #72

Open mpurland opened 10 years ago

mpurland commented 10 years ago

DCIntrospect.m Line 624: Expanded from macro 'DEBUGGER' from the following:

    else if ([string isEqualToString:kDCIntrospectKeysEnterGDB])
    {
        UIView *view = self.currentView;
        view.tag = view.tag;    // suppress the xcode warning about an unused variable.
        NSLog(@"DCIntrospect: access current view using local 'view' variable.");
        DEBUGGER;
        return NO;
    }
mpurland commented 10 years ago

This seems to fix it:

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);

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

mkoshtenko commented 10 years ago

Is this only iOS 7.1 SDK issue?

AndersDJohnson commented 9 years ago

@mpurland I've created PR #78 with your fix.