mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-18 10:21:03 +03:00
Improved support for OSTRACE on Windows.
FossilOrigin-Name: ca43812bde499a23244e2860d3ceddc97d29f09e
This commit is contained in:
14
src/main.c
14
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)
|
||||
#if defined(SQLITE_NEED_ERR_NAME)
|
||||
const char *sqlite3ErrName(int rc){
|
||||
const char *zName = 0;
|
||||
int i, origRc = rc;
|
||||
|
||||
@@ -29,16 +29,6 @@
|
||||
# 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;
|
||||
# define OSTRACE(X) if( sqlite3OSTrace ) sqlite3DebugPrintf X
|
||||
#else
|
||||
# define OSTRACE(X)
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Macros for performance tracing. Normally turned off. Only works
|
||||
** on i486 hardware.
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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++;
|
||||
|
||||
@@ -1059,7 +1059,7 @@ void sqlite3_log(int iErrCode, const char *zFormat, ...){
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(SQLITE_DEBUG)
|
||||
#if defined(SQLITE_DEBUG) || defined(SQLITE_HAVE_OS_TRACE)
|
||||
/*
|
||||
** A version of printf() that understands %lld. Used for debugging.
|
||||
** The printf() built into some versions of windows does not understand %lld
|
||||
|
||||
@@ -362,6 +362,32 @@
|
||||
# define NEVER(X) (X)
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Declarations used for tracing the operating system interfaces.
|
||||
*/
|
||||
#if defined(SQLITE_FORCE_OS_TRACE) || defined(SQLITE_TEST) || \
|
||||
(defined(SQLITE_DEBUG) && SQLITE_OS_WIN)
|
||||
extern int sqlite3OSTrace;
|
||||
# define OSTRACE(X) if( sqlite3OSTrace ) sqlite3DebugPrintf X
|
||||
# define SQLITE_HAVE_OS_TRACE
|
||||
#else
|
||||
# define OSTRACE(X)
|
||||
# undef SQLITE_HAVE_OS_TRACE
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Is the sqlite3ErrName() function needed in the build? Currently,
|
||||
** it is needed by "mutex_w32.c" (when debugging), "os_win.c" (when
|
||||
** OSTRACE is enabled), and by several "test*.c" files (which are
|
||||
** compiled using SQLITE_TEST).
|
||||
*/
|
||||
#if defined(SQLITE_HAVE_OS_TRACE) || defined(SQLITE_TEST) || \
|
||||
(defined(SQLITE_DEBUG) && SQLITE_OS_WIN)
|
||||
# define SQLITE_NEED_ERR_NAME
|
||||
#else
|
||||
# undef SQLITE_NEED_ERR_NAME
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Return true (non-zero) if the input is an integer that is too large
|
||||
** to fit in 32-bits. This macro is used inside of various testcase()
|
||||
@@ -3153,7 +3179,7 @@ void sqlite3XPrintf(StrAccum*, u32, const char*, ...);
|
||||
char *sqlite3MPrintf(sqlite3*,const char*, ...);
|
||||
char *sqlite3VMPrintf(sqlite3*,const char*, va_list);
|
||||
char *sqlite3MAppendf(sqlite3*,char*,const char*,...);
|
||||
#if defined(SQLITE_TEST) || defined(SQLITE_DEBUG)
|
||||
#if defined(SQLITE_DEBUG) || defined(SQLITE_HAVE_OS_TRACE)
|
||||
void sqlite3DebugPrintf(const char*, ...);
|
||||
#endif
|
||||
#if defined(SQLITE_TEST)
|
||||
@@ -3500,7 +3526,7 @@ void *sqlite3HexToBlob(sqlite3*, const char *z, int n);
|
||||
u8 sqlite3HexToInt(int h);
|
||||
int sqlite3TwoPartName(Parse *, Token *, Token *, Token **);
|
||||
|
||||
#if defined(SQLITE_TEST)
|
||||
#if defined(SQLITE_NEED_ERR_NAME)
|
||||
const char *sqlite3ErrName(int);
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user