[Libreoffice-commits] core.git: sal/osl

Tor Lillqvist (via logerrit) logerrit at kemper.freedesktop.org
Thu Mar 4 11:56:43 UTC 2021


 sal/osl/unx/backtrace.c |   69 ------------------------------------------------
 1 file changed, 1 insertion(+), 68 deletions(-)

New commits:
commit 6b439e81a1916bcb42fb0fc24b1aea06e2da0d1e
Author:     Tor Lillqvist <tml at collabora.com>
AuthorDate: Thu Mar 4 11:56:50 2021 +0200
Commit:     Tor Lillqvist <tml at collabora.com>
CommitDate: Thu Mar 4 12:55:59 2021 +0100

    The backtrace() etc API is available on macOS and iOS, too
    
    Change-Id: I9a62391c4d109cd2fd2ab60d92a9e3b631ee6773
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111951
    Tested-by: Jenkins
    Reviewed-by: Tor Lillqvist <tml at collabora.com>

diff --git a/sal/osl/unx/backtrace.c b/sal/osl/unx/backtrace.c
index a3aeb3dae3f8..26005f7715af 100644
--- a/sal/osl/unx/backtrace.c
+++ b/sal/osl/unx/backtrace.c
@@ -212,74 +212,7 @@ void backtrace_symbols_fd( void **buffer, int size, int fd )
     }
 }
 
-#elif defined( MACOSX )
-
-#include <dlfcn.h>
-#include <stdio.h>
-#include "backtrace.h"
-
-/* glib backtrace is only available on MacOsX 10.5 or higher
-   so we do it on our own */
-
-int backtrace( void **buffer, int max_frames )
-{
-    void **frame = (void **)__builtin_frame_address(0);
-    void **bp = ( void **)(*frame);
-    void *ip = frame[1];
-    int i;
-
-    for ( i = 0; bp && ip && i < max_frames; i++ )
-    {
-        *(buffer++) = ip;
-
-        ip = bp[1];
-        bp = (void**)(bp[0]);
-    }
-
-    return i;
-}
-
-char ** backtrace_symbols(void * const * buffer, int size)
-{
-    (void)buffer; (void)size;
-    return NULL; /*TODO*/
-}
-
-void backtrace_symbols_fd( void **buffer, int size, int fd )
-{
-    FILE    *fp = fdopen( fd, "w" );
-
-    if ( fp )
-    {
-        void **pFramePtr;
-
-        for ( pFramePtr = buffer; size > 0 && pFramePtr && *pFramePtr; pFramePtr++, size-- )
-        {
-            Dl_info     dli;
-
-            if ( 0 != dladdr( *pFramePtr, &dli ) )
-            {
-                ptrdiff_t offset;
-
-                if ( dli.dli_fname && dli.dli_fbase )
-                {
-                    offset = (ptrdiff_t)*pFramePtr - (ptrdiff_t)dli.dli_fbase;
-                    fprintf( fp, "%s+0x%tx", dli.dli_fname, offset );
-                }
-                if ( dli.dli_sname && dli.dli_saddr )
-                {
-                    offset = (ptrdiff_t)*pFramePtr - (ptrdiff_t)dli.dli_saddr;
-                    fprintf( fp, "(%s+0x%tx)", dli.dli_sname, offset );
-                }
-            }
-            fprintf( fp, "[%p]\n", *pFramePtr );
-        }
-
-        fclose( fp );
-    }
-}
-
-#elif !defined LINUX
+#elif !defined LINUX && !defined MACOSX && !defined IOS
 
 int backtrace( void **buffer, int max_frames )
 {


More information about the Libreoffice-commits mailing list