Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Add the "PRAGMA vdbe_addoptrace" pragma for debugging.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 4487c8c57e22527d2ce991d5aa562db8da9fa785
User & Date: drh 2013-02-15 22:08:42.387
Context
2013-02-15
22:20
Fix a bug in the IN processing in WHERE clauses. check-in: 25e27cdc60 user: drh tags: trunk
22:08
Add the "PRAGMA vdbe_addoptrace" pragma for debugging. check-in: 4487c8c57e user: drh tags: trunk
19:20
Fix a crash bug found by TH4. check-in: 6453240a0f user: drh tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/pragma.c.
73
74
75
76
77
78
79

80
81
82
83
84
85
86
#ifdef SQLITE4_DEBUG
    { "sql_trace",                SQLITE4_SqlTrace      },
    { "vdbe_listing",             SQLITE4_VdbeListing   },
    { "vdbe_trace",               SQLITE4_VdbeTrace     },
    { "kv_trace",                 SQLITE4_KvTrace       },
    { "trace",                    SQLITE4_SqlTrace | SQLITE4_VdbeListing |
                                  SQLITE4_VdbeTrace | SQLITE4_KvTrace },

#endif
#ifndef SQLITE4_OMIT_CHECK
    { "ignore_check_constraints", SQLITE4_IgnoreChecks  },
#endif
    /* The following is VERY experimental */
    { "writable_schema",          SQLITE4_WriteSchema|SQLITE4_RecoveryMode },








>







73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#ifdef SQLITE4_DEBUG
    { "sql_trace",                SQLITE4_SqlTrace      },
    { "vdbe_listing",             SQLITE4_VdbeListing   },
    { "vdbe_trace",               SQLITE4_VdbeTrace     },
    { "kv_trace",                 SQLITE4_KvTrace       },
    { "trace",                    SQLITE4_SqlTrace | SQLITE4_VdbeListing |
                                  SQLITE4_VdbeTrace | SQLITE4_KvTrace },
    { "vdbe_addoptrace",          SQLITE4_VdbeAddopTrace },
#endif
#ifndef SQLITE4_OMIT_CHECK
    { "ignore_check_constraints", SQLITE4_IgnoreChecks  },
#endif
    /* The following is VERY experimental */
    { "writable_schema",          SQLITE4_WriteSchema|SQLITE4_RecoveryMode },

Changes to src/sqliteInt.h.
889
890
891
892
893
894
895
896
897
898
899
900
901



902
903
904
905
906
907
908
909
910
911
912
913
914
*/
#define ENC(db) ((db)->aDb[0].pSchema->enc)

/*
** Possible values for the sqlite4.flags.
*/
#define SQLITE4_VdbeTrace      0x00000100  /* True to trace VDBE execution */
#define SQLITE4_InternChanges  0x00000200  /* Uncommitted Hash table changes */
#define SQLITE4_CountRows      0x00001000  /* Count rows changed by INSERT, */
                                          /*   DELETE, or UPDATE and return */
                                          /*   the count using a callback. */
#define SQLITE4_SqlTrace       0x00004000  /* Debug print SQL as it executes */
#define SQLITE4_VdbeListing    0x00008000  /* Debug listings of VDBE programs */



#define SQLITE4_WriteSchema    0x00010000  /* OK to update SQLITE4_MASTER */
#define SQLITE4_KvTrace        0x00020000  /* Trace Key/value storage calls */
#define SQLITE4_IgnoreChecks   0x00040000  /* Do not enforce check constraints */
#define SQLITE4_ReadUncommitted 0x0080000  /* For shared-cache mode */
#define SQLITE4_LegacyFileFmt  0x00100000  /* Create new databases in format 1 */
#define SQLITE4_RecoveryMode   0x00800000  /* Ignore schema errors */
#define SQLITE4_ReverseOrder   0x01000000  /* Reverse unordered SELECTs */
#define SQLITE4_RecTriggers    0x02000000  /* Enable recursive triggers */
#define SQLITE4_ForeignKeys    0x04000000  /* Enforce foreign key constraints  */
#define SQLITE4_AutoIndex      0x08000000  /* Enable automatic indexes */
#define SQLITE4_PreferBuiltin  0x10000000  /* Preference to built-in funcs */
#define SQLITE4_EnableTrigger  0x40000000  /* True to enable triggers */








<
<
<
<
|
|
>
>
>
|
<
|
<
<
|







889
890
891
892
893
894
895




896
897
898
899
900
901

902


903
904
905
906
907
908
909
910
*/
#define ENC(db) ((db)->aDb[0].pSchema->enc)

/*
** Possible values for the sqlite4.flags.
*/
#define SQLITE4_VdbeTrace      0x00000100  /* True to trace VDBE execution */




#define SQLITE4_SqlTrace       0x00000200  /* Debug print SQL as it executes */
#define SQLITE4_VdbeListing    0x00000400  /* Debug listings of VDBE programs */
#define SQLITE4_KvTrace        0x00000800  /* Trace Key/value storage calls */
#define SQLITE4_VdbeAddopTrace 0x00001000  /* Trace sqlite4VdbeAddOp() calls */
#define SQLITE4_InternChanges  0x00010000  /* Uncommitted Hash table changes */
#define SQLITE4_WriteSchema    0x00020000  /* OK to update SQLITE4_MASTER */

#define SQLITE4_IgnoreChecks   0x00040000  /* Dont enforce check constraints */


#define SQLITE4_RecoveryMode   0x00080000  /* Ignore schema errors */
#define SQLITE4_ReverseOrder   0x01000000  /* Reverse unordered SELECTs */
#define SQLITE4_RecTriggers    0x02000000  /* Enable recursive triggers */
#define SQLITE4_ForeignKeys    0x04000000  /* Enforce foreign key constraints  */
#define SQLITE4_AutoIndex      0x08000000  /* Enable automatic indexes */
#define SQLITE4_PreferBuiltin  0x10000000  /* Preference to built-in funcs */
#define SQLITE4_EnableTrigger  0x40000000  /* True to enable triggers */

Changes to src/vdbeaux.c.
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
** to version 2.8.7, all this code was combined into the vdbe.c source file.
** But that file was getting too big so this subroutines were split out.
*/
#include "sqliteInt.h"
#include "vdbeInt.h"



/*
** When debugging the code generator in a symbolic debugger, one can
** set the sqlite4VdbeAddopTrace to 1 and all opcodes will be printed
** as they are added to the instruction stream.
*/
#ifdef SQLITE4_DEBUG
int sqlite4VdbeAddopTrace = 0;
#endif


/*
** Create a new virtual database engine.
*/
Vdbe *sqlite4VdbeCreate(sqlite4 *db){
  Vdbe *p;
  p = sqlite4DbMallocZero(db, sizeof(Vdbe) );
  if( p==0 ) return 0;







<
<
<
<
<
<
<
<
<
<
<







14
15
16
17
18
19
20











21
22
23
24
25
26
27
** to version 2.8.7, all this code was combined into the vdbe.c source file.
** But that file was getting too big so this subroutines were split out.
*/
#include "sqliteInt.h"
#include "vdbeInt.h"













/*
** Create a new virtual database engine.
*/
Vdbe *sqlite4VdbeCreate(sqlite4 *db){
  Vdbe *p;
  p = sqlite4DbMallocZero(db, sizeof(Vdbe) );
  if( p==0 ) return 0;
148
149
150
151
152
153
154

155

156
157
158
159
160
161
162
  pOp->p1 = p1;
  pOp->p2 = p2;
  pOp->p3 = p3;
  pOp->p4.p = 0;
  pOp->p4type = P4_NOTUSED;
#ifdef SQLITE4_DEBUG
  pOp->zComment = 0;

  if( sqlite4VdbeAddopTrace ) sqlite4VdbePrintOp(0, i, &p->aOp[i]);

#endif
#ifdef VDBE_PROFILE
  pOp->cycles = 0;
  pOp->cnt = 0;
#endif
  return i;
}







>
|
>







137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
  pOp->p1 = p1;
  pOp->p2 = p2;
  pOp->p3 = p3;
  pOp->p4.p = 0;
  pOp->p4type = P4_NOTUSED;
#ifdef SQLITE4_DEBUG
  pOp->zComment = 0;
  if( p->db->flags & SQLITE4_VdbeAddopTrace ){
    sqlite4VdbePrintOp(0, i, &p->aOp[i]);
  }
#endif
#ifdef VDBE_PROFILE
  pOp->cycles = 0;
  pOp->cnt = 0;
#endif
  return i;
}
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
      }
      pOut->p3 = pIn->p3;
      pOut->p4type = P4_NOTUSED;
      pOut->p4.p = 0;
      pOut->p5 = 0;
#ifdef SQLITE4_DEBUG
      pOut->zComment = 0;
      if( sqlite4VdbeAddopTrace ){
        sqlite4VdbePrintOp(0, i+addr, &p->aOp[i+addr]);
      }
#endif
    }
    p->nOp += nOp;
  }
  return addr;







|







492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
      }
      pOut->p3 = pIn->p3;
      pOut->p4type = P4_NOTUSED;
      pOut->p4.p = 0;
      pOut->p5 = 0;
#ifdef SQLITE4_DEBUG
      pOut->zComment = 0;
      if( p->db->flags & SQLITE4_VdbeAddopTrace ){
        sqlite4VdbePrintOp(0, i+addr, &p->aOp[i+addr]);
      }
#endif
    }
    p->nOp += nOp;
  }
  return addr;
Changes to test/test_main.c.
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
  extern int sqlite4_pager_writej_count;
#if SQLITE4_OS_WIN
  extern int sqlite4_os_type;
#endif
#ifdef SQLITE4_DEBUG
  extern int sqlite4WhereTrace;
  extern int sqlite4OSTrace;
  extern int sqlite4VdbeAddopTrace;
#endif
#ifdef SQLITE4_TEST
  extern char sqlite4_query_plan[];
  static char *query_plan = sqlite4_query_plan;
#ifdef SQLITE4_ENABLE_FTS3
  extern int sqlite4_fts3_enable_parentheses;
#endif







<







4730
4731
4732
4733
4734
4735
4736

4737
4738
4739
4740
4741
4742
4743
  extern int sqlite4_pager_writej_count;
#if SQLITE4_OS_WIN
  extern int sqlite4_os_type;
#endif
#ifdef SQLITE4_DEBUG
  extern int sqlite4WhereTrace;
  extern int sqlite4OSTrace;

#endif
#ifdef SQLITE4_TEST
  extern char sqlite4_query_plan[];
  static char *query_plan = sqlite4_query_plan;
#ifdef SQLITE4_ENABLE_FTS3
  extern int sqlite4_fts3_enable_parentheses;
#endif
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
      (char*)&sqlite4_os_type, TCL_LINK_INT);
#endif
#ifdef SQLITE4_TEST
  Tcl_LinkVar(interp, "sqlite_query_plan",
      (char*)&query_plan, TCL_LINK_STRING|TCL_LINK_READ_ONLY);
#endif
#ifdef SQLITE4_DEBUG
  Tcl_LinkVar(interp, "sqlite_addop_trace",
      (char*)&sqlite4VdbeAddopTrace, TCL_LINK_INT);
  Tcl_LinkVar(interp, "sqlite_where_trace",
      (char*)&sqlite4WhereTrace, TCL_LINK_INT);
#endif
  Tcl_LinkVar(interp, "sqlite_static_bind_value",
      (char*)&sqlite_static_bind_value, TCL_LINK_STRING);
  Tcl_LinkVar(interp, "sqlite_static_bind_nbyte",
      (char*)&sqlite_static_bind_nbyte, TCL_LINK_INT);







<
<







4784
4785
4786
4787
4788
4789
4790


4791
4792
4793
4794
4795
4796
4797
      (char*)&sqlite4_os_type, TCL_LINK_INT);
#endif
#ifdef SQLITE4_TEST
  Tcl_LinkVar(interp, "sqlite_query_plan",
      (char*)&query_plan, TCL_LINK_STRING|TCL_LINK_READ_ONLY);
#endif
#ifdef SQLITE4_DEBUG


  Tcl_LinkVar(interp, "sqlite_where_trace",
      (char*)&sqlite4WhereTrace, TCL_LINK_INT);
#endif
  Tcl_LinkVar(interp, "sqlite_static_bind_value",
      (char*)&sqlite_static_bind_value, TCL_LINK_STRING);
  Tcl_LinkVar(interp, "sqlite_static_bind_nbyte",
      (char*)&sqlite_static_bind_nbyte, TCL_LINK_INT);