Change to tcl test infrastructure so that --malloctrace=1 works when sizeof(int)!=sizeof(void*).

FossilOrigin-Name: c3e771b3cf685f4237a2516ee7111849bf0ffb3f
This commit is contained in:
dan 2010-08-09 14:47:50 +00:00
parent 007820d65d
commit ec561a351a
3 changed files with 18 additions and 15 deletions

View File

@ -1,5 +1,5 @@
C Fix\sa\sproblem\scausing\sthe\sreturn\scode\sof\san\sxSync\scall\sto\sbe\signored\sin\swal.c.
D 2010-08-09T07:51:41
C Change\sto\stcl\stest\sinfrastructure\sso\sthat\s--malloctrace=1\sworks\swhen\ssizeof(int)!=sizeof(void*).
D 2010-08-09T14:47:50
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in ec08dc838fd8110fe24c92e5130bcd91cbb1ff2e
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@ -200,7 +200,7 @@ F src/test_intarray.c d879bbf8e4ce085ab966d1f3c896a7c8b4f5fc99
F src/test_intarray.h 489edb9068bb926583445cb02589344961054207
F src/test_journal.c 5ac89727cadbcc71954067b319eb40aff71dead2
F src/test_loadext.c df586c27176e3c2cb2e099c78da67bf14379a56e
F src/test_malloc.c 058e41dc853b1fa8ccd1083e9571018a74aeb3a7
F src/test_malloc.c 09a88f0c111201dc4f8c20470aa1b5f611d59200
F src/test_mutex.c ce06b59aca168cd8c520b77159a24352a7469bd3
F src/test_onefile.c 40cf9e212a377a6511469384a64b01e6e34b2eec
F src/test_osinst.c f408c6a181f2fb04c56273afd5c3e1e82f60392c
@ -843,7 +843,7 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
P 158a309737bd4cdc033cd504a6d0cc43c15b6e17
R 79082b63de1369184eea76cab5557bfc
P f1b2b5f9c3a5561ea6108283ae08404106c3f8bc
R 0c13ff5ef493cf88f58734e32a21c9d6
U dan
Z 5fdda4c9d9e63d074670dd4c1c360d96
Z 48ba547a168a1ffe5803ea79aa90257c

View File

@ -1 +1 @@
f1b2b5f9c3a5561ea6108283ae08404106c3f8bc
c3e771b3cf685f4237a2516ee7111849bf0ffb3f

View File

@ -728,7 +728,10 @@ static int test_memdebug_settitle(
return TCL_OK;
}
#define MALLOC_LOG_FRAMES 10
#define MALLOC_LOG_FRAMES 10
#define MALLOC_LOG_KEYINTS ( \
10 * ((sizeof(int)>=sizeof(void*)) ? 1 : sizeof(void*)/sizeof(int)) \
)
static Tcl_HashTable aMallocLog;
static int mallocLogEnabled = 0;
@ -745,8 +748,8 @@ static void test_memdebug_callback(int nByte, int nFrame, void **aFrame){
Tcl_HashEntry *pEntry;
int isNew;
int aKey[MALLOC_LOG_FRAMES];
int nKey = sizeof(int)*MALLOC_LOG_FRAMES;
int aKey[MALLOC_LOG_KEYINTS];
int nKey = sizeof(int)*MALLOC_LOG_KEYINTS;
memset(aKey, 0, nKey);
if( (sizeof(void*)*nFrame)<nKey ){
@ -781,7 +784,7 @@ static void test_memdebug_log_clear(void){
Tcl_Free((char *)pLog);
}
Tcl_DeleteHashTable(&aMallocLog);
Tcl_InitHashTable(&aMallocLog, MALLOC_LOG_FRAMES);
Tcl_InitHashTable(&aMallocLog, MALLOC_LOG_KEYINTS);
}
static int test_memdebug_log(
@ -804,7 +807,7 @@ static int test_memdebug_log(
void (*xBacktrace)(int, int, void **));
sqlite3MemdebugBacktraceCallback(test_memdebug_callback);
#endif
Tcl_InitHashTable(&aMallocLog, MALLOC_LOG_FRAMES);
Tcl_InitHashTable(&aMallocLog, MALLOC_LOG_KEYINTS);
isInit = 1;
}
@ -827,7 +830,7 @@ static int test_memdebug_log(
Tcl_HashEntry *pEntry;
Tcl_Obj *pRet = Tcl_NewObj();
assert(sizeof(int)==sizeof(void*));
assert(sizeof(Tcl_WideInt)>=sizeof(void*));
for(
pEntry=Tcl_FirstHashEntry(&aMallocLog, &search);
@ -836,13 +839,13 @@ static int test_memdebug_log(
){
Tcl_Obj *apElem[MALLOC_LOG_FRAMES+2];
MallocLog *pLog = (MallocLog *)Tcl_GetHashValue(pEntry);
int *aKey = (int *)Tcl_GetHashKey(&aMallocLog, pEntry);
Tcl_WideInt *aKey = (Tcl_WideInt *)Tcl_GetHashKey(&aMallocLog, pEntry);
int ii;
apElem[0] = Tcl_NewIntObj(pLog->nCall);
apElem[1] = Tcl_NewIntObj(pLog->nByte);
for(ii=0; ii<MALLOC_LOG_FRAMES; ii++){
apElem[ii+2] = Tcl_NewIntObj(aKey[ii]);
apElem[ii+2] = Tcl_NewWideIntObj(aKey[ii]);
}
Tcl_ListObjAppendElement(interp, pRet,