aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main.c14
-rw-r--r--src/os_common.h13
-rw-r--r--src/os_unix.c2
-rw-r--r--src/os_win.c8
-rw-r--r--src/sqliteInt.h2
5 files changed, 27 insertions, 12 deletions
diff --git a/src/main.c b/src/main.c
index d9ee77fab..043f3e14d 100644
--- a/src/main.c
+++ b/src/main.c
@@ -55,6 +55,18 @@ int sqlite3_libversion_number(void){ return SQLITE_VERSION_NUMBER; }
*/
int sqlite3_threadsafe(void){ return SQLITE_THREADSAFE; }
+/*
+** When compiling the test fixture or with debugging enabled (on Win32),
+** this variable being set to non-zero will cause OSTRACE macros to emit
+** extra diagnostic information.
+*/
+#ifdef SQLITE_HAVE_OS_TRACE
+# ifndef SQLITE_DEBUG_OS_TRACE
+# define SQLITE_DEBUG_OS_TRACE 0
+# endif
+ int sqlite3OSTrace = SQLITE_DEBUG_OS_TRACE;
+#endif
+
#if !defined(SQLITE_OMIT_TRACE) && defined(SQLITE_ENABLE_IOTRACE)
/*
** If the following function pointer is not NULL and if
@@ -1194,7 +1206,7 @@ void sqlite3RollbackAll(sqlite3 *db, int tripCode){
** Return a static string containing the name corresponding to the error code
** specified in the argument.
*/
-#if (defined(SQLITE_DEBUG) && SQLITE_OS_WIN) || defined(SQLITE_TEST)
+#ifdef SQLITE_HAVE_OS_TRACE
const char *sqlite3ErrName(int rc){
const char *zName = 0;
int i, origRc = rc;
diff --git a/src/os_common.h b/src/os_common.h
index f6c3e7ff8..837f94714 100644
--- a/src/os_common.h
+++ b/src/os_common.h
@@ -29,13 +29,16 @@
# error "The MEMORY_DEBUG macro is obsolete. Use SQLITE_DEBUG instead."
#endif
-#if defined(SQLITE_TEST) && defined(SQLITE_DEBUG)
-# ifndef SQLITE_DEBUG_OS_TRACE
-# define SQLITE_DEBUG_OS_TRACE 0
-# endif
- int sqlite3OSTrace = SQLITE_DEBUG_OS_TRACE;
+/*
+** Declarations used for tracing the operating system interfaces.
+*/
+#if (defined(SQLITE_DEBUG) && SQLITE_OS_WIN) || \
+ defined(SQLITE_TEST) || defined(SQLITE_FORCE_OS_TRACE)
+ extern int sqlite3OSTrace;
# define OSTRACE(X) if( sqlite3OSTrace ) sqlite3DebugPrintf X
+# define SQLITE_HAVE_OS_TRACE
#else
+# undef SQLITE_HAVE_OS_TRACE
# define OSTRACE(X)
#endif
diff --git a/src/os_unix.c b/src/os_unix.c
index 188c02533..93657f689 100644
--- a/src/os_unix.c
+++ b/src/os_unix.c
@@ -641,7 +641,7 @@ static int unixMutexHeld(void) {
#endif
-#if defined(SQLITE_TEST) && defined(SQLITE_DEBUG)
+#ifdef SQLITE_HAVE_OS_TRACE
/*
** Helper function for printing out trace information from debugging
** binaries. This returns the string representation of the supplied
diff --git a/src/os_win.c b/src/os_win.c
index ef2f553f3..3a8c4cbdb 100644
--- a/src/os_win.c
+++ b/src/os_win.c
@@ -2757,7 +2757,7 @@ static int winSync(sqlite3_file *id, int flags){
BOOL rc;
#endif
#if !defined(NDEBUG) || !defined(SQLITE_NO_SYNC) || \
- (defined(SQLITE_TEST) && defined(SQLITE_DEBUG))
+ defined(SQLITE_HAVE_OS_TRACE)
/*
** Used when SQLITE_NO_SYNC is not defined and by the assert() and/or
** OSTRACE() macros.
@@ -3434,7 +3434,7 @@ struct winShmNode {
int nRef; /* Number of winShm objects pointing to this */
winShm *pFirst; /* All winShm objects pointing to this */
winShmNode *pNext; /* Next in list of all winShmNode objects */
-#ifdef SQLITE_DEBUG
+#if defined(SQLITE_DEBUG) || defined(SQLITE_HAVE_OS_TRACE)
u8 nextShmId; /* Next available winShm.id value */
#endif
};
@@ -3465,7 +3465,7 @@ struct winShm {
u8 hasMutex; /* True if holding the winShmNode mutex */
u16 sharedMask; /* Mask of shared locks held */
u16 exclMask; /* Mask of exclusive locks held */
-#ifdef SQLITE_DEBUG
+#if defined(SQLITE_DEBUG) || defined(SQLITE_HAVE_OS_TRACE)
u8 id; /* Id of this connection with its winShmNode */
#endif
};
@@ -3656,7 +3656,7 @@ static int winOpenSharedMemory(winFile *pDbFd){
/* Make the new connection a child of the winShmNode */
p->pShmNode = pShmNode;
-#ifdef SQLITE_DEBUG
+#if defined(SQLITE_DEBUG) || defined(SQLITE_HAVE_OS_TRACE)
p->id = pShmNode->nextShmId++;
#endif
pShmNode->nRef++;
diff --git a/src/sqliteInt.h b/src/sqliteInt.h
index ee2434291..e22da91e5 100644
--- a/src/sqliteInt.h
+++ b/src/sqliteInt.h
@@ -3493,7 +3493,7 @@ void *sqlite3HexToBlob(sqlite3*, const char *z, int n);
u8 sqlite3HexToInt(int h);
int sqlite3TwoPartName(Parse *, Token *, Token *, Token **);
-#if defined(SQLITE_TEST)
+#ifdef SQLITE_HAVE_OS_TRACE
const char *sqlite3ErrName(int);
#endif