bridges/source/cpp_uno/gcc3_ios_arm/cpp2uno-arm64.cxx |   12 ++++----
 bridges/source/cpp_uno/gcc3_ios_arm/except.cxx        |    6 ++--
 ucbhelper/source/provider/cancelcommandexecution.cxx  |   27 +++++++++++++++++-
 3 files changed, 37 insertions(+), 8 deletions(-)

New commits:
commit 55c6dade042eff373b8b8c9ed383b751c035fc80
Author: Tor Lillqvist <t...@collabora.com>
Date:   Tue Dec 24 03:18:45 2013 +0200

    Hacky workaround for non-working C++/UNO bridge for arm64 iOS
    
    I haven't managed to get the C++/UNO bridge to work for 64-bit iOS
    code yet. I think I understand the calling convention and the
    parameter marshalling etc might even be correct now. But something
    goes wrong in the dynamic creation of type_infos and throwing of
    exceptions. 64-bit iOS code uses a different unwinding mechanism than
    32-bit iOS code, I think, which could be related.
    
    Quite possibly there is also an unintended compiler feature (or dare I
    say bug?) in Apple's Clang for arm64 that affects this: The typeinfos
    are generated as private_extern symbols in arm64 code (instead of as
    normal extern in armv7 code), thus the dlsym() thing to look up
    typeinfos doesn't work.
    
    Note that as we don't support any Basic, Java or Python on iOS anyway,
    the C++/UNO bridge is not used for much. Actually, the only use of the
    bridge at least in the TiledLibreOffice test app seems to be to throw
    exceptions. Fun, huh? As the actual types of exceptions thrown seems
    to be a quite small set, just hack it and throw the appropriate
    exception directly... The only places where exceptions are thrown
    through the bridge that is used in the test app seems to be the two
    cancelCommandExecution() functions in ucbhelper.
    
    (It would be nice to change the ucbhelper API to not use exceptions
    for non-exceptional conditions, but that's another thing...)
    
    Change-Id: Ifd1861ccbba23d3b138e82400f2b7d80baf0215a

diff --git a/ucbhelper/source/provider/cancelcommandexecution.cxx 
b/ucbhelper/source/provider/cancelcommandexecution.cxx
index 91bcd79..617c96c 100644
--- a/ucbhelper/source/provider/cancelcommandexecution.cxx
+++ b/ucbhelper/source/provider/cancelcommandexecution.cxx
@@ -25,7 +25,10 @@
  *************************************************************************/
 #include <osl/diagnose.h>
 #include <cppuhelper/exc_hlp.hxx>
+#include <com/sun/star/lang/IllegalArgumentException.hpp>
 #include <com/sun/star/ucb/CommandFailedException.hpp>
+#include <com/sun/star/ucb/InteractiveAugmentedIOException.hpp>
+#include <com/sun/star/ucb/NameClashException.hpp>
 #include <com/sun/star/ucb/XCommandEnvironment.hpp>
 #include <ucbhelper/interactionrequest.hxx>
 #include <ucbhelper/cancelcommandexecution.hxx>
@@ -71,8 +74,23 @@ void cancelCommandExecution( const uno::Any & rException,
         }
     }
 
-    cppu::throwException( rException );
+#if defined IOS && defined __arm64
+    // No Java, Basic, or Python on iOS, so try to throw the exception
+    // directly. Much simpler. Especially as I haven't managed yet to
+    // get the C++/UNO bridge to work for arm64, and this
+    // cppu::throwException thing seems to be the only use for it, at
+    // least in the test apps...
+
+    ucb::NameClashException aNCE;
+    if ( rException >>= aNCE )
+        throw aNCE;
+
+    lang::IllegalArgumentException aIAE;
+    if ( rException >>= aIAE )
+        throw aIAE;
+#endif
 
+    cppu::throwException( rException );
     OSL_FAIL( "Return from cppu::throwException call!!!" );
     throw uno::RuntimeException();
 }
@@ -109,6 +127,13 @@ void cancelCommandExecution( const ucb::IOErrorCode eError,
         }
     }
 
+#if defined IOS && defined __arm64
+    // See comment above.
+    ucb::InteractiveAugmentedIOException aExc;
+    if ( xRequest->getRequest() >>= aExc )
+        throw aExc;
+#endif
+
     cppu::throwException( xRequest->getRequest() );
 
     OSL_FAIL( "Return from cppu::throwException call!!!" );
commit 69ea6062d280b93d8372f508864aab60dd810917
Author: Tor Lillqvist <t...@collabora.com>
Date:   Tue Dec 24 03:12:29 2013 +0200

    Minor logging change
    
    Change-Id: I2d25c7c196d0386a1c38fa55746370a84c2a2398

diff --git a/bridges/source/cpp_uno/gcc3_ios_arm/except.cxx 
b/bridges/source/cpp_uno/gcc3_ios_arm/except.cxx
index 01690d3..71171ff 100644
--- a/bridges/source/cpp_uno/gcc3_ios_arm/except.cxx
+++ b/bridges/source/cpp_uno/gcc3_ios_arm/except.cxx
@@ -169,7 +169,7 @@ RTTI::RTTI() SAL_THROW(())
     // Insert commonly needed type_infos to avoid dlsym() calls
     // Ideally we should insert all needed ones
     m_rttis.insert( t_rtti_map::value_type( 
"com.sun.star.ucb.InteractiveAugmentedIOException",
-                                            &typeid( 
com::sun::star::ucb::InteractiveAugmentedIOException ) ) );
+                                            (std::type_info*) &typeid( 
com::sun::star::ucb::InteractiveAugmentedIOException ) ) );
 #endif
 }
 
@@ -207,7 +207,7 @@ std::type_info * RTTI::getRTTI( 
typelib_CompoundTypeDescription *pTypeDescr ) SA
 
         if (rtti)
         {
-            SAL_INFO( "bridges.ios", "getRTTI: dlsym() found type_info for " 
<< unoName );
+            SAL_INFO( "bridges.ios", "getRTTI: dlsym() found type_info for " 
<< unoName << ": " << symName );
             std::pair< t_rtti_map::iterator, bool > insertion(
                 m_rttis.insert( t_rtti_map::value_type( unoName, rtti ) ) );
             SAL_WARN_IF( !insertion.second,
@@ -216,6 +216,8 @@ std::type_info * RTTI::getRTTI( 
typelib_CompoundTypeDescription *pTypeDescr ) SA
         }
         else
         {
+            SAL_INFO( "bridges.ios", "getRTTI: dlsym() could NOT find 
type_info for " << unoName << ": " << symName );
+
             // try to lookup the symbol in the generated rtti map
             t_rtti_map::const_iterator iFind2( m_generatedRttis.find( unoName 
) );
             if (iFind2 == m_generatedRttis.end())
commit a639961bb23c05d90a605a618b252160243ef0ed
Author: Tor Lillqvist <t...@collabora.com>
Date:   Mon Dec 23 21:03:55 2013 +0200

    More informative logging in codeSnippet()
    
    Change-Id: I51bceba0918928812daca3a2c92633b6998b380c

diff --git a/bridges/source/cpp_uno/gcc3_ios_arm/cpp2uno-arm64.cxx 
b/bridges/source/cpp_uno/gcc3_ios_arm/cpp2uno-arm64.cxx
index a82628a..8c57046 100644
--- a/bridges/source/cpp_uno/gcc3_ios_arm/cpp2uno-arm64.cxx
+++ b/bridges/source/cpp_uno/gcc3_ios_arm/cpp2uno-arm64.cxx
@@ -461,7 +461,9 @@ extern "C" sal_Int64 cpp_vtable_call( sal_Int32 
*pFunctionAndOffset,
 
 namespace
 {
-    unsigned char *codeSnippet(sal_Int32 functionIndex,
+    unsigned char *codeSnippet(const typelib_InterfaceTypeDescription *type,
+                               const typelib_TypeDescription *member,
+                               sal_Int32 functionIndex,
                                sal_Int32 vtableOffset)
     {
         assert(functionIndex < nFunIndexes);
@@ -477,7 +479,7 @@ namespace
         int index = functionIndex*nVtableOffsets + vtableOffset;
         unsigned char *result = ((unsigned char *) &codeSnippets) + 
codeSnippets[index];
 
-        SAL_INFO( "bridges.ios", "codeSnippet: [" << functionIndex << "," << 
vtableOffset << "]=" << (void *) result << " (" << std::hex << 
((int*)result)[0] << "," << ((int*)result)[1] << "," << ((int*)result)[2] << 
"," << ((int*)result)[3] << ")");
+        SAL_INFO( "bridges.ios", "codeSnippet(" << 
OUString(type->aBase.pTypeName) << "::" << OUString(member->pTypeName) << "): 
[" << functionIndex << "," << vtableOffset << "]=" << (void *) result << " (" 
<< std::hex << ((int*)result)[0] << "," << ((int*)result)[1] << "," << 
((int*)result)[2] << "," << ((int*)result)[3] << ")");
 
         return result;
     }
@@ -530,18 +532,18 @@ unsigned char * 
bridges::cpp_uno::shared::VtableFactory::addLocalFunctions(
                     reinterpret_cast<typelib_InterfaceAttributeTypeDescription 
*>( member );
 
                 // Getter:
-                (s++)->fn = codeSnippet( functionOffset++, vtableOffset );
+                (s++)->fn = codeSnippet( type, member, functionOffset++, 
vtableOffset );
 
                 // Setter:
                 if (!pAttrTD->bReadOnly)
                 {
-                    (s++)->fn = codeSnippet( functionOffset++, vtableOffset );
+                    (s++)->fn = codeSnippet( type, member, functionOffset++, 
vtableOffset );
                 }
                 break;
             }
             case typelib_TypeClass_INTERFACE_METHOD:
             {
-                (s++)->fn = codeSnippet( functionOffset++, vtableOffset );
+                (s++)->fn = codeSnippet( type, member, functionOffset++, 
vtableOffset );
                 break;
             }
         default:
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to