diff options
author | Vladimir Glazounov <vg@openoffice.org> | 2008-08-18 14:47:52 +0000 |
---|---|---|
committer | Vladimir Glazounov <vg@openoffice.org> | 2008-08-18 14:47:52 +0000 |
commit | 9a62d7f6605620a53eea67ec5b55e607c2d427b4 (patch) | |
tree | b82a9cdd8d865e7eb8a4c49ef1409242df22dccf /sal | |
parent | 693ade21073738d3d64c685239585d88b23663fd (diff) |
INTEGRATION: CWS maccrashrep (1.36.22); FILE MERGED
2008/07/25 09:37:28 hro 1.36.22.5: #i90159# Fixed PPC tinderbox break
2008/07/24 14:16:21 hro 1.36.22.4: #i90159# Changes to fix Tinerbox PPC
2008/07/23 11:57:48 obr 1.36.22.3: #i90159# re-introduced ifdefs in PrintStack
2008/07/21 08:48:04 hro 1.36.22.2: #i90159# implemented missing backtrace functions in glibc
2008/06/25 08:31:22 hro 1.36.22.1: #i90159# Enabled crash reporting for MacOsX
Diffstat (limited to 'sal')
-rw-r--r-- | sal/osl/unx/signal.c | 52 |
1 files changed, 49 insertions, 3 deletions
diff --git a/sal/osl/unx/signal.c b/sal/osl/unx/signal.c index 2d7cdafb5e41..77633dd81269 100644 --- a/sal/osl/unx/signal.c +++ b/sal/osl/unx/signal.c @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: signal.c,v $ - * $Revision: 1.36 $ + * $Revision: 1.37 $ * * This file is part of OpenOffice.org. * @@ -34,6 +34,16 @@ #define MAX_STACK_FRAMES 256 +#if defined( MACOSX ) + +#if defined( INTEL ) +#include "backtrace.h" +#define INCLUDE_BACKTRACE +#define STACKTYPE "MacOsX_X86" +#endif /* INTEL */ + +#endif /* MACOSX */ + #ifdef LINUX #include <execinfo.h> #define INCLUDE_BACKTRACE @@ -60,6 +70,7 @@ #include <osl/signal.h> #include <osl/process.h> #include <osl/thread.h> +#include <rtl/bootstrap.h> #include <rtl/digest.h> #include "file_path_helper.h" @@ -297,6 +308,7 @@ static sal_Bool DeInitSignal() } #if defined (SAL_ENABLE_CRASH_REPORT) && defined(INCLUDE_BACKTRACE) + /*****************************************************************************/ /* Generate MD5 checksum */ /*****************************************************************************/ @@ -626,6 +638,40 @@ static int ReportCrash( int Signal ) pChecksumTempName, pStackTempName, bAutoCrashReport ? " -noui -send" : " -noui" ); +#elif defined( MACOSX ) + if ( pXMLTempName && pChecksumTempName && pStackTempName ) + { + rtl_uString *crashrep_url = NULL; + rtl_uString *crashrep_path = NULL; + rtl_String *crashrep_path_system = NULL; + + rtl_string2UString( &crashrep_url, RTL_CONSTASCII_USTRINGPARAM("$BRAND_BASE_DIR/program/crash_report.bin"), OSTRING_TO_OUSTRING_CVTFLAGS ); + rtl_bootstrap_expandMacros( &crashrep_url ); + osl_getSystemPathFromFileURL( crashrep_url, &crashrep_path ); + rtl_uString2String( + &crashrep_path_system, + rtl_uString_getStr( crashrep_path ), + rtl_uString_getLength( crashrep_path ), + osl_getThreadTextEncoding(), + RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR | RTL_UNICODETOTEXT_FLAGS_INVALID_ERROR ); + + rtl_uString_release( crashrep_url ); + rtl_uString_release( crashrep_path ); + + snprintf( szShellCmd, sizeof(szShellCmd)/sizeof(szShellCmd[0]), + "%s -p %d -s %d -xml %s -chksum %s -stack %s%s", + rtl_string_getStr( crashrep_path_system ), + getpid(), + Signal, + pXMLTempName, + pChecksumTempName, + pStackTempName, + bAutoCrashReport ? " -noui -send" : " -noui" ); + + rtl_string_release( crashrep_path_system ); + + printf( "%s\n", szShellCmd ); + } #elif defined ( SOLARIS ) if ( pXMLTempName && pChecksumTempName ) snprintf( szShellCmd, sizeof(szShellCmd)/sizeof(szShellCmd[0]), @@ -679,14 +725,14 @@ static int ReportCrash( int Signal ) static void PrintStack( int sig ) { -#ifndef MACOSX +#if ! defined(MACOSX) || defined(INCLUDE_BACKTRACE) void *buffer[MAX_STACK_FRAMES]; int size = backtrace( buffer, sizeof(buffer) / sizeof(buffer[0]) ); #endif fprintf( stderr, "\n\nFatal exception: Signal %d\n", sig ); -#ifdef MACOSX +#if defined(MACOSX) && ! defined(INCLUDE_BACKTRACE) fprintf( stderr, "Please turn on Enable Crash Reporting and\nAutomatic Display of Crashlogs in the Console application\n" ); #else if ( size > 0 ) |