From b527930a90d0804a151045f39db81d8a1f8a1898 Mon Sep 17 00:00:00 2001 From: Rom Walton Date: Mon, 3 May 2004 21:01:49 +0000 Subject: [PATCH] *** empty log message *** svn path=/trunk/boinc/; revision=3315 --- checkin_notes | 12 +++++++++++ lib/diagnostics.C | 6 +++--- lib/exception.C | 6 +++--- lib/exception.h | 53 ++++++++++++++++++++++++++++++++++++----------- 4 files changed, 59 insertions(+), 18 deletions(-) diff --git a/checkin_notes b/checkin_notes index c09ff3b128..d8d451e4e4 100755 --- a/checkin_notes +++ b/checkin_notes @@ -11965,3 +11965,15 @@ David May 3 2004 sched/ *.C start + +Rom May 3 2004 + - Try to cleanup a recursive failure during a dump to stderr by changing + the fprintf call in diagnostics.c + - Apparently exceptions don’t walk up the inheritance tree when calling + virtual functions, so force the issue by locally scoping additional + variables that can be set by constructors which will allow base functions + to get the correct information. + + lib/ + diagnostics.c + exception.c, .h diff --git a/lib/diagnostics.C b/lib/diagnostics.C index 5bde646941..1723d5b82e 100644 --- a/lib/diagnostics.C +++ b/lib/diagnostics.C @@ -193,7 +193,7 @@ LONG CALLBACK boinc_catch_signal(EXCEPTION_POINTERS *pExPtrs) { // //if (flags & BOINC_DIAG_MEMORYLEAKCHECKENABLED ) - // SET_CRT_DEBUG_FIELD( _CRTDBG_LEAK_CHECK_DF ); + // CLEAR_CRT_DEBUG_FIELD( _CRTDBG_LEAK_CHECK_DF ); if (flags & BOINC_DIAG_HEAPCHECKENABLED ) { AfxEnableMemoryTracking(FALSE); @@ -350,12 +350,12 @@ int __cdecl boinc_message_reporting( int reportType, char *szMsg, int *retVal ){ OutputDebugString(szMsg); // Reports string to the debugger output window if (flags & BOINC_DIAG_TRACETOSTDERR ) { - fprintf( stderr, "%s", szMsg ); + fprintf( stderr, szMsg ); fflush( stderr ); } if (flags & BOINC_DIAG_TRACETOSTDOUT ) { - fprintf( stdout, "%s", szMsg ); + fprintf( stdout, szMsg ); fflush( stdout ); } diff --git a/lib/exception.C b/lib/exception.C index 11714ea621..fc66f0c52a 100644 --- a/lib/exception.C +++ b/lib/exception.C @@ -48,13 +48,13 @@ const char * boinc_base_exception::what() { m_strErrorBuffer.empty(); memset(m_szConversionBuffer, '\0', sizeof(m_szConversionBuffer)); - snprintf(m_szConversionBuffer, sizeof(m_szConversionBuffer), "%ld", ErrorValue()); + snprintf(m_szConversionBuffer, sizeof(m_szConversionBuffer), "%ld", m_lErrorValue); - m_strErrorBuffer.append(ErrorType()); + m_strErrorBuffer.append(m_strErrorType); m_strErrorBuffer.append(" "); m_strErrorBuffer.append(m_szConversionBuffer); m_strErrorBuffer.append(" "); - m_strErrorBuffer.append(ErrorMessage()); + m_strErrorBuffer.append(m_strErrorMessage); m_strErrorBuffer.append("\n"); diff --git a/lib/exception.h b/lib/exception.h index e56616a633..a062acf012 100644 --- a/lib/exception.h +++ b/lib/exception.h @@ -40,6 +40,9 @@ private: string m_strErrorBuffer; // the formatted error message when // asked + string m_strErrorType; // the error type + long m_lErrorValue; // the error value + string m_strErrorMessage; // the error message string m_strErrorData; // any relevant data associated with // the error string m_strFilename; // the file in which the error occurred @@ -49,10 +52,16 @@ private: public: boinc_base_exception(const char *s=0) - : m_strErrorData(s){}; + : m_strErrorType(ErrorType()), m_lErrorValue(ErrorValue()), m_strErrorMessage(ErrorMessage()), m_strErrorData(s){}; boinc_base_exception(const char *f, int l, const char *s=0) - : m_strErrorData(s), m_strFilename(f), m_lLineNumber(l){}; + : m_strErrorType(ErrorType()), m_lErrorValue(ErrorValue()), m_strErrorMessage(ErrorMessage()), m_strErrorData(s), m_strFilename(f), m_lLineNumber(l){}; + + boinc_base_exception(const char *et, long ev, const char *em, const char *s=0) + : m_strErrorType(et), m_lErrorValue(ev), m_strErrorMessage(em), m_strErrorData(s){}; + + boinc_base_exception(const char *et, long ev, const char *em, const char *f, int l, const char *s=0) + : m_strErrorType(et), m_lErrorValue(ev), m_strErrorMessage(em), m_strErrorData(s), m_strFilename(f), m_lLineNumber(l){}; ~boinc_base_exception() throw () {}; @@ -72,9 +81,13 @@ class boinc_runtime_base_exception : public boinc_base_exception public: boinc_runtime_base_exception(const char *s=0) - : boinc_base_exception(s){} + : boinc_base_exception(ErrorType(), ErrorValue(), ErrorMessage(), s){}; boinc_runtime_base_exception(const char *f, int l, const char *s=0) - : boinc_base_exception(f, l, s){} + : boinc_base_exception(ErrorType(), ErrorValue(), ErrorMessage(), f, l, s){}; + boinc_runtime_base_exception(const char *et, long ev, const char *em, const char *s=0) + : boinc_base_exception(et, ev, em, s){}; + boinc_runtime_base_exception(const char *et, long ev, const char *em, const char *f, int l, const char *s=0) + : boinc_base_exception(et, ev, em, f, l, s){}; ~boinc_runtime_base_exception() throw () {}; @@ -90,9 +103,13 @@ class boinc_out_of_memory_exception : public boinc_runtime_base_exception { public: boinc_out_of_memory_exception(const char *s=0) - : boinc_runtime_base_exception(s){} + : boinc_runtime_base_exception(ErrorType(), ErrorValue(), ErrorMessage(), s){}; boinc_out_of_memory_exception(const char *f, int l, const char *s=0) - : boinc_runtime_base_exception(f, l, s){} + : boinc_runtime_base_exception(ErrorType(), ErrorValue(), ErrorMessage(), f, l, s){}; + boinc_out_of_memory_exception(const char *et, long ev, const char *em, const char *s=0) + : boinc_runtime_base_exception(et, ev, em, s){}; + boinc_out_of_memory_exception(const char *et, long ev, const char *em, const char *f, int l, const char *s=0) + : boinc_runtime_base_exception(et, ev, em, f, l, s){}; ~boinc_out_of_memory_exception() throw () {}; @@ -105,9 +122,13 @@ class boinc_invalid_parameter_exception : public boinc_runtime_base_exception { public: boinc_invalid_parameter_exception(const char *s=0) - : boinc_runtime_base_exception(s){} + : boinc_runtime_base_exception(ErrorType(), ErrorValue(), ErrorMessage(), s){}; boinc_invalid_parameter_exception(const char *f, int l, const char *s=0) - : boinc_runtime_base_exception(f, l, s){} + : boinc_runtime_base_exception(ErrorType(), ErrorValue(), ErrorMessage(), f, l, s){}; + boinc_invalid_parameter_exception(const char *et, long ev, const char *em, const char *s=0) + : boinc_runtime_base_exception(et, ev, em, s){}; + boinc_invalid_parameter_exception(const char *et, long ev, const char *em, const char *f, int l, const char *s=0) + : boinc_runtime_base_exception(et, ev, em, f, l, s){}; ~boinc_invalid_parameter_exception() throw () {}; @@ -120,9 +141,13 @@ class boinc_file_operation_exception : public boinc_runtime_base_exception { public: boinc_file_operation_exception(const char *s=0) - : boinc_runtime_base_exception(s){} + : boinc_runtime_base_exception(ErrorType(), ErrorValue(), ErrorMessage(), s){}; boinc_file_operation_exception(const char *f, int l, const char *s=0) - : boinc_runtime_base_exception(f, l, s){} + : boinc_runtime_base_exception(ErrorType(), ErrorValue(), ErrorMessage(), f, l, s){}; + boinc_file_operation_exception(const char *et, long ev, const char *em, const char *s=0) + : boinc_runtime_base_exception(et, ev, em, s){}; + boinc_file_operation_exception(const char *et, long ev, const char *em, const char *f, int l, const char *s=0) + : boinc_runtime_base_exception(et, ev, em, f, l, s){}; ~boinc_file_operation_exception() throw () {}; @@ -135,9 +160,13 @@ class boinc_signal_operation_exception : public boinc_runtime_base_exception { public: boinc_signal_operation_exception(const char *s=0) - : boinc_runtime_base_exception(s){} + : boinc_runtime_base_exception(ErrorType(), ErrorValue(), ErrorMessage(), s){}; boinc_signal_operation_exception(const char *f, int l, const char *s=0) - : boinc_runtime_base_exception(f, l, s){} + : boinc_runtime_base_exception(ErrorType(), ErrorValue(), ErrorMessage(), f, l, s){}; + boinc_signal_operation_exception(const char *et, long ev, const char *em, const char *s=0) + : boinc_runtime_base_exception(et, ev, em, s){}; + boinc_signal_operation_exception(const char *et, long ev, const char *em, const char *f, int l, const char *s=0) + : boinc_runtime_base_exception(et, ev, em, f, l, s){}; ~boinc_signal_operation_exception() throw () {};