8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-22 16:43:03 +01:00

Fixed CORE-1558: Help people get core files in case of abort() on BUGCHECK

This commit is contained in:
alexpeshkoff 2007-11-02 15:14:57 +00:00
parent a275b873ed
commit 52c9aca3d4
3 changed files with 34 additions and 1 deletions

View File

@ -482,6 +482,7 @@ AC_CHECK_HEADERS(aio.h)
AC_CHECK_HEADERS(mntent.h mnttab.h sys/mntent.h sys/mnttab.h)
AC_CHECK_HEADERS(sys/ipc.h sys/file.h)
AC_CHECK_HEADERS(socket.h sys/socket.h sys/sockio.h winsock2.h)
AC_CHECK_HEADERS(sys/resource.h)
dnl Check for libraries
@ -569,6 +570,7 @@ if test "$ac_cv_func_getmntent" = "yes"; then
AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)])
fi
AC_CHECK_FUNCS(setrlimit getrlimit)
AC_CHECK_FUNCS(tcgetattr strdup)
AC_CHECK_FUNCS(mkstemp)
AC_CHECK_FUNCS(pthread_keycreate pthread_key_create)

View File

@ -33,6 +33,7 @@
#include <stdarg.h>
#include "gen/iberror.h"
#include "../jrd/iberr.h"
#include <errno.h>
#if ( !defined( REQUESTER) && !defined( SUPERCLIENT))
#include "../jrd/jrd.h"
@ -53,6 +54,10 @@
#include "../common/config/config.h"
#include "../common/utils_proto.h"
#ifdef HAVE_SYS_RESOURCE_H
#include <sys/resource.h>
#endif
using namespace Jrd;
//#define JRD_FAILURE_SPACE 2048
@ -555,7 +560,33 @@ void ERR_punt(void)
tdbb->tdbb_attachment->att_filename.c_str() : "Database unknown in ERR_punt on bugcheck",
tdbb->tdbb_status_vector);
if (Config::getBugcheckAbort())
{
#if defined(UNIX) && defined(HAVE_SETRLIMIT) && defined(HAVE_GETRLIMIT)
// try to force core files creation for DEV_BUILD
struct rlimit core;
if (getrlimit(RLIMIT_CORE, &core) == 0)
{
core.rlim_cur = core.rlim_max;
if (setrlimit(RLIMIT_CORE, &core) != 0)
{
gds__log("setrlimit() failed, errno=%d", errno);
}
}
else
{
gds__log("getrlimit() failed, errno=%d", errno);
}
// we need some writable directory for core file
// on any unix /tmp seems to be the best place
if (chdir("/tmp") != 0)
{
gds__log("chdir(/tmp) failed, errno=%d", errno);
}
#endif
abort();
}
}
Firebird::status_exception::raise(tdbb->tdbb_status_vector);

View File

@ -284,7 +284,7 @@ int CLIB_ROUTINE server_main( int argc, char** argv)
set_signal(SIGUSR2, signal_handler);
#endif
#if defined(UNIX) && defined(DEV_BUILD)
#if defined(UNIX) && defined(DEV_BUILD) && defined(HAVE_SETRLIMIT) && defined(HAVE_GETRLIMIT)
{
// try to force core files creation for DEV_BUILD
struct rlimit core;