Cppuno in bridges, HELP needed.

Jan Iversen jancasacondor at gmail.com
Tue Mar 6 14:09:11 UTC 2018



> On 6 Mar 2018, at 14:17, Stephan Bergmann <sbergman at redhat.com> wrote:
> 
> On 06.03.2018 11:38, Jan Iversen wrote:
>> At some point a piece of code (in the same executable) decides to make a uno call, this looks like
>> Cpp2uno_call() ->
>> 	raise_exception()
>> 		__cxa_throw() ->
>> 		( C++ throw handling) ->
>> 			getCaughtException() ->
>> 				UnoInterfaceProxyDispatch() ->
>> 					cpp_call() ->
>> 						CallVirtualMethod() ->
>> 							( Call requested function )
> 
> Hard to tell what you're actually looking at without seeing a real backtrace (e.g., I have no idea what "Cpp2uno_call()" is supposed to mean).

No problem, I just tried to limit the mail size :-) cpp2uno_call is a function implemented in bridges/source/cppuno/gcc*

Backtrace:

(lldb) bt
* thread #10, name = 'LOKitThread.queue', stop reason = breakpoint 14.1
  * frame #0: 0x000000010cb6b416 libKit.dylib`gcc3::callVirtualMethod(pThis=0x00000001173b0f20, nVtableIndex=4, pRegisterReturn=0x0000000000000000, pReturnTypeRef=0x0000608000098830, bSimpleReturn=true, pStack=0x0000700002a04dd0, nStack=0, pGPR=0x0000700002a050e0, pFPR=0x0000700002a050a0) at callvirtualmethod.cxx:73
    frame #1: 0x000000010cb6a48f libKit.dylib`cpp_call(pThis=0x0000604000e76c40, aVtableSlot=(offset = 0, index = 4), pReturnTypeRef=0x0000608000098830, nParams=0, pParams=0x0000000000000000, pUnoReturn=0x0000000000000000, pUnoArgs=0x0000000000000000, ppUnoExc=0x0000700002a053f0) at uno2cpp.cxx:233
    frame #2: 0x000000010cb69bee libKit.dylib`unoInterfaceProxyDispatch(pUnoI=0x0000604000e76c40, pMemberDescr=0x000060c00015bcd0, pReturn=0x0000000000000000, pArgs=0x0000000000000000, ppException=0x0000700002a053f0) at uno2cpp.cxx:418
    frame #3: 0x00000001133528cd libKit.dylib`com::sun::star::uno::UnoInterfaceReference::dispatch(this=0x0000700002a05418, pMemberType=0x000060c00015bcd0, pReturn=0x0000000000000000, pArgs=0x0000000000000000, ppException=0x0000700002a053f0) const at dispatcher.hxx:173
    frame #4: 0x0000000113352558 libKit.dylib`cppu::getCaughtException() at exc_thrower.cxx:238
    frame #5: 0x000000011371d85f libKit.dylib`utl::UCBContentHelper::IsDocument(url=0x0000700002a059e0) at ucbhelper.cxx:150
    frame #6: 0x000000010c83d005 libKit.dylib`FSStorageFactory::createInstanceWithArguments(this=0x0000600001a6b300, aArguments=0x0000700002a05b40) at fsfactory.cxx:128
    frame #7: 0x000000010c83d883 libKit.dylib`non-virtual thunk to FSStorageFactory::createInstanceWithArguments(this=0x0000600001a6b300, aArguments=0x0000700002a05b40) at fsfactory.cxx:0
    frame #8: 0x000000010c917d91 libKit.dylib`framework::PresetHandler::getOrCreateRootStorageShare(this=0x00006000001f2500) at presethandler.cxx:226
    frame #9: 0x000000010c918d52 libKit.dylib`framework::PresetHandler::connectToResource(this=0x00006000001f2500, eConfigType=E_MODULES, sResource=0x0000700002a06740, sModule=0x00007fb0704781a0, xDocumentRoot=0x0000700002a06738, rLanguageTag=0x0000700002a067a0) at presethandler.cxx:349
    frame #10: 0x000000010cab7a6c libKit.dylib`(anonymous namespace)::ModuleUIConfigurationManager::ModuleUIConfigurationManager(this=0x00007fb0704780a0, xContext=0x0000700002a06890, aArguments=0x0000700002a06de0) at moduleuiconfigurationmanager.cxx:888
    frame #11: 0x000000010cab6dd5 libKit.dylib`(anonymous namespace)::ModuleUIConfigurationManager::ModuleUIConfigurationManager(this=0x00007fb0704780a0, xContext=0x0000700002a06890, aArguments=0x0000700002a06de0) at moduleuiconfigurationmanager.cxx:855
    frame #12: 0x000000010cab6cba libKit.dylib`::com_sun_star_comp_framework_ModuleUIConfigurationManager_get_implementation(context=0x000060800012af00, arguments=0x0000700002a06de0) at moduleuiconfigurationmanager.cxx:1676
    frame #13: 0x00000001133c55a0 libKit.dylib`com::sun::star::uno::XInterface* std::__1::__invoke_void_return_wrapper<com::sun::star::uno::XInterface*>::__call<com::sun::star::uno::XInterface* (*&)(com::sun::star::uno::XComponentContext*, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&), com::sun::star::uno::XComponentContext*, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&>(com::sun::star::uno::XInterface* (*&&&)(com::sun::star::uno::XComponentContext*, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&), com::sun::star::uno::XComponentContext*&&, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&&&) [inlined] decltype(__f=0x00006000000f6998, __args=0x0000700002a069c0, __args=0x0000700002a06de0)(com::sun::star::uno::XComponentContext*, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&)>(fp)(std::__1::forward<com::sun::star::uno::XComponentContext*, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&>(fp0))) std::__1::__invoke<com::sun::star::uno::XInterface* (*&)(com::sun::star::uno::XComponentContext*, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&), com::sun::star::uno::XComponentContext*, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&>(com::sun::star::uno::XInterface* (*&&&)(com::sun::star::uno::XComponentContext*, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&), com::sun::star::uno::XComponentContext*&&, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&&&) at type_traits:4291
    frame #14: 0x00000001133c5574 libKit.dylib`com::sun::star::uno::XInterface* std::__1::__invoke_void_return_wrapper<com::sun::star::uno::XInterface*>::__call<com::sun::star::uno::XInterface* (__args=0x00006000000f6998, __args=0x0000700002a069c0, __args=0x0000700002a06de0)(com::sun::star::uno::XComponentContext*, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&), com::sun::star::uno::XComponentContext*, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&>(com::sun::star::uno::XInterface* (*&&&)(com::sun::star::uno::XComponentContext*, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&), com::sun::star::uno::XComponentContext*&&, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&&&) at __functional_base:328
    frame #15: 0x00000001133c5429 libKit.dylib`std::__1::__function::__func<com::sun::star::uno::XInterface* (*)(com::sun::star::uno::XComponentContext*, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&), std::__1::allocator<com::sun::star::uno::XInterface* (*)(com::sun::star::uno::XComponentContext*, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&)>, com::sun::star::uno::XInterface* (com::sun::star::uno::XComponentContext*, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&)>::operator(this=0x00006000000f6990, __arg=0x0000700002a069c0, __arg=0x0000700002a06de0)(com::sun::star::uno::XComponentContext*&&, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&) at functional:1552
    frame #16: 0x0000000113388a8f libKit.dylib`std::__1::function<com::sun::star::uno::XInterface* (com::sun::star::uno::XComponentContext*, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&)>::operator(this=0x00006000000f6990, __arg=0x000060800012af00, __arg=0x0000700002a06de0)(com::sun::star::uno::XComponentContext*, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&) const at functional:1903
    frame #17: 0x0000000113388d18 libKit.dylib`cppuhelper::ServiceManager::Data::Implementation::createInstanceWithArguments(this=0x00006000000f6980, context=0x0000600000136898, singletonRequest=false, arguments=0x0000700002a06de0) at servicemanager.cxx:683
    frame #18: 0x0000000113392794 libKit.dylib`cppuhelper::ServiceManager::createInstanceWithArgumentsAndContext(this=0x00007fb070600110, ServiceSpecifier=0x0000700002a06dc0, Arguments=0x0000700002a06de0, Context=0x0000600000136898) at servicemanager.cxx:1004
    frame #19: 0x0000000113392833 libKit.dylib`non-virtual thunk to cppuhelper::ServiceManager::createInstanceWithArgumentsAndContext(this=0x00007fb070600110, ServiceSpecifier=0x0000700002a06dc0, Arguments=0x0000700002a06de0, Context=0x0000600000136898) at servicemanager.cxx:0
    frame #20: 0x000000010cab547b libKit.dylib`com::sun::star::ui::ModuleUIConfigurationManager::createDefault(the_context=0x0000600000136898, ModuleShortName=0x0000700002a07080, ModuleIdentifier=0x0000700002a07398) at ModuleUIConfigurationManager.hpp:50
    frame #21: 0x000000010cab2818 libKit.dylib`(anonymous namespace)::ModuleUIConfigurationManagerSupplier::getUIConfigurationManager(this=0x0000600000136800, sModuleIdentifier=0x0000700002a07398) at moduleuicfgsupplier.cxx:176
    frame #22: 0x000000010cab2df3 libKit.dylib`non-virtual thunk to (anonymous namespace)::ModuleUIConfigurationManagerSupplier::getUIConfigurationManager(this=0x0000600000136800, sModuleIdentifier=0x0000700002a07398) at moduleuicfgsupplier.cxx:0
    frame #23: 0x000000010c985574 libKit.dylib`framework::LayoutManager::implts_reset(this=0x00007fb0705673a0, bAttached=true) at layoutmanager.cxx:286
    frame #24: 0x000000010c998c2a libKit.dylib`framework::LayoutManager::frameAction(this=0x00007fb0705673a0, aEvent=0x0000700002a07768) at layoutmanager.cxx:2700
    frame #25: 0x000000010c998e0c libKit.dylib`non-virtual thunk to framework::LayoutManager::frameAction(this=0x00007fb0705673a0, aEvent=0x0000700002a07768) at layoutmanager.cxx:0
    frame #26: 0x000000010ca48d72 libKit.dylib`(anonymous namespace)::Frame::implts_sendFrameActionEvent(this=0x00007fb0705632e0, aAction=0x00000001157a3834) at frame.cxx:2942
    frame #27: 0x000000010ca3b44b libKit.dylib`(anonymous namespace)::Frame::setComponent(this=0x00007fb0705632e0, xComponentWindow=0x0000700002a07b30, xController=0x0000700002a07b28) at frame.cxx:1536
    frame #28: 0x000000010ca418c4 libKit.dylib`non-virtual thunk to (anonymous namespace)::Frame::setComponent(this=0x00007fb0705632e0, xComponentWindow=0x0000700002a07b30, xController=0x0000700002a07b28) at frame.cxx:0
    frame #29: 0x00000001103efdbd libKit.dylib`(anonymous namespace)::SfxFrameLoader_Impl::impl_createDocumentView(i_rModel=0x0000700002a07e88, i_rFrame=0x0000700002a082d8, i_rViewFactoryArgs=0x0000700002a07e50, i_rViewName=0x0000700002a07da0) at frmload.cxx:592
    frame #30: 0x00000001103ec7a6 libKit.dylib`(anonymous namespace)::SfxFrameLoader_Impl::load(this=0x000060c000a71880, rArgs=0x0000700002a08258, _rTargetFrame=0x0000700002a082d8) at frmload.cxx:710
    frame #31: 0x00000001103ecc74 libKit.dylib`non-virtual thunk to (anonymous namespace)::SfxFrameLoader_Impl::load(this=0x000060c000a71880, rArgs=0x0000700002a08258, _rTargetFrame=0x0000700002a082d8) at frmload.cxx:0
    frame #32: 0x000000010c9df2ab libKit.dylib`framework::LoadEnv::impl_loadContent(this=0x0000700002a089c8) at loadenv.cxx:1107
    frame #33: 0x000000010c9d92cc libKit.dylib`framework::LoadEnv::startLoading(this=0x0000700002a089c8) at loadenv.cxx:375
    frame #34: 0x000000010c9d7864 libKit.dylib`framework::LoadEnv::loadComponentFromURL(xLoader=0x0000700002a08b40, xContext=0x00007fb07300b5e0, sURL=0x0000700002a09308, sTarget=0x0000700002a091f8, nFlags=0, lArgs=0x0000700002a09280) at loadenv.cxx:161
    frame #35: 0x000000010ca2a2c1 libKit.dylib`framework::Desktop::loadComponentFromURL(this=0x00007fb07300b4c0, sURL=0x0000700002a09308, sTargetFrameName=0x0000700002a091f8, nSearchFlags=0, lArguments=0x0000700002a09280) at desktop.cxx:618
    frame #36: 0x000000010ca2a3cb libKit.dylib`non-virtual thunk to framework::Desktop::loadComponentFromURL(this=0x00007fb07300b4c0, sURL=0x0000700002a09308, sTargetFrameName=0x0000700002a091f8, nSearchFlags=0, lArguments=0x0000700002a09280) at desktop.cxx:0
    frame #37: 0x000000011064fdeb libKit.dylib`lo_documentLoadWithOptions(pThis=0x00006040000aae00, pURL="file:///Users/jani/Library/Developer/CoreSimulator/Devices/4088A840-32A5-4B26-9225-FF6BFE3DF964/data/Containers/Bundle/Application/FB15EB6A-81ED-41CF-BC95-A6568BCE9AE1/LibreOfficeLight.app/welcome.odt", pOptions=0x0000000000000000) at init.cxx:1361
    frame #38: 0x000000011064f091 libKit.dylib`lo_documentLoad(pThis=0x00006040000aae00, pURL="file:///Users/jani/Library/Developer/CoreSimulator/Devices/4088A840-32A5-4B26-9225-FF6BFE3DF964/data/Containers/Bundle/Application/FB15EB6A-81ED-41CF-BC95-A6568BCE9AE1/LibreOfficeLight.app/welcome.odt") at init.cxx:1279
    frame #39: 0x0000000101440321 LibreOfficeLight`LibreOffice.documentLoad(url="file:///Users/jani/Library/Developer/CoreSimulator/Devices/4088A840-32A5-4B26-9225-FF6BFE3DF964/data/Containers/Bundle/Application/FB15EB6A-81ED-41CF-BC95-A6568BCE9AE1/LibreOfficeLight.app/welcome.odt", self=0x00006000000e7b00) at LibreOfficeKitWrapper.swift:117
    frame #40: 0x000000010145645f LibreOfficeLight`closure #1 in LOKitThread.documentLoad(lo=0x00006000000e7b00, url="file:///Users/jani/Library/Developer/CoreSimulator/Devices/4088A840-32A5-4B26-9225-FF6BFE3DF964/data/Containers/Bundle/Application/FB15EB6A-81ED-41CF-BC95-A6568BCE9AE1/LibreOfficeLight.app/welcome.odt", callback=0x000000010144ef90 LibreOfficeLight`partial apply forwarder for closure #1 (Swift.Optional<LibreOfficeLight.DocumentHolder>, Swift.Optional<Swift.Error>) -> () in LibreOfficeLight.DocumentController.doOpen(Foundation.URL) -> () at DocumentController.swift) at LOKitThread.swift:106
    frame #41: 0x0000000101456ac2 LibreOfficeLight`partial apply for closure #1 in LOKitThread.documentLoad(url:callback:) at LOKitThread.swift:0
    frame #42: 0x00000001014561fa LibreOfficeLight`closure #1 in LOKitThread.withLibreOffice(closure=0x0000000101456a50 LibreOfficeLight`partial apply forwarder for closure #1 (LibreOfficeLight.LibreOffice) -> () in LibreOfficeLight.LOKitThread.documentLoad(url: Swift.String, callback: (Swift.Optional<LibreOfficeLight.DocumentHolder>, Swift.Optional<Swift.Error>) -> ()) -> () at LOKitThread.swift, self=0x000060c00007bec0) at LOKitThread.swift:90
    frame #43: 0x00000001014562af LibreOfficeLight`partial apply for closure #1 in LOKitThread.withLibreOffice(_:) at LOKitThread.swift:0
    frame #44: 0x00000001014677bc LibreOfficeLight`closure #1 in SingleThreadedQueue.async(runnable=0x0000000101456260 LibreOfficeLight`partial apply forwarder for closure #1 () -> () in LibreOfficeLight.LOKitThread.withLibreOffice((LibreOfficeLight.LibreOffice) -> ()) -> () at LOKitThread.swift) at AsyncUtil.swift:62
    frame #45: 0x000000010146784a LibreOfficeLight`partial apply for closure #1 in SingleThreadedQueue.async(_:) at AsyncUtil.swift:0
    frame #46: 0x00000001014466b9 LibreOfficeLight`thunk for @callee_owned () -> () at DocumentActions.swift:0
    frame #47: 0x00000001017ff22f Foundation`__NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK__ + 7
    frame #48: 0x00000001017ff091 Foundation`-[NSBlockOperation main] + 68
    frame #49: 0x00000001017fd54e Foundation`-[__NSOperationInternal _start:] + 778
    frame #50: 0x000000010182a1e8 Foundation`__NSThreadPerformPerform + 334
    frame #51: 0x00000001026fa101 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
    frame #52: 0x0000000102799f71 CoreFoundation`__CFRunLoopDoSource0 + 81
    frame #53: 0x00000001026dea19 CoreFoundation`__CFRunLoopDoSources0 + 185
    frame #54: 0x00000001026ddfff CoreFoundation`__CFRunLoopRun + 1279
    frame #55: 0x00000001026dd889 CoreFoundation`CFRunLoopRunSpecific + 409
    frame #56: 0x00000001017e46de Foundation`-[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 274
    frame #57: 0x00000001017e45b9 Foundation`-[NSRunLoop(NSRunLoop) run] + 76
    frame #58: 0x000000010146746b LibreOfficeLight`SingleThreadedQueue.main(self=0x00006080004735c0) at AsyncUtil.swift:55
    frame #59: 0x00000001014675a4 LibreOfficeLight`@objc SingleThreadedQueue.main() at AsyncUtil.swift:0
    frame #60: 0x00000001017f212c Foundation`__NSThread__start__ + 1197
    frame #61: 0x0000000106ef86c1 libsystem_pthread.dylib`_pthread_body + 340
    frame #62: 0x0000000106ef856d libsystem_pthread.dylib`_pthread_start + 377
    frame #63: 0x0000000106ef7c5d libsystem_pthread.dylib`thread_start + 13
(lldb) 

This backtrace is on a Mac, compiled as MAC but with libraries that allow it to run in the iOS simulator. This is from loading a document.

> 
> As there is "getCaughtException()" in your picture: cppu::getCaughtException (cppuhelper/exc_hlp.hxx) internally uses the bridge between C++ and binary UNO to translate the C++ exception being caught by the current catch block into a css::uno::Any.  You need that bridge in all its glory, beautiful assembler hackery and all, for that functionality to work.

That is for sure an argument, I forgot that using throw is a “modern” way of the old longjump(), allowing you not scroll back in the call stack.

> 
>> Because on iOS, no external process will ever call the UNO interface, it is 1 single executable (I also removed the pipes etc).
> 
> Just to be clear:  The bridge between C++ and binary UNO is used in more scenarios than just inter-process communication.  Other examples are bridging to code in other languages like Java, the thread-affine bridge used by some (Java) database code, or cppu::getCaughtException mentioned above.  While the former examples may not be relevant on iOS, the latter one certainly is.

I can see now that the throw/catch mechanism needs to stay, but in iOS we do not use java or python, so there are no real need to convert everything to uno standard just to convert it back again.

Thanks for the answer.
rgds
Jan I.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice/attachments/20180306/8b216b84/attachment.html>


More information about the LibreOffice mailing list