Fix the VDBE so that it always uses the original opcode for profiling and

debugging even after the pOp pointer has been updated due to a jump.

FossilOrigin-Name: 647495cf12b656f6a2f028dc1fb459d667153cf2
This commit is contained in:
drh 2015-04-16 17:31:02 +00:00
parent a276e3fd4d
commit 6dc4148547
3 changed files with 20 additions and 14 deletions

View File

@ -1,5 +1,5 @@
C Fix\sa\sfaulty\sassert()\sin\sthe\scompound-SELECT\scode\sgenerator.
D 2015-04-16T16:22:27.087
C Fix\sthe\sVDBE\sso\sthat\sit\salways\suses\sthe\soriginal\sopcode\sfor\sprofiling\sand\ndebugging\seven\safter\sthe\spOp\spointer\shas\sbeen\supdated\sdue\sto\sa\sjump.
D 2015-04-16T17:31:02.931
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in 5f78b1ab81b64e7c57a75d170832443e66c0880a
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@ -293,7 +293,7 @@ F src/update.c 3c4ecc282accf12d39edb8d524cf089645e55a13
F src/utf.c fc6b889ba0779b7722634cdeaa25f1930d93820c
F src/util.c 98a7627ca48ad3265b6940915a1d08355eb3fc7e
F src/vacuum.c 2ddd5cad2a7b9cef7f9e431b8c7771634c6b1701
F src/vdbe.c 3f3afd12d4794cb51fe13dc948b1172a5eb71a94
F src/vdbe.c 55650cb03d26ce5955cffcdc6568e046680b1fd4
F src/vdbe.h 7e538ecf47dccb307ea2d087c3ddc2dd8d70e79d
F src/vdbeInt.h 9cbaa84f53ddd2d09a0cf61a94337a3a035d08a0
F src/vdbeapi.c 583d56b129dd27f12bed518270de9ebe521e6a75
@ -1250,7 +1250,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
P e0a88176fcfbed7b554a036948261a332c920053
R 0b75ab69a90f92b9d27a639039ba6734
P 10715b05f2201a63dca317f99ce39d3ce182e182
R a3daab05325b2d95fe679d302a2d11e4
U drh
Z 2a30576e418c5afefa31fbc64fb3a4fe
Z 9f3c109ab0871adbf8f7030a7a0d36ce

View File

@ -1 +1 @@
10715b05f2201a63dca317f99ce39d3ce182e182
647495cf12b656f6a2f028dc1fb459d667153cf2

View File

@ -539,6 +539,9 @@ int sqlite3VdbeExec(
){
Op *aOp = p->aOp; /* Copy of p->aOp */
Op *pOp = aOp; /* Current operation */
#if defined(SQLITE_DEBUG) || defined(VDBE_PROFILE)
Op *pOrigOp; /* Value of pOp at the top of the loop */
#endif
int rc = SQLITE_OK; /* Value to return */
sqlite3 *db = p->db; /* The database */
u8 resetSchemaOnFault = 0; /* Reset schema after an error if positive */
@ -681,6 +684,9 @@ int sqlite3VdbeExec(
memAboutToChange(p, &aMem[pOp->p3]);
}
#endif
#if defined(SQLITE_DEBUG) || defined(VDBE_PROFILE)
pOrigOp = pOp;
#endif
switch( pOp->opcode ){
@ -6489,8 +6495,8 @@ default: { /* This is really OP_Noop and OP_Explain */
#ifdef VDBE_PROFILE
{
u64 endTime = sqlite3Hwtime();
if( endTime>start ) pOp->cycles += endTime - start;
pOp->cnt++;
if( endTime>start ) pOrigOp->cycles += endTime - start;
pOrigOp->cnt++;
}
#endif
@ -6500,16 +6506,16 @@ default: { /* This is really OP_Noop and OP_Explain */
** the evaluator loop. So we can leave it out when NDEBUG is defined.
*/
#ifndef NDEBUG
assert( pOp>=&aOp[-1] && pOp<&aOp[p->nOp] );
assert( pOp>=&aOp[-1] && pOp<&aOp[p->nOp-1] );
#ifdef SQLITE_DEBUG
if( db->flags & SQLITE_VdbeTrace ){
if( rc!=0 ) printf("rc=%d\n",rc);
if( pOp->opflags & (OPFLG_OUT2) ){
registerTrace(pOp->p2, &aMem[pOp->p2]);
if( pOrigOp->opflags & (OPFLG_OUT2) ){
registerTrace(pOrigOp->p2, &aMem[pOrigOp->p2]);
}
if( pOp->opflags & OPFLG_OUT3 ){
registerTrace(pOp->p3, &aMem[pOp->p3]);
if( pOrigOp->opflags & OPFLG_OUT3 ){
registerTrace(pOrigOp->p3, &aMem[pOrigOp->p3]);
}
}
#endif /* SQLITE_DEBUG */