summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2011-09-28 15:08:45 +0200
committerStephan Bergmann <sbergman@redhat.com>2011-09-28 15:24:52 +0200
commit01e0b770a5ce58de44283465ba51b03a1ee0db0c (patch)
tree9ab1aa902f92926c92c8b11043d89e838de60c92
parentf973e25a927d458fe98689b8e356547c0a327a53 (diff)
Let SalAbort dump core on developer builds.
-rw-r--r--vcl/aqua/source/app/salinst.cxx7
-rw-r--r--vcl/inc/salinst.hxx2
-rw-r--r--vcl/ios/source/app/salinst.cxx7
-rw-r--r--vcl/source/app/svapp.cxx14
-rw-r--r--vcl/unx/generic/plugadapt/salplug.cxx7
-rw-r--r--vcl/win/source/app/salinst.cxx2
6 files changed, 30 insertions, 9 deletions
diff --git a/vcl/aqua/source/app/salinst.cxx b/vcl/aqua/source/app/salinst.cxx
index df0d95c12f1d..489b1dd8a6b2 100644
--- a/vcl/aqua/source/app/salinst.cxx
+++ b/vcl/aqua/source/app/salinst.cxx
@@ -258,14 +258,17 @@ sal_Bool ImplSVMainHook( int * pnInit )
// =======================================================================
-void SalAbort( const XubString& rErrorText )
+void SalAbort( const XubString& rErrorText, bool bDumpCore )
{
if( !rErrorText.Len() )
fprintf( stderr, "Application Error " );
else
fprintf( stderr, "%s ",
ByteString( rErrorText, gsl_getSystemTextEncoding() ).GetBuffer() );
- abort();
+ if( bDumpCore )
+ abort();
+ else
+ _exit(1);
}
// -----------------------------------------------------------------------
diff --git a/vcl/inc/salinst.hxx b/vcl/inc/salinst.hxx
index d878dd7fea80..194e61ac0cf5 100644
--- a/vcl/inc/salinst.hxx
+++ b/vcl/inc/salinst.hxx
@@ -181,7 +181,7 @@ void DestroySalInstance( SalInstance* pInst );
// - SalInstance-Functions -
// -------------------------
-void SalAbort( const XubString& rErrorText );
+void SalAbort( const XubString& rErrorText, bool bDumpCore );
VCL_PLUGIN_PUBLIC const ::rtl::OUString& SalGetDesktopEnvironment();
diff --git a/vcl/ios/source/app/salinst.cxx b/vcl/ios/source/app/salinst.cxx
index fb5bfb9aa662..f7c96853bc0d 100644
--- a/vcl/ios/source/app/salinst.cxx
+++ b/vcl/ios/source/app/salinst.cxx
@@ -142,14 +142,17 @@ sal_Bool ImplSVMainHook( int * pnInit )
// =======================================================================
-void SalAbort( const XubString& rErrorText )
+void SalAbort( const XubString& rErrorText, bool bDumpCore )
{
if( !rErrorText.Len() )
fprintf( stderr, "Application Error " );
else
fprintf( stderr, "%s ",
ByteString( rErrorText, gsl_getSystemTextEncoding() ).GetBuffer() );
- abort();
+ if( bDumpCore )
+ abort();
+ else
+ _exit(1);
}
// -----------------------------------------------------------------------
diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx
index f426c112782e..b41f9267c346 100644
--- a/vcl/source/app/svapp.cxx
+++ b/vcl/source/app/svapp.cxx
@@ -393,7 +393,19 @@ sal_uInt16 Application::Exception( sal_uInt16 nError )
void Application::Abort( const XubString& rErrorText )
{
- SalAbort( rErrorText );
+ //HACK: Dump core iff --norestore command line argument is given (assuming
+ // this process is run by developers who are interested in cores, vs. end
+ // users who are not):
+ bool dumpCore = false;
+ sal_uInt16 n = GetCommandLineParamCount();
+ for (sal_uInt16 i = 0; i != n; ++i) {
+ if (GetCommandLineParam(i).EqualsAscii("--norestore")) {
+ dumpCore = true;
+ break;
+ }
+ }
+
+ SalAbort( rErrorText, dumpCore );
}
// -----------------------------------------------------------------------
diff --git a/vcl/unx/generic/plugadapt/salplug.cxx b/vcl/unx/generic/plugadapt/salplug.cxx
index 51321b8c47ef..d707760eb5df 100644
--- a/vcl/unx/generic/plugadapt/salplug.cxx
+++ b/vcl/unx/generic/plugadapt/salplug.cxx
@@ -267,13 +267,16 @@ void DeInitSalMain()
{
}
-void SalAbort( const XubString& rErrorText )
+void SalAbort( const XubString& rErrorText, bool bDumpCore )
{
if( !rErrorText.Len() )
std::fprintf( stderr, "Application Error\n" );
else
std::fprintf( stderr, "%s\n", rtl::OUStringToOString(rErrorText, osl_getThreadTextEncoding()).getStr() );
- exit(-1);
+ if( bDumpCore )
+ abort();
+ else
+ _exit(1);
}
static const char * desktop_strings[] = { "none", "unknown", "GNOME", "KDE", "KDE4" };
diff --git a/vcl/win/source/app/salinst.cxx b/vcl/win/source/app/salinst.cxx
index 5e8930f4155f..a0d41a6165a8 100644
--- a/vcl/win/source/app/salinst.cxx
+++ b/vcl/win/source/app/salinst.cxx
@@ -84,7 +84,7 @@
// =======================================================================
-void SalAbort( const XubString& rErrorText )
+void SalAbort( const XubString& rErrorText, bool )
{
ImplFreeSalGDI();