mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-22 20:43:02 +01:00
Add BugcheckAbort option to produce coredumps on BUGCHECKs and structured exceptions
This commit is contained in:
parent
ee89d89ffd
commit
af366d4f5a
@ -245,6 +245,21 @@
|
||||
#MaxUnflushedWriteTime = 5
|
||||
|
||||
|
||||
# ----------------------------
|
||||
#
|
||||
# This option controls whether to call abort() when internal error or BUGCHECK
|
||||
# is encountered thus invoke post-mortem debugger which can dump core suitable
|
||||
# for off-line analysis. When disabled engine tries to minimize damage and
|
||||
# continue execution.
|
||||
#
|
||||
# Note that setting this option to 1 makes POSIX SuperServer engine produce
|
||||
# traceable coredumps when something nasty like SIGSEGV happens inside UDF.
|
||||
#
|
||||
# Type: boolean
|
||||
#
|
||||
#BugcheckAbort = 0
|
||||
|
||||
|
||||
# ----------------------------
|
||||
# Client Connection Settings (Basic)
|
||||
#
|
||||
|
@ -106,6 +106,7 @@ const ConfigImpl::ConfigEntry ConfigImpl::entries[] =
|
||||
{TYPE_STRING, "DatabaseAccess", (ConfigValue) "Full"}, // location(s) of databases
|
||||
{TYPE_STRING, "UdfAccess", (ConfigValue) "Restrict UDF"}, // location(s) of UDFs
|
||||
{TYPE_STRING, "TempDirectories", (ConfigValue) 0},
|
||||
{TYPE_BOOLEAN, "BugcheckAbort", (ConfigValue) false}, // whether to abort() engine when internal error is found
|
||||
{TYPE_INTEGER, "TraceDSQL", (ConfigValue) 0} // bitmask
|
||||
};
|
||||
|
||||
@ -469,6 +470,11 @@ const char *Config::getTempDirectories()
|
||||
return (const char*) sysConfig.values[KEY_TEMP_DIRECTORIES];
|
||||
}
|
||||
|
||||
bool Config::getBugcheckAbort()
|
||||
{
|
||||
return (bool) sysConfig.values[KEY_BUGCHECK_ABORT];
|
||||
}
|
||||
|
||||
int Config::getTraceDSQL()
|
||||
{
|
||||
return (int) sysConfig.values[KEY_TRACE_DSQL];
|
||||
|
@ -103,7 +103,8 @@ class Config
|
||||
KEY_DATABASE_ACCESS, // 38
|
||||
KEY_UDF_ACCESS, // 39
|
||||
KEY_TEMP_DIRECTORIES, // 40
|
||||
KEY_TRACE_DSQL // 41
|
||||
KEY_BUGCHECK_ABORT, // 41
|
||||
KEY_TRACE_DSQL // 42
|
||||
};
|
||||
|
||||
public:
|
||||
@ -317,6 +318,11 @@ public:
|
||||
DSQL trace bitmask
|
||||
*/
|
||||
static int getTraceDSQL();
|
||||
|
||||
/*
|
||||
Abort on BUGCHECK and structured exceptions
|
||||
*/
|
||||
static bool getBugcheckAbort();
|
||||
};
|
||||
|
||||
namespace Firebird {
|
||||
|
@ -35,6 +35,7 @@
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "../common/config/config.h"
|
||||
#include "../jrd/common.h"
|
||||
#include "../jrd/jrd.h"
|
||||
#include "../jrd/y_ref.h"
|
||||
|
@ -51,6 +51,7 @@
|
||||
#include "../jrd/dbg_proto.h"
|
||||
#include "../jrd/err_proto.h"
|
||||
#include "../jrd/gds_proto.h"
|
||||
#include "../common/config/config.h"
|
||||
|
||||
using namespace Jrd;
|
||||
|
||||
@ -498,6 +499,7 @@ void ERR_punt(void)
|
||||
gds__log_status(tdbb->tdbb_attachment->att_filename ?
|
||||
tdbb->tdbb_attachment->att_filename.c_str() : NULL,
|
||||
tdbb->tdbb_status_vector);
|
||||
if (Config::getBugcheckAbort()) abort();
|
||||
}
|
||||
|
||||
Firebird::status_exception::raise(tdbb->tdbb_status_vector);
|
||||
|
@ -30,13 +30,14 @@
|
||||
* 2003.08.10 Claudio Valderrama: Fix SF Bugs #544132 and #728839.
|
||||
*/
|
||||
/*
|
||||
$Id: fun.epp,v 1.45 2004-03-31 18:03:50 alexpeshkoff Exp $
|
||||
$Id: fun.epp,v 1.46 2004-04-06 07:25:45 skidder Exp $
|
||||
*/
|
||||
|
||||
#include "firebird.h"
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "../common/config/config.h"
|
||||
#include "../jrd/common.h"
|
||||
#include "../jrd/jrd.h"
|
||||
#include "../jrd/val.h"
|
||||
|
@ -46,11 +46,13 @@
|
||||
#define START_CHECK_FOR_EXCEPTIONS(err) { \
|
||||
SIGJMP_BUF sigenv; \
|
||||
int sig; \
|
||||
memcpy(&tdbb->tdbb_sigsetjmp, &sigenv, sizeof sigenv); \
|
||||
if (sig = SIGSETJMP (sigenv, 1)) \
|
||||
ISC_exception_post(sig, err); \
|
||||
ISC_sync_signals_set();
|
||||
#define END_CHECK_FOR_EXCEPTIONS(err) ISC_sync_signals_reset(); }
|
||||
if (!Config::getBugcheckAbort()) { \
|
||||
memcpy(&tdbb->tdbb_sigsetjmp, &sigenv, sizeof sigenv); \
|
||||
if (sig = SIGSETJMP (sigenv, 1)) \
|
||||
ISC_exception_post(sig, err); \
|
||||
ISC_sync_signals_set(); \
|
||||
}
|
||||
#define END_CHECK_FOR_EXCEPTIONS(err) if (!Config::getBugcheckAbort()) ISC_sync_signals_reset(); }
|
||||
#endif /* SUPER_SERVER */
|
||||
|
||||
#endif /* UNIX */
|
||||
|
@ -1670,7 +1670,8 @@ ULONG ISC_exception_post(ULONG except_code, const TEXT* err_msg)
|
||||
|
||||
if (is_critical)
|
||||
{
|
||||
exit(3);
|
||||
// Pass exception to outer handler in case debugger is present to collect memory dump
|
||||
return EXCEPTION_CONTINUE_SEARCH;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user