safari plugin crashing on NP_Initialize when built on xulrunner sdk - macos

I am trying to build NPAPI plugin for safari and have been trying to run the simple NPAPI plugin example from https://github.com/mikma/npsimple on Safari on Mac.
The plugin can use npapi library from WEBKIT_DARWIN_SDK or from XULRUNNER_SDK (downloaded from mozilla.org for mac os).
The plugin works as expected by using WEBKIT_DARWIN_SDK but since it conflicts with my other libraries I can't use it. Now the only way left is to use XULRUNNER_SDK but using that results in a crash on NP_Initialize. Since this is the most basic application using NPAPI it is expected to work ( everything is same expect the fact that internal implementation of webkit and xulrunner could be different).
Am I missing something here?
Pasting initial few lines from the log
Thread 0 Crashed: Dispatch queue: com.apple.main-thread
0 net.webvm 0x00000001004f8228 NP_GetEntryPoints + 24
1 net.webvm 0x00000001004f82b3 NP_Initialize + 67
2 com.apple.WebKit.PluginHost 0x00000001cfb65188 0x1cfb52000 + 78216
3 com.apple.WebKit.PluginHost 0x00000001cfb599e1 0x1cfb52000 + 31201
4 com.apple.WebKit.PluginHost 0x00000001cfb54ad3 0x1cfb52000 + 10963
5 com.apple.CoreFoundation 0x00007fff84fe9a49 __CFRunLoopDoBlocks + 297
6 com.apple.CoreFoundation 0x00007fff84fabe76 __CFRunLoopRun +

You might want to try starting from the npapi-sdk Mac example, which is both simpler than npsimple and more up to date.

Related

App Crashes At Startup From Testflight Build On iOS 13+ Only

I recently submitted an app update to the App Store. The app runs well in Xcode (on device and simulator) for all versions of iOS including iOS 13+. I was surprised that it was rejected for crashing at startup. I checked using a Testflight build and it only crashed when ran on a device with iOS 13+. I could not replicate crashes from Xcode as it only crashes on the builds from Tesflight.
I've been researching online and see that this is not an uncommon issue, however, I can't identify what's the issue in my case. I've tried changing the build settings in Xcode and building from an older version of Xcode (10.2.1, doesn't work bc I use newer classes not compatible with anything lower than Xcode 11). I also tried changing the swift compiler optimization level to zero in the build settings. To upload a build to Tesflight, I am exporting the archive and uploading to iTunes Connect using Apple's Transporter app.
Using the crash log and podfile description below, can anyone identify the issue and/or make a suggestion on what's going wrong in the build.
Crash Log
OS Version: iPhone OS 13.2.3 (17B111)
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Triggered by Thread: 0
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
libsystem_kernel.dylib 0x00000001baaf7ec4 __pthread_kill + 8
libsystem_pthread.dylib 0x00000001baa13774 pthread_kill$VARIANT$mp + 112
libsystem_c.dylib 0x00000001ba967844 abort + 100
libc++abi.dylib 0x00000001baac07d4 __cxa_bad_cast + 0
libc++abi.dylib 0x00000001baac09c4 demangling_unexpected_handler+ 6596 () + 0
libobjc.A.dylib 0x00000001baa28258 _objc_terminate+ 25176 () + 124
libc++abi.dylib 0x00000001baacd304 std::__terminate(void (*)+ 58116 ()) + 16
libc++abi.dylib 0x00000001baacd29c std::terminate+ 58012 () + 44
libdispatch.dylib 0x00000001ba9cd198 _dispatch_client_callout + 36
libdispatch.dylib 0x00000001ba975fd8 _dispatch_block_invoke_direct$VARIANT$mp + 224
FrontBoardServices 0x00000001bfe4e4c8__FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 40
FrontBoardServices 0x00000001bfe4e194 -[FBSSerialQueue _queue_performNextIfPossible] + 404
FrontBoardServices 0x00000001bfe4e6bc -[FBSSerialQueue _performNextFromRunLoopSource] + 28
CoreFoundation 0x00000001bac7d7c4 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24
CoreFoundation 0x00000001bac7d71c __CFRunLoopDoSource0 + 80
CoreFoundation 0x00000001bac7ceb4 __CFRunLoopDoSources0 + 180
CoreFoundation 0x00000001bac78000 __CFRunLoopRun + 1080
CoreFoundation 0x00000001bac778a0 CFRunLoopRunSpecific + 464
GraphicsServices 0x00000001c4bcf328 GSEventRunModal + 104
UIKitCore 0x00000001bed68740 UIApplicationMain + 1936
OnStation 0x0000000100a553ac main + 103340 (main.m:14)
libdyld.dylib 0x00000001bab02360 start + 4
Podfile
pod 'AWSCore'
pod 'AWSSNS'
pod 'AWSS3'
pod 'AWSCognito'
pod 'AWSCognitoIdentityProvider'
pod 'AWSCognitoSync'
pod 'AWSDynamoDB'
pod 'Flurry-iOS-SDK/FlurrySDK'
pod 'ArcGIS-Runtime-SDK-iOS', '100.2.1'
pod 'SVProgressHUD'
pod 'UICKeyChainStore'
pod 'RangeSeekSlider'
pod 'PubNub', '~> 4'
pod 'MessageKit'
I’m going to guess that this is due to a situation parallel to
iOS11 WKWebview crash due to NSInvalidUnarchiveOperationException
In other words, I'm guessing that you have something in your storyboard that comes from another framework that you need to link explicitly. That sort of thing often doesn’t crash from Xcode but does crash when launching independently.

Xcode 4 crashing on Run on MacOS 10.9

I'm dealing with some legacy code, won't compile on anything later than SDK 10.5 due to randomly abolished APIs, so I have good reason to stick with old compilers. I've been using Xcode 4.6.3; I recently clean-installed from OS X 10.7 to 10.9.
A new problem arises: Xcode reliably crashes on the Run command. I can build my applications just fine; they run successfully if I double-click the built product. But if I try to run directly from Xcode, Xcode crashes. The nature of the app doesn't seem to matter; I have tried this both with commandline and GUI apps. Selfsame result. Any insights?
From the crash report, in case it helps:
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Application Specific Information:
ProductBuildVersion: 4H1503
UNCAUGHT EXCEPTION (NSInvalidArgumentException): -[__NSCFString alloc]: unrecognized selector sent to instance 0x400c22b60
UserInfo: (null)
Hints: None
Backtrace:
0 0x00007fff8f224244 __exceptionPreprocess (in CoreFoundation)
1 0x00007fff91ebae75 objc_exception_throw (in libobjc.A.dylib)
2 0x00007fff8f22712d -[NSObject(NSObject) doesNotRecognizeSelector:] (in CoreFoundation)
3 0x00007fff8f182272 ___forwarding___ (in CoreFoundation)
4 0x00007fff8f181df8 _CF_forwarding_prep_0 (in CoreFoundation)
5 0x00000001107070a6 -[DBGLLDBDebugLocalService operationWorkerWithLaunchSession:error:] (in DebuggerLLDBService)
6 0x0000000110707593 -[DBGLLDBRunLocalService operationWorkerWithLaunchSession:error:] (in DebuggerLLDBService)
7 0x000000010b1bf8e7 -[IDERunDestination runOperationForLaunchSession:error:] (in IDEFoundation)
8 0x000000010b1be557 -[IDELaunchSchemeAction

Xcode 6.3.1: iOS app runs but won't archive

On Xcode 6.3.1 using a multi-project workspace - two Swift frameworks, the app itself, and Cocoapods. I can successfully build and run the app both on the simulator as well as my iPhones, but when I try to Archive it, I get:
Command failed due to signal: Segmentation fault: 11
This error appears to happen on two of my view controller files, but I have no idea what is wrong with them. Tried building from command line. Fruitless. I've also messed with my build settings, as has been suggested in other questions, to no avail.
Has anyone experienced the same issue? Can't submit anything to app store or make a test IPA :( Here is the stack trace produced:
0 swift 0x0000000109d14a18 llvm::sys::PrintStackTrace(__sFILE*) + 40
1 swift 0x0000000109d14ef4 SignalHandler(int) + 452
2 libsystem_platform.dylib 0x00007fff8fbb0f1a _sigtramp + 26
3 libsystem_platform.dylib 000000000000000000 _sigtramp + 1883566336
4 swift 0x00000001097f0d85 (anonymous namespace)::EmitDFDiagnostics::run() + 469
5 swift 0x00000001097fa55e swift::SILPassManager::runFunctionPasses(llvm::ArrayRef<swift::SILFunctionTransform*>) + 1310
6 swift 0x00000001097fb6a7 swift::SILPassManager::runOneIteration() + 2359
7 swift 0x00000001097fbe1c swift::SILPassManager::run() + 1212
8 swift 0x00000001097f8725 swift::runSILDiagnosticPasses(swift::SILModule&) + 597
9 swift 0x00000001095fdd6f frontend_main(llvm::ArrayRef<char const*>, char const*, void*) + 4319
10 swift 0x00000001095fcae6 main + 1814
11 libdyld.dylib 0x00007fff8ff895c9 start + 1
I had the exact same problem. I discovered the thing that was keeping the app from successfully archiving was the fact that i used the find() function to find the index of an item in an array. That function is provided by Swift, but when used in my actual codebase it wouldn't archive. I'm assuming there may be a couple stock functions that are preventing archiving. And keep in mind, these functions build and can run on the simulator, but they will not archive.

Qt: Phonon example code crash on Mac

I tried to run the phonon example code, Music player Example, came with the sdk. It runs well on Windows, but crashes while starting on Mac OS Snow Leopard 10.6.8. This is the crash details:
crash line:
audioOutput = new Phonon::AudioOutput(Phonon::MusicCategory, this);
crash log and call stack:
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0×0000000000000008
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Thread 0 Crashed: Dispatch queue: com.apple.main-thread
0 QtCore 0×0000000100e9c8f2 QObject::moveToThread(QThread*) + 34
1 QtDBus 0×00000001010b4912 _q_sessionBus() + 162
2 QtDBus 0×00000001010b4a71 QDBusConnection::sessionBus() + 17
3 phonon 0×000000010001beab Phonon::FactoryPrivate::FactoryPrivate() + 219
4 phonon 0×000000010001edc2 Phonon::Factory::registerFrontendObject(Phonon::MediaNodePrivate*) + 146
5 phonon 0×0000000100028f92 Phonon::MediaNodePrivate::MediaNodePrivate(Phonon::MediaNodePrivate::CastId) + 82
6 phonon 0×00000001000137bf Phonon::AudioOutput::AudioOutput(Phonon::Category, QObject*) + 63
7 com.yourcompany.qmusicplayer 0×00000001000026cc MainWindow::MainWindow() + 108
8 com.yourcompany.qmusicplayer 0×00000001000024a2 main + 114
9 com.yourcompany.qmusicplayer 0×0000000100002404 start + 52
I believe that this was a problem with Qt 4.8.0. It required dbus to be installed on your machine. There are workarounds like installing dbus on your machine or rebuilding Qt with a patch, but I believe it's fixed in Qt 4.8.1 so probably just use that.

Can I set breakpoints in Cocoa framework code?

Should I be able to set breakpoints inside the Cocoa framework itself?
I've been seeing various crashes in my Mac OS X application, sometimes randomly. Here's part of an example call stack from Xcode:
0 - 0x98ed0e20 in __CFRunLoopRun
1 - 0x98ece464 in CFRunLoopRunSpecific
2 - 0x98ece291 in CFRunLoopRunInMode
3 - 0x96a90004 in RunCurrentEventLoopInMode
4 - 0x96a8fdbb in ReceiveNextEventCommon
5 - 0x96a8fc40 in BlockUntilNextEventMatchingListInMode
6 - 0x925b078d in _DPSNextEvent
7 - 0x925affce in -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:]
8 - 0x92572247 in -[NSApplication run]
9 - 0x021f009c in QEventDispatcherMac::processEvents at qeventdispatcher_mac.mm:591
10 - 0x01e47742 in QEventLoop::processEvents at qeventloop.cpp:149
11 - 0x01e4799e in QEventLoop::exec at qeventloop.cpp:201
12 - 0x01e49a33 in QCoreApplication::exec at qcoreapplication.cpp:1003
13 - 0x02254c54 in QApplication::exec at qapplication.cpp:3581
When I click on lines 0 - 8, Xcode displays disassembly.
I've changed my Xcode project so that it uses the _debug suffix when loading frameworks. This allows me to step through the Qt code in lines 9 - 13, but line 8 is called at startup and crashes can happen at any time after that.
If I can't set breakpoints, are there any tools that might help me debug problems like this?
Thanks in advance.
You can set up a breakpoint so it breaks on code outside your own. But you will not be able to see the source because you don't have the source code.
In xCode (3.x.x)
"Run->Manage Breakpoints->Add Symbolic Breakpoint"
In XCode 4 you can create a symbolic breakpoint with
Product->Debug->Create Symbolic Breakpoint...
In XCode 5
Debug->Breakpoints->Create Symbolic Breakpoint

Resources