1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-07 02:42:48 +03:00

Enhancements to aid testing and debugging:

In PRAGMA vdbe_trace=on output, show pScopyFrom dependencies on register
values.  Add the sqlite3VdbeRegisterDump() procedure, callable from a
debugger, that shows the values of all registers.  Pass the VDBE pointer
into test_trace_breakpoint() so that sqlite3VdbeRegisterDump() is callable
from the breakpoint.

FossilOrigin-Name: 9886cb4b7987f720aa9d701222ab0987caa0ab8c5d216cb6e523c4a45366dfe5
This commit is contained in:
drh
2020-01-02 14:42:42 +00:00
parent 52f11b885a
commit 22e95fbd74
4 changed files with 30 additions and 12 deletions

View File

@@ -131,7 +131,7 @@ int sqlite3_found_count = 0;
** sqlite3MisuseError(lineno)
** sqlite3CantopenError(lineno)
*/
static void test_trace_breakpoint(int pc, Op *pOp){
static void test_trace_breakpoint(int pc, Op *pOp, Vdbe *v){
static int n = 0;
n++;
}
@@ -586,13 +586,28 @@ static void memTracePrint(Mem *p){
if( p->flags & MEM_Subtype ) printf(" subtype=0x%02x", p->eSubtype);
}
static void registerTrace(int iReg, Mem *p){
printf("REG[%d] = ", iReg);
printf("R[%d] = ", iReg);
memTracePrint(p);
if( p->pScopyFrom ){
printf(" <== R[%d]", (int)(p->pScopyFrom - &p[-iReg]));
}
printf("\n");
sqlite3VdbeCheckMemInvariants(p);
}
#endif
#ifdef SQLITE_DEBUG
/*
** Show the values of all registers in the virtual machine. Used for
** interactive debugging.
*/
void sqlite3VdbeRegisterDump(Vdbe *v){
int i;
for(i=1; i<v->nMem; i++) registerTrace(i, v->aMem+i);
}
#endif /* SQLITE_DEBUG */
#ifdef SQLITE_DEBUG
# define REGISTER_TRACE(R,M) if(db->flags&SQLITE_VdbeTrace)registerTrace(R,M)
#else
@@ -758,7 +773,7 @@ int sqlite3VdbeExec(
#ifdef SQLITE_DEBUG
if( db->flags & SQLITE_VdbeTrace ){
sqlite3VdbePrintOp(stdout, (int)(pOp - aOp), pOp);
test_trace_breakpoint((int)(pOp - aOp),pOp);
test_trace_breakpoint((int)(pOp - aOp),pOp,p);
}
#endif