From f63552b258ec670f0080edc41367b45892554fc7 Mon Sep 17 00:00:00 2001 From: drh Date: Wed, 30 Oct 2013 00:25:03 +0000 Subject: [PATCH 1/2] Enhanced display of register ranges in the auxiliary comments added to EXPLAIN. FossilOrigin-Name: d6b0c39281d0751ecec04d7c19d9d2931d133e8e --- manifest | 14 ++++++------- manifest.uuid | 2 +- src/vdbe.c | 34 +++++++++++++++--------------- src/vdbeaux.c | 57 +++++++++++++++++++++++++++++++++++---------------- 4 files changed, 64 insertions(+), 43 deletions(-) diff --git a/manifest b/manifest index 5cb15b2733..01c774851f 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Automatically\sgenerated\scomments\son\smany\sVDBE\sopcodes\swhen\sin\sSQLITE_DEBUG\nmost.\s\sComments\sderive\sfrom\sthe\s"Synopsis:"\sfield\sadded\sto\seach\sopcode\ndefinition\sin\svdbe.c. -D 2013-10-29T20:40:47.279 +C Enhanced\sdisplay\sof\sregister\sranges\sin\sthe\sauxiliary\scomments\sadded\sto\sEXPLAIN. +D 2013-10-30T00:25:03.220 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 0522b53cdc1fcfc18f3a98e0246add129136c654 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -279,11 +279,11 @@ F src/update.c f5182157f5d0d0a97bc5f5e3c9bdba0dfbe08f08 F src/utf.c 6fc6c88d50448c469c5c196acf21617a24f90269 F src/util.c 2fa6c821d28bbdbeec1b2a7b091a281c9ef8f918 F src/vacuum.c f313bc97123a4dd4bfd3f50a00c4d44c08a5b1b7 -F src/vdbe.c 3d0bd1f8a3ebec1c253c5050c1008bffcbcb21eb +F src/vdbe.c de4018a314991d41f9b8fb68a17a04471076675d F src/vdbe.h 4f554b5627f26710c4c36d919110a3fc611ca5c4 F src/vdbeInt.h ff57f67aee1ba26a3a47e786533dab155ab6dad6 F src/vdbeapi.c 93a22a9ba2abe292d5c2cf304d7eb2e894dde0ed -F src/vdbeaux.c e670a2bd8bf7ba10fad63b9264c5d723c38f02d0 +F src/vdbeaux.c 24deeaf02e8c654af95f83dad6bff79b8bfaf844 F src/vdbeblob.c 5dc79627775bd9a9b494dd956e26297946417d69 F src/vdbemem.c 649933bad3e922465b726eaf85c72a75acba2ab7 F src/vdbesort.c 3937e06b2a0e354500e17dc206ef4c35770a5017 @@ -1126,7 +1126,7 @@ F tool/vdbe-compress.tcl f12c884766bd14277f4fcedcae07078011717381 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh d1a6de74685f360ab718efda6265994b99bbea01 F tool/win/sqlite.vsix 030f3eeaf2cb811a3692ab9c14d021a75ce41fff -P 3a9e3ed94bf617f00c48009b1a6d348a8f23a3cf -R cc5dfe91a476c5736a19ee6bb40f8034 +P 5f310c6a22b8bb5f860296074aee130c14101681 +R 56a9cac237ebc2d22a08882e57a2deb0 U drh -Z 873c3bf640fe9fcbf6a7225bea069855 +Z 31acf4b64a31acd4cd8cd14b574bab97 diff --git a/manifest.uuid b/manifest.uuid index f417371d33..e7f00ea803 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -5f310c6a22b8bb5f860296074aee130c14101681 \ No newline at end of file +d6b0c39281d0751ecec04d7c19d9d2931d133e8e \ No newline at end of file diff --git a/src/vdbe.c b/src/vdbe.c index 0fd344c0c4..4b922ee73b 100644 --- a/src/vdbe.c +++ b/src/vdbe.c @@ -1035,7 +1035,7 @@ case OP_Variable: { /* out2-prerelease */ } /* Opcode: Move P1 P2 P3 * * -** Synopsis: r[P2]=r[P1] N=P3 +** Synopsis: r[P2@P3]=r[P1@P3] ** ** Move the values in register P1..P1+P3 over into ** registers P2..P2+P3. Registers P1..P1+P3 are @@ -1078,7 +1078,7 @@ case OP_Move: { } /* Opcode: Copy P1 P2 P3 * * -** Synopsis: r[P2]=r[P1] N=P3 +** Synopsis: r[P2@P3]=r[P1@P3] ** ** Make a copy of registers P1..P1+P3 into registers P2..P2+P3. ** @@ -1400,7 +1400,7 @@ case OP_CollSeq: { } /* Opcode: Function P1 P2 P3 P4 P5 -** Synopsis: r[P3]=func(r[P2]..) N=P5 +** Synopsis: r[P3]=func(r[P2@P5]) ** ** Invoke a user function (P4 is a pointer to a Function structure that ** defines the function) with P5 arguments taken from register P2 and @@ -2513,7 +2513,7 @@ op_column_out: } /* Opcode: Affinity P1 P2 * P4 * -** Synopsis: affinity(r[P1]) N=P2 +** Synopsis: affinity(r[P1@P2]) ** ** Apply affinities to a range of P2 registers starting with P1. ** @@ -2540,7 +2540,7 @@ case OP_Affinity: { } /* Opcode: MakeRecord P1 P2 P3 P4 * -** Synopsis: r[P3]=rec(r[P1]..) N=P2 +** Synopsis: r[P3]=mkrec(r[P1@P2]) ** ** Convert P2 registers beginning with P1 into the [record format] ** use as a data record in a database table or as a key @@ -3379,7 +3379,7 @@ case OP_SorterOpen: { } /* Opcode: OpenPseudo P1 P2 P3 * P5 -** Synopsis: content in r[P2].. N=P3 +** Synopsis: content in r[P2@P3] ** ** Open a new cursor that points to a fake table that contains a single ** row of data. The content of that one row in the content of memory @@ -3422,7 +3422,7 @@ case OP_Close: { } /* Opcode: SeekGe P1 P2 P3 P4 * -** Synopsis: key=r[P3].. N=P4 +** Synopsis: key=r[P3@P4] ** ** If cursor P1 refers to an SQL table (B-Tree that uses integer keys), ** use the value in register P3 as the key. If cursor P1 refers @@ -3436,7 +3436,7 @@ case OP_Close: { ** See also: Found, NotFound, Distinct, SeekLt, SeekGt, SeekLe */ /* Opcode: SeekGt P1 P2 P3 P4 * -** Synopsis: key=r[P3].. N=P4 +** Synopsis: key=r[P3@P4] ** ** If cursor P1 refers to an SQL table (B-Tree that uses integer keys), ** use the value in register P3 as a key. If cursor P1 refers @@ -3450,7 +3450,7 @@ case OP_Close: { ** See also: Found, NotFound, Distinct, SeekLt, SeekGe, SeekLe */ /* Opcode: SeekLt P1 P2 P3 P4 * -** Synopsis: key=r[P3].. N=P4 +** Synopsis: key=r[P3@P4] ** ** If cursor P1 refers to an SQL table (B-Tree that uses integer keys), ** use the value in register P3 as a key. If cursor P1 refers @@ -3464,7 +3464,7 @@ case OP_Close: { ** See also: Found, NotFound, Distinct, SeekGt, SeekGe, SeekLe */ /* Opcode: SeekLe P1 P2 P3 P4 * -** Synopsis: key=r[P3].. N=P4 +** Synopsis: key=r[P3@P4] ** ** If cursor P1 refers to an SQL table (B-Tree that uses integer keys), ** use the value in register P3 as a key. If cursor P1 refers @@ -3658,7 +3658,7 @@ case OP_Seek: { /* in2 */ /* Opcode: Found P1 P2 P3 P4 * -** Synopsis: key=r[P3].. N=P4 +** Synopsis: key=r[P3@P4] ** ** If P4==0 then register P3 holds a blob constructed by MakeRecord. If ** P4>0 then register P3 is the first of P4 registers that form an unpacked @@ -3669,7 +3669,7 @@ case OP_Seek: { /* in2 */ ** P1 is left pointing at the matching entry. */ /* Opcode: NotFound P1 P2 P3 P4 * -** Synopsis: key=r[P3] N=P4 +** Synopsis: key=r[P3@P4] ** ** If P4==0 then register P3 holds a blob constructed by MakeRecord. If ** P4>0 then register P3 is the first of P4 registers that form an unpacked @@ -4639,7 +4639,7 @@ case OP_IdxInsert: { /* in2 */ } /* Opcode: IdxDelete P1 P2 P3 * * -** Synopsis: key=r[P2].. +** Synopsis: key=r[P2@P3] ** ** The content of P3 registers starting at register P2 form ** an unpacked index key. This opcode removes that entry from the @@ -4712,7 +4712,7 @@ case OP_IdxRowid: { /* out2-prerelease */ } /* Opcode: IdxGE P1 P2 P3 P4 P5 -** Synopsis: key=r[P3] N=P4 +** Synopsis: key=r[P3@P4] ** ** The P4 register values beginning with P3 form an unpacked index ** key that omits the ROWID. Compare this key value against the index @@ -4727,7 +4727,7 @@ case OP_IdxRowid: { /* out2-prerelease */ ** the result is false whereas it would be true with IdxGT. */ /* Opcode: IdxLT P1 P2 P3 P4 P5 -** Synopsis: key=r[P3] N=P4 +** Synopsis: key=r[P3@P4] ** ** The P4 register values beginning with P3 form an unpacked index ** key that omits the ROWID. Compare this key value against the index @@ -5470,7 +5470,7 @@ case OP_IfZero: { /* jump, in1 */ } /* Opcode: AggStep * P2 P3 P4 P5 -** Synopsis: accum=r[P3] step(r[P2]..) N=P5 +** Synopsis: accum=r[P3] step(r[P2@P5]) ** ** Execute the step function for an aggregate. The ** function has P5 arguments. P4 is a pointer to the FuncDef @@ -6088,7 +6088,7 @@ case OP_VRename: { #ifndef SQLITE_OMIT_VIRTUALTABLE /* Opcode: VUpdate P1 P2 P3 P4 * -** Synopsis: data=r[P3] N=P2 +** Synopsis: data=r[P3@P2] ** ** P4 is a pointer to a virtual table object, an sqlite3_vtab structure. ** This opcode invokes the corresponding xUpdate method. P2 values diff --git a/src/vdbeaux.c b/src/vdbeaux.c index 99caa70c6b..96f28ce800 100644 --- a/src/vdbeaux.c +++ b/src/vdbeaux.c @@ -855,10 +855,27 @@ VdbeOp *sqlite3VdbeGetOp(Vdbe *p, int addr){ } #if defined(SQLITE_DEBUG) +/* +** Return an integer value for one of the parameters to the opcode pOp +** determined by character c. +*/ +static int translateP(char c, const Op *pOp){ + if( c=='1' ) return pOp->p1; + if( c=='2' ) return pOp->p2; + if( c=='3' ) return pOp->p3; + if( c=='4' ) return pOp->p4.i; + return pOp->p5; +} + /* ** Compute a string for the "comment" field of a VDBE opcode listing */ -static int displayComment(Op *pOp, const char *zP4, char *zTemp, int nTemp){ +static int displayComment( + const Op *pOp, /* The opcode to be commented */ + const char *zP4, /* Previously obtained value for P4 */ + char *zTemp, /* Write result here */ + int nTemp /* Space available in zTemp[] */ +){ const char *zOpName; const char *zSynopsis; int nOpName; @@ -867,28 +884,32 @@ static int displayComment(Op *pOp, const char *zP4, char *zTemp, int nTemp){ nOpName = sqlite3Strlen30(zOpName); if( zOpName[nOpName+1] ){ int seenCom = 0; + char c; zSynopsis = zOpName += nOpName + 1; - for(ii=jj=0; jjp1; break; - case '2': v = pOp->p2; break; - case '3': v = pOp->p3; break; - case '5': v = pOp->p5; break; - case '4': zShow = zP4; break; - case 'X': zShow = pOp->zComment; seenCom = 1; break; - } - if( zShow ){ - sqlite3_snprintf(nTemp-jj, zTemp+jj, "%s", zShow); + for(ii=jj=0; jjzComment); + seenCom = 1; }else{ - sqlite3_snprintf(nTemp-jj, zTemp+jj, "%d", v); + int v1 = translateP(c, pOp); + int v2; + sqlite3_snprintf(nTemp-jj, zTemp+jj, "%d", v1); + if( strncmp(zSynopsis+ii+1, "@P", 2)==0 ){ + ii += 3; + jj += sqlite3Strlen30(zTemp+jj); + v2 = translateP(zSynopsis[ii], pOp); + if( v2>1 ) sqlite3_snprintf(nTemp-jj, zTemp+jj, "..%d", v1+v2-1); + }else if( strncmp(zSynopsis+ii+1, "..P3", 4)==0 && pOp->p3==0 ){ + ii += 4; + } } jj += sqlite3Strlen30(zTemp+jj); }else{ - zTemp[jj++] = zSynopsis[ii]; + zTemp[jj++] = c; } } if( !seenCom && jjzComment ){ From c7379ce44230564a7369f0d9efbb546534a6aabf Mon Sep 17 00:00:00 2001 From: drh Date: Wed, 30 Oct 2013 02:28:23 +0000 Subject: [PATCH 2/2] Add the SQLITE_ENABLE_EXPLAIN_COMMENTS compile-time option to enable extra commentary in the EXPLAIN output. Formerly, this was only available with SQLITE_DEBUG. FossilOrigin-Name: e1a89b56f7173166bb9224e2e360fd67ad3399c3 --- manifest | 20 ++++++++++---------- manifest.uuid | 2 +- mkopcodec.awk | 2 +- src/sqliteInt.h | 7 +++++++ src/trigger.c | 2 +- src/vdbe.h | 4 ++-- src/vdbeaux.c | 18 +++++++++++------- 7 files changed, 33 insertions(+), 22 deletions(-) diff --git a/manifest b/manifest index 01c774851f..7515e3a471 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Enhanced\sdisplay\sof\sregister\sranges\sin\sthe\sauxiliary\scomments\sadded\sto\sEXPLAIN. -D 2013-10-30T00:25:03.220 +C Add\sthe\sSQLITE_ENABLE_EXPLAIN_COMMENTS\scompile-time\soption\sto\senable\sextra\ncommentary\sin\sthe\sEXPLAIN\soutput.\s\sFormerly,\sthis\swas\sonly\savailable\swith\nSQLITE_DEBUG. +D 2013-10-30T02:28:23.508 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 0522b53cdc1fcfc18f3a98e0246add129136c654 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -145,7 +145,7 @@ F main.mk c6a433cb334bbb019625c137ab5d5e7568b47cff F mkdll.sh 7d09b23c05d56532e9d44a50868eb4b12ff4f74a F mkextu.sh 416f9b7089d80e5590a29692c9d9280a10dbad9f F mkextw.sh d2a981497b404d6498f5ff3e3b1f3816bdfcb338 -F mkopcodec.awk 393b20a2a99557ca695f7e1261c32d087ff7c0b4 +F mkopcodec.awk c2ff431854d702cdd2d779c9c0d1f58fa16fa4ea F mkopcodeh.awk 987ee588ff3bb4043bed2185c1ee2bdc39b1e526 F mkso.sh fd21c06b063bb16a5d25deea1752c2da6ac3ed83 F mptest/config01.test 3c6adcbc50b991866855f1977ff172eb6d901271 @@ -223,7 +223,7 @@ F src/shell.c d5eebdc6034014103de2b9d58e1d3f6f7de0fb50 F src/sqlite.h.in 547a44dd4ff4d975e92a645ea2d609e543a83d0f F src/sqlite3.rc 11094cc6a157a028b301a9f06b3d03089ea37c3e F src/sqlite3ext.h 886f5a34de171002ad46fae8c36a7d8051c190fc -F src/sqliteInt.h 4dd81a25a919509ce94b1f8f120bbef14458d4b9 +F src/sqliteInt.h 6eff1bbd7e687510c4d5a2aea915b50a51001eb2 F src/sqliteLimit.h 164b0e6749d31e0daa1a4589a169d31c0dec7b3d F src/status.c 7ac05a5c7017d0b9f0b4bcd701228b784f987158 F src/table.c 2cd62736f845d82200acfa1287e33feb3c15d62e @@ -274,16 +274,16 @@ F src/test_vfs.c e72f555ef7a59080f898fcf1a233deb9eb704ea9 F src/test_vfstrace.c 34b544e80ba7fb77be15395a609c669df2e660a2 F src/test_wsd.c 41cadfd9d97fe8e3e4e44f61a4a8ccd6f7ca8fe9 F src/tokenize.c 70061085a51f2f4fc15ece94f32c03bcb78e63b2 -F src/trigger.c ba0a883cd536b7dfdd4df3733001f5372a4299da +F src/trigger.c 53d6b5d50b3b23d4fcd0a36504feb5cff9aed716 F src/update.c f5182157f5d0d0a97bc5f5e3c9bdba0dfbe08f08 F src/utf.c 6fc6c88d50448c469c5c196acf21617a24f90269 F src/util.c 2fa6c821d28bbdbeec1b2a7b091a281c9ef8f918 F src/vacuum.c f313bc97123a4dd4bfd3f50a00c4d44c08a5b1b7 F src/vdbe.c de4018a314991d41f9b8fb68a17a04471076675d -F src/vdbe.h 4f554b5627f26710c4c36d919110a3fc611ca5c4 +F src/vdbe.h 6bdee35c54d57fd52733d4c542781820009311dc F src/vdbeInt.h ff57f67aee1ba26a3a47e786533dab155ab6dad6 F src/vdbeapi.c 93a22a9ba2abe292d5c2cf304d7eb2e894dde0ed -F src/vdbeaux.c 24deeaf02e8c654af95f83dad6bff79b8bfaf844 +F src/vdbeaux.c 1cbff05cb4c6618d805b4d4efc15d31af0f47f0d F src/vdbeblob.c 5dc79627775bd9a9b494dd956e26297946417d69 F src/vdbemem.c 649933bad3e922465b726eaf85c72a75acba2ab7 F src/vdbesort.c 3937e06b2a0e354500e17dc206ef4c35770a5017 @@ -1126,7 +1126,7 @@ F tool/vdbe-compress.tcl f12c884766bd14277f4fcedcae07078011717381 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh d1a6de74685f360ab718efda6265994b99bbea01 F tool/win/sqlite.vsix 030f3eeaf2cb811a3692ab9c14d021a75ce41fff -P 5f310c6a22b8bb5f860296074aee130c14101681 -R 56a9cac237ebc2d22a08882e57a2deb0 +P d6b0c39281d0751ecec04d7c19d9d2931d133e8e +R 97e786a08b0a2c7a14cb84c2e159324e U drh -Z 31acf4b64a31acd4cd8cd14b574bab97 +Z 1b6acaf0339443874185cc93aaa66a02 diff --git a/manifest.uuid b/manifest.uuid index e7f00ea803..04847cc775 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -d6b0c39281d0751ecec04d7c19d9d2931d133e8e \ No newline at end of file +e1a89b56f7173166bb9224e2e360fd67ad3399c3 \ No newline at end of file diff --git a/mkopcodec.awk b/mkopcodec.awk index f4a09bf3e5..de19068c20 100644 --- a/mkopcodec.awk +++ b/mkopcodec.awk @@ -14,7 +14,7 @@ BEGIN { printf "#if !defined(SQLITE_OMIT_EXPLAIN)" printf " || defined(VDBE_PROFILE)" print " || defined(SQLITE_DEBUG)" - print "#if defined(SQLITE_DEBUG)" + print "#if defined(SQLITE_ENABLE_EXPLAIN_COMMENTS) || defined(SQLITE_DEBUG)" print "# define OpHelp(X) \"\\0\" X" print "#else" print "# define OpHelp(X)" diff --git a/src/sqliteInt.h b/src/sqliteInt.h index 4974b2d0f3..6210465f75 100644 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@ -217,6 +217,13 @@ # undef NDEBUG #endif +/* +** Enable SQLITE_ENABLE_EXPLAIN_COMMENTS if SQLITE_DEBUG is turned on. +*/ +#if !defined(SQLITE_ENABLE_EXPLAIN_COMMENTS) && defined(SQLITE_DEBUG) +# define SQLITE_ENABLE_EXPLAIN_COMMENTS 1 +#endif + /* ** The testcase() macro is used to aid in coverage testing. When ** doing coverage testing, the condition inside the argument to diff --git a/src/trigger.c b/src/trigger.c index 774711f0f5..607b831243 100644 --- a/src/trigger.c +++ b/src/trigger.c @@ -784,7 +784,7 @@ static int codeTriggerProgram( return 0; } -#ifdef SQLITE_DEBUG +#ifdef SQLITE_ENABLE_EXPLAIN_COMMENTS /* ** This function is used to add VdbeComment() annotations to a VDBE ** program. It is not used in production code, only for debugging. diff --git a/src/vdbe.h b/src/vdbe.h index a6cc915444..966ea75264 100644 --- a/src/vdbe.h +++ b/src/vdbe.h @@ -61,7 +61,7 @@ struct VdbeOp { SubProgram *pProgram; /* Used when p4type is P4_SUBPROGRAM */ int (*xAdvance)(BtCursor *, int *); } p4; -#ifdef SQLITE_DEBUG +#ifdef SQLITE_ENABLE_EXPLAIN_COMMENTS char *zComment; /* Comment to improve readability */ #endif #ifdef VDBE_PROFILE @@ -219,7 +219,7 @@ void sqlite3VdbeLinkSubProgram(Vdbe *, SubProgram *); #endif -#ifndef NDEBUG +#ifdef SQLITE_ENABLE_EXPLAIN_COMMENTS void sqlite3VdbeComment(Vdbe*, const char*, ...); # define VdbeComment(X) sqlite3VdbeComment X void sqlite3VdbeNoopComment(Vdbe*, const char*, ...); diff --git a/src/vdbeaux.c b/src/vdbeaux.c index 96f28ce800..0d8eea924b 100644 --- a/src/vdbeaux.c +++ b/src/vdbeaux.c @@ -144,8 +144,10 @@ int sqlite3VdbeAddOp3(Vdbe *p, int op, int p1, int p2, int p3){ pOp->p3 = p3; pOp->p4.p = 0; pOp->p4type = P4_NOTUSED; -#ifdef SQLITE_DEBUG +#ifdef SQLITE_ENABLE_EXPLAIN_COMMENTS pOp->zComment = 0; +#endif +#ifdef SQLITE_DEBUG if( p->db->flags & SQLITE_VdbeAddopTrace ){ sqlite3VdbePrintOp(0, i, &p->aOp[i]); } @@ -532,8 +534,10 @@ int sqlite3VdbeAddOpList(Vdbe *p, int nOp, VdbeOpList const *aOp){ pOut->p4type = P4_NOTUSED; pOut->p4.p = 0; pOut->p5 = 0; -#ifdef SQLITE_DEBUG +#ifdef SQLITE_ENABLE_EXPLAIN_COMMENTS pOut->zComment = 0; +#endif +#ifdef SQLITE_DEBUG if( p->db->flags & SQLITE_VdbeAddopTrace ){ sqlite3VdbePrintOp(0, i+addr, &p->aOp[i+addr]); } @@ -663,7 +667,7 @@ static void vdbeFreeOpArray(sqlite3 *db, Op *aOp, int nOp){ Op *pOp; for(pOp=aOp; pOp<&aOp[nOp]; pOp++){ freeP4(db, pOp->p4type, pOp->p4.p); -#ifdef SQLITE_DEBUG +#ifdef SQLITE_ENABLE_EXPLAIN_COMMENTS sqlite3DbFree(db, pOp->zComment); #endif } @@ -779,7 +783,7 @@ void sqlite3VdbeChangeP4(Vdbe *p, int addr, const char *zP4, int n){ } } -#ifndef NDEBUG +#ifdef SQLITE_ENABLE_EXPLAIN_COMMENTS /* ** Change the comment on the most recently coded instruction. Or ** insert a No-op and add the comment to that new instruction. This @@ -854,7 +858,7 @@ VdbeOp *sqlite3VdbeGetOp(Vdbe *p, int addr){ } } -#if defined(SQLITE_DEBUG) +#if defined(SQLITE_ENABLE_EXPLAIN_COMMENTS) /* ** Return an integer value for one of the parameters to the opcode pOp ** determined by character c. @@ -1126,7 +1130,7 @@ void sqlite3VdbePrintOp(FILE *pOut, int pc, Op *pOp){ static const char *zFormat1 = "%4d %-13s %4d %4d %4d %-4s %.2X %s\n"; if( pOut==0 ) pOut = stdout; zP4 = displayP4(pOp, zPtr, sizeof(zPtr)); -#ifdef SQLITE_DEBUG +#ifdef SQLITE_ENABLE_EXPLAIN_COMMENTS displayComment(pOp, zP4, zCom, sizeof(zCom)); #else zCom[0] = 0 @@ -1372,7 +1376,7 @@ int sqlite3VdbeList( pMem->enc = SQLITE_UTF8; pMem++; -#ifdef SQLITE_DEBUG +#ifdef SQLITE_ENABLE_EXPLAIN_COMMENTS if( sqlite3VdbeMemGrow(pMem, 500, 0) ){ assert( p->db->mallocFailed ); return SQLITE_ERROR;