johnno1962 / injectionforxcode

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

Crash when trying to inject #11

Open seboslaw opened 11 years ago

seboslaw commented 11 years ago

Hey,

when trying to inject code while running (in XCode 5.0.1) I'm getting an EXC_BAD_ACESS exception within dyldbootstrap::start(..):

Bundle "InjectionBundle2.bundle" loaded successfully.
dyld: lazy symbol binding failed: Symbol not found: _llvm_gcov_init
  Referenced from: /Users/svogelsang/Development/work/testproj/iOS/iOSInjectionProject/build/Debug-iphonesimulator/InjectionBundle2.bundle/InjectionBundle
  Expected in: flat namespace

dyld: Symbol not found: _llvm_gcov_init
  Referenced from: /Users/svogelsang/Development/work/testproj/iOS/iOSInjectionProject/build/Debug-iphonesimulator/InjectionBundle2.bundle/InjectionBundle
  Expected in: flat namespace

The console shows:

Using learnt compilation.


real  0m0.000s

user 0m0.000s

sys  0m0.000s



Building iOSInjectionProject/InjectionBundle.xcodeproj

bash ../iOSInjectionProject/i386/compile_commands.sh # xcodebuild  -configuration 
Debug -arch i386 -sdk iphonesimulator




real   0m0.041s

user    0m0.028s

sys 0m0.012s


real  0m0.211s

user    0m0.043s

sys 0m0.173s



/usr/bin/touch -c „/Users/svogelsang/Development/work/testproj/iOS/iOSInjectionProject/build/Debug-iphonesimulator/InjectionBundle.bundle“



** COMPILE SUCCEEDED **



Renaming bundle so it reloads..

Loading Bundle…

Disconnected from: /Users/svogelsang/Library/Application Support/iPhone Simulator/7.0.3/Applications/D209C980-CF88-4BBE-BAE4-83303C809990/testproj.app/testproj
Connection from: /Users/svogelsang/Library/Application Support/iPhone Simulator/7.0.3/Applications/D209C980-CF88-4BBE-BAE4-83303C809990/testproj.app/testproj i386 (34)

Using learnt compilation.



real  0m0.000s

user    0m0.000s

sys 0m0.000s



Building iOSInjectionProject/InjectionBundle.xcodeproj

bash ../iOSInjectionProject/i386/compile_commands.sh # xcodebuild  -configuration 
Debug -arch i386 -sdk iphonesimulator




real   0m0.040s

user    0m0.027s

sys 0m0.012s


real  0m0.218s

user    0m0.046s

sys 0m0.178s



/usr/bin/touch -c „/Users/svogelsang/Development/work/testproj/iOS/iOSInjectionProject/build/Debug-iphonesimulator/InjectionBundle.bundle“



** COMPILE SUCCEEDED **



Renaming bundle so it reloads..

Loading Bundle…

johnno1962 commented 11 years ago

Err.. never come across that before. Do you have a small test project that demonstrates the problem you can send through? Email is in the plugin menu.

seboslaw commented 11 years ago

phew....problem is that this is a rather large and complex project. I guess that is also the problem here. I'll try to setup a test project and add all my dependencies one by one and then send you the thing once it starts crashing again.

johnno1962 commented 11 years ago

sorry, otherwise I don’t have a lot to go on.. It seems to be something to do with testing: http://stackoverflow.com/questions/566472/where-are-the-gcov-symbols, try editing the bundle project and adding some of the flags they mention. Let me know how you get on.

johnno1962 commented 10 years ago

Hi, I’m closing this now unless you’ve found what the problem is.

kunalbalani commented 10 years ago

I have this same problem.

MaciejGad commented 9 years ago

I think that problem is caused by CLang Code Coverage. As mention in http://stackoverflow.com/questions/19290946/clang-code-coverage-mac-os-x-linker-error the best answer is to add following Linker Flags in InjectionBundle.xcodeproj:

-Wall -fprofile-arcs -ftest-coverage
johnno1962 commented 9 years ago

Thanks Maciej. Sebastian. is there any chance you can verify this works and I’ll push it onto github.

seboslaw commented 9 years ago

@johnno1962 I'm sorry. I cannot even reproduce my old issue with Xcode 6.1.1. Everything works fine now.

johnno1962 commented 9 years ago

Thanks for letting me know. I’ll leave things as they are for now and leave this open for reference.

fschaper commented 9 years ago

Had the same problem. @MaciejGad suggestion worked for me as well. -Wall -fprofile-arcs -ftest-coverage

luoqisheng commented 8 years ago

Had the same problem,-Wall -fprofile-arcs -ftest-coverage worked for me. but after the bundle was loaded,all my viewcontrollers was gone.