In the debugging output for SHM-LOCK in os_unix.c, use symbolic names

for the lock states rather than raw numbers.

FossilOrigin-Name: 2afc33de2b2012d034fb0d2057a5a45e304516ca
This commit is contained in:
drh 2010-04-30 16:48:19 +00:00
parent 43a56b812c
commit 400df2ea70
3 changed files with 38 additions and 13 deletions

View File

@ -1,5 +1,8 @@
C Fix\sa\sproblem\sin\sthe\sprevious\scommit.\sBoth\sunixShm.lockState\sand\sunixShm.readLock\sshould\sbe\sset\sto\sREAD\swhen\sdowngrading\sfrom\sa\sWRITE\sto\sa\sREAD\slock
D 2010-04-30T16:41:54
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
C In\sthe\sdebugging\soutput\sfor\sSHM-LOCK\sin\sos_unix.c,\suse\ssymbolic\snames\nfor\sthe\slock\sstates\srather\sthan\sraw\snumbers.
D 2010-04-30T16:48:20
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
F Makefile.in d83a0ffef3dcbfb08b410a6c6dd6c009ec9167fb
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@ -150,7 +153,7 @@ F src/os.c 8bc63cf91e9802e2b807198e54e50227fa889306
F src/os.h 534b082c3cb349ad05fa6fa0b06087e022af282c
F src/os_common.h 0d6ee583b6ee3185eb9d951f890c6dd03021a08d
F src/os_os2.c 8ad77a418630d7dee91d1bb04f79c2096301d3a0
F src/os_unix.c 72413d328c45dce9d7d11a8726a660dd501732c7
F src/os_unix.c edbc13a32a6b835b5303a444bd7da9404dc17e58
F src/os_win.c a8fc01d8483be472e495793c01064fd87e56a5c1
F src/pager.c 434f9751fc2dfc11ade004282deda5f8560bcba2
F src/pager.h 934b598583a9d936bb13c37d62a2fe68ac48781c
@ -808,7 +811,14 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
P 55f5af5e174df7a28deeb36faa51138926669897
R 30163f46a964ded4f6fbb73a10520c97
U dan
Z 2d3273731b921855c7e11145f0f666b0
P 90119fecbce06c8db82194dfd9d5045be29b1cda
R ebae94644ba62e3155e25c91f8d6fd85
U drh
Z 02eccc20e834aee25fd2cd7428a6b07d
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
iD8DBQFL2wnXoxKgR168RlERAkXlAJ97RPvDHNYNUAR/6YpO0tH6FowdpgCghlQl
WdLDFQjAGffRMStZhNqyiHA=
=AZcG
-----END PGP SIGNATURE-----

View File

@ -1 +1 @@
90119fecbce06c8db82194dfd9d5045be29b1cda
2afc33de2b2012d034fb0d2057a5a45e304516ca

View File

@ -5173,6 +5173,20 @@ static int unixShmRelease(sqlite3_shm *pSharedMem){
return SQLITE_OK;
}
/*
** Symbolic names for LOCK states used for debugging.
*/
#ifdef SQLITE_DEBUG
static const char *azLkName[] = {
"UNLOCK",
"READ",
"READ_FULL",
"WRITE",
"PENDING",
"CHECKPOINT",
"RECOVER"
};
#endif
/*
@ -5205,14 +5219,14 @@ static int unixShmLock(
|| desiredLock==p->lockState
|| (desiredLock==SQLITE_SHM_READ && p->lockState==SQLITE_SHM_READ_FULL)
){
OSTRACE(("SHM-LOCK shmid-%d, pid-%d request %d and got %d\n",
p->id, getpid(), desiredLock, p->lockState));
OSTRACE(("SHM-LOCK shmid-%d, pid-%d request %s and got %s\n",
p->id, getpid(), azLkName[desiredLock], azLkName[p->lockState]));
if( pGotLock ) *pGotLock = p->lockState;
return SQLITE_OK;
}
OSTRACE(("SHM-LOCK shmid-%d, pid-%d request %d->%d\n",
p->id, getpid(), p->lockState, desiredLock));
OSTRACE(("SHM-LOCK shmid-%d, pid-%d request %s->%s\n",
p->id, getpid(), azLkName[p->lockState], azLkName[desiredLock]));
sqlite3_mutex_enter(pFile->mutex);
switch( desiredLock ){
case SQLITE_SHM_UNLOCK: {
@ -5301,7 +5315,8 @@ static int unixShmLock(
}
}
sqlite3_mutex_leave(pFile->mutex);
OSTRACE(("SHM-LOCK shmid-%d, pid-%d got %d\n", p->id,getpid(),p->lockState));
OSTRACE(("SHM-LOCK shmid-%d, pid-%d got %s\n",
p->id, getpid(), azLkName[p->lockState]));
if( pGotLock ) *pGotLock = p->lockState;
return rc;
}