diff --git a/CMakeLists.txt b/CMakeLists.txt index 03cf42f49..19979e1bf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -93,12 +93,12 @@ if(PROFILE) endif() set(CMAKE_C_FLAGS "${FLAGS}") -set(CMAKE_C_FLAGS_DEBUG "${DEBUG_FLAGS} -DSS_DEBUG") +set(CMAKE_C_FLAGS_DEBUG "${DEBUG_FLAGS} -DSS_DEBUG -DLOG_ASSERT") set(CMAKE_C_FLAGS_RELEASE "") set(CMAKE_C_FLAGS_RELWITHDEBINFO "-ggdb") set(CMAKE_CXX_FLAGS "${FLAGS}") -set(CMAKE_CXX_FLAGS_DEBUG "${DEBUG_FLAGS} -DSS_DEBUG") +set(CMAKE_CXX_FLAGS_DEBUG "${DEBUG_FLAGS} -DSS_DEBUG -DLOG_ASSERT") set(CMAKE_CXX_FLAGS_RELEASE "") set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-ggdb") diff --git a/server/core/CMakeLists.txt b/server/core/CMakeLists.txt index db5e79e8c..4a9828ea3 100644 --- a/server/core/CMakeLists.txt +++ b/server/core/CMakeLists.txt @@ -5,7 +5,7 @@ if(BUILD_TESTS OR BUILD_TOOLS) elseif(WITH_TCMALLOC) target_link_libraries(fullcore ${TCMALLOC_LIBRARIES}) endif() - target_link_libraries(fullcore ${CURL_LIBRARIES} log_manager utils pthread ${EMBEDDED_LIB} ${PCRE_LINK_FLAGS} ssl aio rt crypt dl crypto inih z m stdc++) + target_link_libraries(fullcore ${CURL_LIBRARIES} utils log_manager pthread ${EMBEDDED_LIB} ${PCRE_LINK_FLAGS} ssl aio rt crypt dl crypto inih z m stdc++) endif() add_executable(maxscale atomic.c buffer.c spinlock.c gateway.c diff --git a/server/core/test/CMakeLists.txt b/server/core/test/CMakeLists.txt index 626a75f3e..82e58919f 100644 --- a/server/core/test/CMakeLists.txt +++ b/server/core/test/CMakeLists.txt @@ -15,11 +15,11 @@ add_executable(test_adminusers testadminusers.c) add_executable(testmemlog testmemlog.c) add_executable(testfeedback testfeedback.c) target_link_libraries(test_mysql_users MySQLClient fullcore) -target_link_libraries(test_hash fullcore) -target_link_libraries(test_hint fullcore) -target_link_libraries(test_spinlock fullcore) +target_link_libraries(test_hash fullcore log_manager) +target_link_libraries(test_hint fullcore log_manager) +target_link_libraries(test_spinlock fullcore log_manager) target_link_libraries(test_filter fullcore) -target_link_libraries(test_buffer fullcore) +target_link_libraries(test_buffer fullcore log_manager) target_link_libraries(test_dcb fullcore) target_link_libraries(test_modutil fullcore) target_link_libraries(test_poll fullcore) @@ -27,7 +27,7 @@ target_link_libraries(test_service fullcore) target_link_libraries(test_server fullcore) target_link_libraries(test_users fullcore) target_link_libraries(test_adminusers fullcore) -target_link_libraries(testmemlog fullcore) +target_link_libraries(testmemlog fullcore log_manager) target_link_libraries(testfeedback fullcore) add_test(Internal-TestMySQLUsers test_mysql_users) add_test(Internal-TestHash test_hash) diff --git a/server/modules/filter/dbfwfilter.c b/server/modules/filter/dbfwfilter.c index 255eb6aba..607a749c2 100644 --- a/server/modules/filter/dbfwfilter.c +++ b/server/modules/filter/dbfwfilter.c @@ -464,9 +464,9 @@ bool check_time(char* str) #ifdef SS_DEBUG -#define CHK_TIMES(t)(ss_dassert(t->tm_sec > -1 && t->tm_sec < 62 \ +#define CHK_TIMES(t) ss_dassert(t->tm_sec > -1 && t->tm_sec < 62 \ && t->tm_min > -1 && t->tm_min < 60 \ - && t->tm_hour > -1 && t->tm_hour < 24)) + && t->tm_hour > -1 && t->tm_hour < 24) #else #define CHK_TIMES(t) #endif diff --git a/server/modules/routing/readwritesplit/readwritesplit.c b/server/modules/routing/readwritesplit/readwritesplit.c index b36b02753..3739eb054 100644 --- a/server/modules/routing/readwritesplit/readwritesplit.c +++ b/server/modules/routing/readwritesplit/readwritesplit.c @@ -1883,7 +1883,6 @@ static int routeQuery( bool succp = false; CHK_CLIENT_RSES(router_cli_ses); - /** * GWBUF is called "type undefined" when the incoming data isn't parsed * and MySQL packets haven't been extracted to separate buffers. @@ -3716,13 +3715,11 @@ static GWBUF* sescmd_cursor_process_replies( mysql_sescmd_t* scmd; sescmd_cursor_t* scur; ROUTER_CLIENT_SES* ses; - ROUTER_INSTANCE* router; scur = &bref->bref_sescmd_cur; ss_dassert(SPINLOCK_IS_LOCKED(&(scur->scmd_cur_rses->rses_lock))); scmd = sescmd_cursor_get_command(scur); ses = (*scur->scmd_cur_ptr_property)->rses_prop_rsession; - router = ses->router; CHK_GWBUF(replybuf); /** diff --git a/utils/CMakeLists.txt b/utils/CMakeLists.txt index 8a2cfddb6..32e680221 100644 --- a/utils/CMakeLists.txt +++ b/utils/CMakeLists.txt @@ -1,2 +1,3 @@ add_library(utils skygw_utils.cc) -target_link_libraries(utils stdc++) \ No newline at end of file +add_dependencies(utils log_manager) +target_link_libraries(utils stdc++ log_manager) diff --git a/utils/skygw_debug.h b/utils/skygw_debug.h index fec894f70..89f7a4e00 100644 --- a/utils/skygw_debug.h +++ b/utils/skygw_debug.h @@ -50,7 +50,21 @@ # define ss_prof(exp) #endif /* SS_DEBUG || SS_PROF */ -#if defined(SS_DEBUG) +#if defined(SS_DEBUG) && defined(LOG_ASSERT) +#include +# define ss_dassert(exp) if(!(exp)){(skygw_log_write(LE,\ + "debug assert %s:%d\n", \ + (char*)__FILE__, \ + __LINE__));skygw_log_sync_all();assert(exp);} +#define ss_info_dassert(exp,info) if(!(exp)){(skygw_log_write(LE,\ + "debug assert %s:%d %s\n", \ + (char*)__FILE__, \ + __LINE__,info));skygw_log_sync_all();assert(exp);} +# define ss_debug(exp) exp +# define ss_dfprintf fprintf +# define ss_dfflush fflush +# define ss_dfwrite fwrite +#elif defined(SS_DEBUG) # define ss_debug(exp) exp # define ss_dfprintf fprintf