diff --git a/configure.in b/configure.in index b8ce18d71fe..453ffaf67e8 100644 --- a/configure.in +++ b/configure.in @@ -1614,19 +1614,15 @@ then # Medium debug. CFLAGS="$DEBUG_CFLAGS $DEBUG_OPTIMIZE_CC -DDBUG_ON -DSAFE_MUTEX $CFLAGS" CXXFLAGS="$DEBUG_CXXFLAGS $DEBUG_OPTIMIZE_CXX -DSAFE_MUTEX $CXXFLAGS" - #NDB_DEFS="-DNDB_RELEASE -DUSE_EMULATED_JAM -DVM_TRACE -DERROR_INSERT -DARRAY_GUARD" - NDB_DEFS="-DNDB_DEBUG -DUSE_EMULATED_JAM -DVM_TRACE -DERROR_INSERT -DARRAY_GUARD" elif test "$with_debug" = "full" then # Full debug. Very slow in some cases CFLAGS="$DEBUG_CFLAGS -DDBUG_ON -DSAFE_MUTEX -DSAFEMALLOC $CFLAGS" CXXFLAGS="$DEBUG_CXXFLAGS -DSAFE_MUTEX -DSAFEMALLOC $CXXFLAGS" - NDB_DEFS="-DNDB_DEBUG -DUSE_EMULATED_JAM -DVM_TRACE -DERROR_INSERT -DARRAY_GUARD" else # Optimized version. No debug CFLAGS="$OPTIMIZE_CFLAGS -DDBUG_OFF $CFLAGS" CXXFLAGS="$OPTIMIZE_CXXFLAGS -DDBUG_OFF $CXXFLAGS" - NDB_DEFS="-DNDB_RELEASE -DUSE_EMULATED_JAM -DNDEBUG" fi # Force static compilation to avoid linking problems/get more speed @@ -2863,7 +2859,19 @@ if test X"$have_ndbcluster" = Xyes then MAKE_BINARY_DISTRIBUTION_OPTIONS="$MAKE_BINARY_DISTRIBUTION_OPTIONS --with-ndbcluster" - CXXFLAGS="$CXXFLAGS \$(NDB_CXXFLAGS)" + if test "$with_debug" = "yes" + then + # Medium debug. + NDB_DEFS="-DVM_TRACE -DERROR_INSERT -DARRAY_GUARD" + CXXFLAGS="$CXXFLAGS \$(NDB_CXXFLAGS) \$(NDB_CXXFLAGS_LOC) \$(NDB_CXXFLAGS_DEBUG_LOC)" + elif test "$with_debug" = "full" + then + NDB_DEFS="-DVM_TRACE -DERROR_INSERT -DARRAY_GUARD" + CXXFLAGS="$CXXFLAGS \$(NDB_CXXFLAGS) \$(NDB_CXXFLAGS_LOC) \$(NDB_CXXFLAGS_DEBUG_LOC)" + else + NDB_DEFS="-DNDEBUG" + CXXFLAGS="$CXXFLAGS \$(NDB_CXXFLAGS) \$(NDB_CXXFLAGS_LOC) \$(NDB_CXXFLAGS_RELEASE_LOC)" + fi fi AC_SUBST([NDB_DEFS]) diff --git a/ndb/src/kernel/blocks/dbdict/Dbdict.cpp b/ndb/src/kernel/blocks/dbdict/Dbdict.cpp index 084f41e4166..2ef9e721e22 100644 --- a/ndb/src/kernel/blocks/dbdict/Dbdict.cpp +++ b/ndb/src/kernel/blocks/dbdict/Dbdict.cpp @@ -111,7 +111,7 @@ Dbdict::execDUMP_STATE_ORD(Signal* signal) { jamEntry(); -#ifdef NDB_DEBUG +#ifdef VM_TRACE if(signal->theData[0] == 1222){ const Uint32 tab = signal->theData[1]; PrepDropTabReq* req = (PrepDropTabReq*)signal->getDataPtr(); diff --git a/ndb/src/kernel/error/ErrorReporter.cpp b/ndb/src/kernel/error/ErrorReporter.cpp index 56627cba46f..20a9dd8a993 100644 --- a/ndb/src/kernel/error/ErrorReporter.cpp +++ b/ndb/src/kernel/error/ErrorReporter.cpp @@ -40,8 +40,8 @@ const char* errorType[] = { static int WriteMessage(ErrorCategory thrdType, int thrdMessageID, const char* thrdProblemData, const char* thrdObjRef, - Uint32 thrdTheEmulatedJamIndex = 0, - Uint8 thrdTheEmulatedJam[] = 0); + Uint32 thrdTheEmulatedJamIndex, + Uint8 thrdTheEmulatedJam[]); static void dumpJam(FILE* jamStream, Uint32 thrdTheEmulatedJamIndex, @@ -157,21 +157,18 @@ ErrorReporter::handleAssert(const char* message, const char* file, int line) { char refMessage[100]; -#ifdef USE_EMULATED_JAM +#ifdef NO_EMULATED_JAM + snprintf(refMessage, 100, "file: %s lineNo: %d", + file, line); +#else const Uint32 blockNumber = theEmulatedJamBlockNumber; const char *blockName = getBlockName(blockNumber); snprintf(refMessage, 100, "%s line: %d (block: %s)", file, line, blockName); - +#endif WriteMessage(assert, ERR_ERROR_PRGERR, message, refMessage, theEmulatedJamIndex, theEmulatedJam); -#else - snprintf(refMessage, 100, "file: %s lineNo: %d", - file, line); - - WriteMessage(assert, ERR_ERROR_PRGERR, message, refMessage); -#endif NdbShutdown(NST_ErrorHandler); } @@ -199,12 +196,8 @@ ErrorReporter::handleError(ErrorCategory type, int messageID, // The value for type is not always set correctly in the calling function. // So, to correct this, we set it set it to the value corresponding to // the function that is called. -#ifdef USE_EMULATED_JAM WriteMessage(type, messageID, problemData, objRef, theEmulatedJamIndex, theEmulatedJam); -#else - WriteMessage(type, messageID, problemData, objRef); -#endif if(messageID == ERR_ERROR_INSERT){ NdbShutdown(NST_ErrorInsert); } else { @@ -212,9 +205,6 @@ ErrorReporter::handleError(ErrorCategory type, int messageID, } } -// This is the function to write the error-message, -// when the USE_EMULATED_JAM-flag is set -// during compilation. int WriteMessage(ErrorCategory thrdType, int thrdMessageID, const char* thrdProblemData, const char* thrdObjRef, @@ -302,9 +292,7 @@ WriteMessage(ErrorCategory thrdType, int thrdMessageID, // ...and "dump the jam" there. // ErrorReporter::dumpJam(jamStream); if(thrdTheEmulatedJam != 0){ -#ifdef USE_EMULATED_JAM dumpJam(jamStream, thrdTheEmulatedJamIndex, thrdTheEmulatedJam); -#endif } /* Dont print the jobBuffers until a way to copy them, @@ -325,7 +313,7 @@ void dumpJam(FILE *jamStream, Uint32 thrdTheEmulatedJamIndex, Uint8 thrdTheEmulatedJam[]) { -#ifdef USE_EMULATED_JAM +#ifndef NO_EMULATED_JAM // print header const int maxaddr = 8; fprintf(jamStream, "JAM CONTENTS up->down left->right ?=not block entry\n"); @@ -392,5 +380,5 @@ dumpJam(FILE *jamStream, } fprintf(jamStream, "\n"); fflush(jamStream); -#endif // USE_EMULATED_JAM +#endif // ifndef NO_EMULATED_JAM } diff --git a/ndb/src/kernel/error/ErrorReporter.hpp b/ndb/src/kernel/error/ErrorReporter.hpp index 20340a9602f..b43b30f1873 100644 --- a/ndb/src/kernel/error/ErrorReporter.hpp +++ b/ndb/src/kernel/error/ErrorReporter.hpp @@ -37,21 +37,13 @@ ErrorReporter::handleThreadAssert(message, __FILE__, __LINE__); } #ifdef NDEBUG - #define NDB_ASSERT(trueToContinue, message) -#define THREAD_ASSERT(trueToContinue, message) - #else - #define NDB_ASSERT(trueToContinue, message) \ if ( !(trueToContinue) ) { \ ErrorReporter::handleAssert(message, __FILE__, __LINE__); } - -#define THREAD_ASSERT(trueToContinue, message) \ - if ( !(trueToContinue) ) { \ - ErrorReporter::handleThreadAssert(message, __FILE__, __LINE__); } - #endif + // Description: // This macro is used to report programming errors. // Parameters: diff --git a/ndb/src/kernel/vm/Emulator.cpp b/ndb/src/kernel/vm/Emulator.cpp index 0d6d3f55acb..b615e41eb65 100644 --- a/ndb/src/kernel/vm/Emulator.cpp +++ b/ndb/src/kernel/vm/Emulator.cpp @@ -43,11 +43,11 @@ extern "C" { * Declare the global variables */ -#ifdef USE_EMULATED_JAM - Uint8 theEmulatedJam[EMULATED_JAM_SIZE * 4]; - Uint32 theEmulatedJamIndex = 0; - Uint32 theEmulatedJamBlockNumber = 0; -#endif // USE_EMULATED_JAM +#ifndef NO_EMULATED_JAM +Uint8 theEmulatedJam[EMULATED_JAM_SIZE * 4]; +Uint32 theEmulatedJamIndex = 0; +Uint32 theEmulatedJamBlockNumber = 0; +#endif GlobalData globalData; diff --git a/ndb/src/kernel/vm/Emulator.hpp b/ndb/src/kernel/vm/Emulator.hpp index ba533eb873d..8c4504b9ba7 100644 --- a/ndb/src/kernel/vm/Emulator.hpp +++ b/ndb/src/kernel/vm/Emulator.hpp @@ -36,15 +36,18 @@ extern struct GlobalData globalData; extern class SignalLoggerManager globalSignalLoggers; #endif -#ifdef USE_EMULATED_JAM -#define EMULATED_JAM_SIZE 1024 -#define JAM_MASK ((EMULATED_JAM_SIZE * 4) - 1) +#ifndef NO_EMULATED_JAM + #define EMULATED_JAM_SIZE 1024 + #define JAM_MASK ((EMULATED_JAM_SIZE * 4) - 1) -extern Uint8 theEmulatedJam[]; -extern Uint32 theEmulatedJamIndex; -// last block entry, used in dumpJam() if jam contains no block entries -extern Uint32 theEmulatedJamBlockNumber; -#endif // USE_EMULATED_JAM + extern Uint8 theEmulatedJam[]; + extern Uint32 theEmulatedJamIndex; + // last block entry, used in dumpJam() if jam contains no block entries + extern Uint32 theEmulatedJamBlockNumber; +#else + const Uint8 theEmulatedJam[]=0; + const Uint32 theEmulatedJamIndex=0; +#endif struct EmulatorData { class Configuration * theConfiguration; diff --git a/ndb/src/kernel/vm/pc.hpp b/ndb/src/kernel/vm/pc.hpp index 849799a47f3..bc74adfc8f6 100644 --- a/ndb/src/kernel/vm/pc.hpp +++ b/ndb/src/kernel/vm/pc.hpp @@ -22,8 +22,14 @@ #include #include -#ifdef USE_EMULATED_JAM +#ifdef NO_EMULATED_JAM +#define jam() +#define jamLine(line) +#define jamEntry() +#define jamEntryLine(line) + +#else #ifdef NDB_WIN32 #define jam() { \ @@ -72,11 +78,6 @@ #endif -#else -#define jam() -#define jamLine(line) -#define jamEntry() -#define jamEntryLine(line) #endif #ifndef NDB_OPT #define ptrCheck(ptr, limit, rec) if (ptr.i < (limit)) ptr.p = &rec[ptr.i]; else ptr.p = NULL @@ -184,7 +185,7 @@ * * NOTE these may only be used within blocks */ -#if defined VM_TRACE || defined NDB_DEBUG +#if defined VM_TRACE #define ndbassert(check) \ if((check)){ \ } else { \ diff --git a/ndb/src/ndbapi/Makefile.am b/ndb/src/ndbapi/Makefile.am index 9e2c97db3b5..79f5ce5fdf0 100644 --- a/ndb/src/ndbapi/Makefile.am +++ b/ndb/src/ndbapi/Makefile.am @@ -41,6 +41,9 @@ libndbapi_la_SOURCES = \ INCLUDES_LOC = -I$(top_srcdir)/ndb/src/mgmapi +# Ndbapi cannot handle -O3 +NDB_CXXFLAGS_RELEASE_LOC = -O2 + include $(top_srcdir)/ndb/config/common.mk.am include $(top_srcdir)/ndb/config/type_ndbapi.mk.am