johnno1962 / injectionforxcode

Runtime Code Injection for Objective-C & Swift
MIT License
6.55k stars 565 forks source link

Injection app not responding #229

Open JonLz opened 6 years ago

JonLz commented 6 years ago

Thanks for the great tool, looking forward to trying it out!

I am trying to get the Injection app (downloaded from http://johnholdsworth.com/Injection9.app.zip) running with Xcode Version 9.0 (9A235). When trying to inject source, the Injection app stops responding.

Steps to repro:

Is there some setup step that I am missing? Any tips on how to troubleshoot this? Is there a console log outside of Xcode I can view somewhere? I also tried it with adding an injection function into my code but I don't think this is the issue as the app doesn't seem to be responding at all.

Thank you!

johnno1962 commented 6 years ago

Have you firce-quit and restarted it? This can happen sometimes.

JonLz commented 6 years ago

Restarted the app and the OS a few times and it seems to be working now. Now I'm seeing a new problem. Let me know if you would like this as a new issue.

Following the same steps as the initial comment, I'm seeing the below crash when trying to click on Inject Source

Xcode console logs

> Injection: Injection attempting connection to: 127.0.0.1:31452
> Injection: Connected to "Injection" plugin, ready to load x86_64 code.
2017-10-24 10:47:57.806 smiletest[3861:93099] Injection: Read error 0 != 8
2017-10-24 10:47:57.806 smiletest[3861:93099] Lost connection, No such process
> Injection: Injection attempting connection to: 127.0.0.1:31452
> Injection: Injection could not connect: Connection refused
> Injection: Injection attempting connection to: 127.0.0.1:31452
> Injection: Injection could not connect: Connection refused
> Injection: Giving up on connecting to Injection, restart app.

Crash report:

Crashed Thread:        0  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_BAD_INSTRUCTION (SIGILL)
Exception Codes:       0x0000000000000001, 0x0000000000000000
Exception Note:        EXC_CORPSE_NOTIFY

Termination Signal:    Illegal instruction: 4
Termination Reason:    Namespace SIGNAL, Code 0x4
Terminating Process:   exc handler [0]

Application Specific Information:
Performing @selector(injectSourceWithSender:) from sender NSMenuItem 0x6000000ad6e0
fatal error: subscript: subrange extends past String end

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   libswiftCore.dylib              0x000000010627fde0 _T0s18_fatalErrorMessages5NeverOs12StaticStringV_A2E4fileSu4lines6UInt32V5flagstFTfq4nnddn_n + 96
1   libswiftCore.dylib              0x0000000106282b3a _T0s11_StringCoreV9subscriptABs5RangeVySiGcfgTfq4xx_n + 330
2   libswiftCore.dylib              0x000000010634f8da _T0s19_NSContiguousStringC18substringWithRangeABSC13_SwiftNSRangeVFTfq4xn_n + 74
3   libswiftCore.dylib              0x00000001062162a7 _T0s19_NSContiguousStringC18substringWithRangeABSC13_SwiftNSRangeVFTo + 39
4   com.johnholdsworth.Injectorator 0x0000000105f15271 0x105f0a000 + 45681
5   com.johnholdsworth.Injectorator 0x0000000105f82bd0 0x105f0a000 + 494544
6   com.johnholdsworth.Injectorator 0x0000000105f0d44d 0x105f0a000 + 13389
7   libdispatch.dylib               0x00007fff8aefd8fc _dispatch_client_callout + 8
8   libdispatch.dylib               0x00007fff8af09ffb _dispatch_barrier_sync_f_slow_invoke + 295
9   libdispatch.dylib               0x00007fff8aefd8fc _dispatch_client_callout + 8
10  libdispatch.dylib               0x00007fff8af0aaac _dispatch_main_queue_callback_4CF + 925
11  com.apple.CoreFoundation        0x00007fff757eabc9 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
12  com.apple.CoreFoundation        0x00007fff757abc0d __CFRunLoopRun + 2205
13  com.apple.CoreFoundation        0x00007fff757ab114 CFRunLoopRunSpecific + 420
14  com.apple.Foundation            0x00007fff771be252 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 277
15  com.apple.Foundation            0x00007fff7724e9b5 -[NSRunLoop(NSRunLoop) runUntilDate:] + 111
16  com.johnholdsworth.Injectorator 0x0000000105f7bcc1 0x105f0a000 + 466113
17  com.johnholdsworth.Injectorator 0x0000000105f799b4 0x105f0a000 + 457140
18  libsystem_trace.dylib           0x00007fff8b1653a7 _os_activity_initiate_impl + 53
19  com.apple.AppKit                0x00007fff73a22721 -[NSApplication(NSResponder) sendAction:to:from:] + 456
20  com.apple.AppKit                0x00007fff734f5666 -[NSMenuItem _corePerformAction] + 324
21  com.apple.AppKit                0x00007fff734f53d2 -[NSCarbonMenuImpl performActionWithHighlightingForItemAtIndex:] + 114
22  libsystem_trace.dylib           0x00007fff8b1653a7 _os_activity_initiate_impl + 53
23  com.apple.AppKit                0x00007fff7357e955 -[NSMenu performActionForItemAtIndex:] + 121
24  com.apple.AppKit                0x00007fff7357e8cc -[NSMenu _internalPerformActionForItemAtIndex:] + 94
25  com.apple.AppKit                0x00007fff7357e6f9 -[NSCarbonMenuImpl _carbonCommandProcessEvent:handlerCallRef:] + 107
26  com.apple.AppKit                0x00007fff73435580 NSSLMMenuEventHandler + 986
27  com.apple.HIToolbox             0x00007fff74ce3d85 DispatchEventToHandlers(EventTargetRec*, OpaqueEventRef*, HandlerCallRec*) + 1708
28  com.apple.HIToolbox             0x00007fff74ce2ff6 SendEventToEventTargetInternal(OpaqueEventRef*, OpaqueEventTargetRef*, HandlerCallRec*) + 428
29  com.apple.HIToolbox             0x00007fff74cf8d14 SendEventToEventTarget + 40
30  com.apple.HIToolbox             0x00007fff74d453e6 SendHICommandEvent(unsigned int, HICommand const*, unsigned int, unsigned int, unsigned char, void const*, OpaqueEventTargetRef*, OpaqueEventTargetRef*, OpaqueEventRef**) + 411
31  com.apple.HIToolbox             0x00007fff74d709fb SendMenuCommandWithContextAndModifiers + 59
32  com.apple.HIToolbox             0x00007fff74d709aa SendMenuItemSelectedEvent + 188
33  com.apple.HIToolbox             0x00007fff74d7087d FinishMenuSelection(SelectionData*, MenuResult*, MenuResult*) + 96
34  com.apple.HIToolbox             0x00007fff74d4fb6b PopUpMenuSelectCore(MenuData*, Point, double, Point, unsigned short, unsigned int, Rect const*, unsigned short, unsigned int, Rect const*, Rect const*, __CFDictionary const*, __CFString const*, OpaqueMenuRef**, unsigned short*) + 2007
35  com.apple.HIToolbox             0x00007fff74d4ebd3 _HandlePopUpMenuSelection8(OpaqueMenuRef*, OpaqueEventRef*, unsigned int, Point, unsigned short, unsigned int, Rect const*, unsigned short, Rect const*, Rect const*, __CFDictionary const*, __CFString const*, OpaqueMenuRef**, unsigned short*) + 612
36  com.apple.HIToolbox             0x00007fff74d4e7ab _HandlePopUpMenuSelectionWithDictionary + 287
37  com.apple.AppKit                0x00007fff735755a7 _NSSLMPopUpCarbonMenu3 + 6218
38  com.apple.AppKit                0x00007fff73573ca3 -[NSCarbonMenuImpl popUpMenu:atLocation:width:forView:withSelectedItem:withFont:withFlags:withOptions:] + 456
39  com.apple.AppKit                0x00007fff73a1087c +[NSStatusBarButtonCell popupStatusBarMenu:inRect:ofView:withEvent:] + 1069
40  com.apple.AppKit                0x00007fff73a0f977 -[NSStatusBarButtonCell trackMouse:inRect:ofView:untilMouseUp:] + 159
41  com.apple.AppKit                0x00007fff73503ddb -[NSControl mouseDown:] + 832
42  com.apple.AppKit                0x00007fff73b9e24f -[NSWindow(NSEventRouting) _handleMouseDownEvent:isDelayedEvent:] + 6341
43  com.apple.AppKit                0x00007fff73b9aa6c -[NSWindow(NSEventRouting) _reallySendEvent:isDelayedEvent:] + 1942
44  com.apple.AppKit                0x00007fff73b99f0a -[NSWindow(NSEventRouting) sendEvent:] + 541
45  com.apple.AppKit                0x00007fff73a136d1 -[NSStatusBarWindow sendEvent:] + 581
46  com.apple.AppKit                0x00007fff73a1e681 -[NSApplication(NSEvent) sendEvent:] + 1145
47  com.apple.AppKit                0x00007fff73299427 -[NSApplication run] + 1002
48  com.apple.AppKit                0x00007fff73263e0e NSApplicationMain + 1237
49  com.johnholdsworth.Injectorator 0x0000000105f75b99 0x105f0a000 + 441241
50  libdyld.dylib                   0x00007fff8af33235 start + 1
johnno1962 commented 6 years ago

The first problem is caused by the second which is the InjectionApp crashing. I can TeamView if you want to try to work out whats going on. Send your ID to injection at johnholdsworth.com if interested.