]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Add the test_trace_breakpoint() subroutine that is invoked after each
authordrh <drh@noemail.net>
Thu, 2 Jan 2020 13:26:49 +0000 (13:26 +0000)
committerdrh <drh@noemail.net>
Thu, 2 Jan 2020 13:26:49 +0000 (13:26 +0000)
instruction is printed while running PRAGMA vdbe_trace=on.  Only works for
SQLITE_DEBUG builds.  Also add parameters "pc" and "pOp" to
test_addop_breakpoint() to make it easier to set conditionals.

FossilOrigin-Name: 49a6368c384178653cb3ccb58cc8eff93327c16929bf79eeefeb13a4ce897153

manifest
manifest.uuid
src/vdbe.c
src/vdbeaux.c
src/vdbemem.c

index 6cf93101f98f13164db2e66868135728e96d5fa9..3a79ec66f34d806c754e9c4b870be0be9e1ebfeb 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Use\sOP_Copy\sinstead\sof\sOP_SCopy\sto\smove\sthe\sresults\sof\sa\sscalar\ssubquery.
-D 2020-01-02T02:50:45.152
+C Add\sthe\stest_trace_breakpoint()\ssubroutine\sthat\sis\sinvoked\safter\seach\ninstruction\sis\sprinted\swhile\srunning\sPRAGMA\svdbe_trace=on.\s\sOnly\sworks\sfor\nSQLITE_DEBUG\sbuilds.\s\sAlso\sadd\sparameters\s"pc"\sand\s"pOp"\sto\s\ntest_addop_breakpoint()\sto\smake\sit\seasier\sto\sset\sconditionals.
+D 2020-01-02T13:26:49.943
 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
 F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -600,13 +600,13 @@ F src/upsert.c 2920de71b20f04fe25eb00b655d086f0ba60ea133c59d7fa3325c49838818e78
 F src/utf.c 2f0fac345c7660d5c5bd3df9e9d8d33d4c27f366bcfb09e07443064d751a0507
 F src/util.c 2c92bc706bbdb1c45a25180291e7e05a56e297aa5dd7b2bcd2b1c47e8bb05b17
 F src/vacuum.c 82dcec9e7b1afa980288718ad11bc499651c722d7b9f32933c4d694d91cb6ebf
-F src/vdbe.c 119ddfe16b35fbaaf5460c9b58a8eeb0cc5d43058342af36925411dfc73f9862
+F src/vdbe.c 9d432abf6c7979dc8661572ed5d61773be72a6b7475c0e97901309dc611fe4bd
 F src/vdbe.h 3f068f00b23aebf392df142312ab5874588371c6d83e60d953f6d6b6453491c5
 F src/vdbeInt.h e02ccac0334f7c71c952210657e6e18de1917605887c7bc6167a80a17f62da18
 F src/vdbeapi.c 1252d80c548711e47a6d84dae88ed4e95d3fbb4e7bd0eaa1347299af7efddf02
-F src/vdbeaux.c 0a9716e47012ef018038c2e1dab9f701a6fb4429bb3ee1d4d0f49497519ace74
+F src/vdbeaux.c 83b666882a55bd2762cec9dc32cd71b71d053890253a3d7c9646d59abfcb3381
 F src/vdbeblob.c 253ed82894924c362a7fa3079551d3554cd1cdace39aa833da77d3bc67e7c1b1
-F src/vdbemem.c a5c16cfa5e8ec960cf1ae1226a0718b31bb93de8fba7804fb60217e1dbe28721
+F src/vdbemem.c 4029cb6a5a4d94f95e63e29c998791534788ce64ffb0f3bdfd373aba04a7169f
 F src/vdbesort.c a3be032cc3fee0e3af31773af4a7a6f931b7230a34f53282ccf1d9a2a72343be
 F src/vdbetrace.c fa3bf238002f0bbbdfb66cc8afb0cea284ff9f148d6439bc1f6f2b4c3b7143f0
 F src/vtab.c a2fead3e97fca54fcf3f3db784e17c9ee2d39a0c5ad323e9d514855106300a86
@@ -1853,7 +1853,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
 F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
 F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P 7bfd42f1dc0c94f9bb74516e62fec8e39c20f4749f4e0972f66c2886d3c64f73
-R d537ec2097ea14e175c328187e686eee
+P 435c272dcf6ed5f3acb564b8f959557145f117b869547b670258cf5a1908ab6b
+R 012a47d79081ec029afe02cb3190d8b3
 U drh
-Z e19c3a27a330f4b39d07df72e769f17a
+Z 44bc6f6389cf28eb8f2cfc35d7778fbb
index edc96cb1d0fd68ab1b8dc3c915e868f18bd96cf6..06232d4889e8a0b0039c2a8eb3c014350a5f55ed 100644 (file)
@@ -1 +1 @@
-435c272dcf6ed5f3acb564b8f959557145f117b869547b670258cf5a1908ab6b
\ No newline at end of file
+49a6368c384178653cb3ccb58cc8eff93327c16929bf79eeefeb13a4ce897153
\ No newline at end of file
index cc999a3ebbc5f9367e6939b1afcf12fea8913823..ca737ffccbeab884de0f120cf507eef3f9792c00 100644 (file)
@@ -117,6 +117,26 @@ int sqlite3_found_count = 0;
 # define UPDATE_MAX_BLOBSIZE(P)
 #endif
 
+#ifdef SQLITE_DEBUG
+/* This routine provides a convenient place to set a breakpoint during
+** tracing with PRAGMA vdbe_trace=on.  The breakpoint fires right after
+** each opcode is printed.  Variables "pc" (program counter) and pOp are
+** available to add conditionals to the breakpoint.  GDB example:
+**
+**         break test_trace_breakpoint if pc=22
+**
+** Other useful labels for breakpoints include:
+**   test_addop_breakpoint(pc,pOp)
+**   sqlite3CorruptError(lineno)
+**   sqlite3MisuseError(lineno)
+**   sqlite3CantopenError(lineno)
+*/
+static void test_trace_breakpoint(int pc, Op *pOp){
+  static int n = 0;
+  n++;
+}
+#endif
+
 /*
 ** Invoke the VDBE coverage callback, if that callback is defined.  This
 ** feature is used for test suite validation only and does not appear an
@@ -738,6 +758,7 @@ int sqlite3VdbeExec(
 #ifdef SQLITE_DEBUG
     if( db->flags & SQLITE_VdbeTrace ){
       sqlite3VdbePrintOp(stdout, (int)(pOp - aOp), pOp);
+      test_trace_breakpoint((int)(pOp - aOp),pOp);
     }
 #endif
       
index 9d04c160a2d7f2a5c387037315f8f84d2691c33c..ced3ec24c47559b831b803f857e9d4d93b6b0970 100644 (file)
@@ -194,9 +194,16 @@ static int growOpArray(Vdbe *v, int nOp){
 #ifdef SQLITE_DEBUG
 /* This routine is just a convenient place to set a breakpoint that will
 ** fire after each opcode is inserted and displayed using
-** "PRAGMA vdbe_addoptrace=on".
+** "PRAGMA vdbe_addoptrace=on".  Parameters "pc" (program counter) and
+** pOp are available to make the breakpoint conditional.
+**
+** Other useful labels for breakpoints include:
+**   test_trace_breakpoint(pc,pOp)
+**   sqlite3CorruptError(lineno)
+**   sqlite3MisuseError(lineno)
+**   sqlite3CantopenError(lineno)
 */
-static void test_addop_breakpoint(void){
+static void test_addop_breakpoint(int pc, Op *pOp){
   static int n = 0;
   n++;
 }
@@ -249,7 +256,7 @@ int sqlite3VdbeAddOp3(Vdbe *p, int op, int p1, int p2, int p3){
 #ifdef SQLITE_DEBUG
   if( p->db->flags & SQLITE_VdbeAddopTrace ){
     sqlite3VdbePrintOp(0, i, &p->aOp[i]);
-    test_addop_breakpoint();
+    test_addop_breakpoint(i, &p->aOp[i]);
   }
 #endif
 #ifdef VDBE_PROFILE
index 7d56d1684b6a97c0bf7075f3f6af4f77fe3e922c..faf555af907037bb9a1ebc244d5fb68a57efd8f4 100644 (file)
@@ -948,8 +948,8 @@ int sqlite3VdbeMemTooBig(Mem *p){
 ** its link to a shallow copy and by marking any current shallow
 ** copies of this cell as invalid.
 **
-** This is used for testing and debugging only - to make sure shallow
-** copies are not misused.
+** This is used for testing and debugging only - to help ensure that shallow
+** copies (created by OP_SCopy) are not misused.
 */
 void sqlite3VdbeMemAboutToChange(Vdbe *pVdbe, Mem *pMem){
   int i;