mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-19 21:43:15 +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:
21
src/vdbe.c
21
src/vdbe.c
@@ -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
|
||||
|
||||
|
||||
@@ -956,6 +956,10 @@ void sqlite3VdbeMemAboutToChange(Vdbe *pVdbe, Mem *pMem){
|
||||
Mem *pX;
|
||||
for(i=0, pX=pVdbe->aMem; i<pVdbe->nMem; i++, pX++){
|
||||
if( pX->pScopyFrom==pMem ){
|
||||
if( pVdbe->db->flags & SQLITE_VdbeTrace ){
|
||||
sqlite3DebugPrintf("Invalidate R[%d] due to change in R[%d]\n",
|
||||
(int)(pX - pVdbe->aMem), (int)(pMem - pVdbe->aMem));
|
||||
}
|
||||
/* If pX is marked as a shallow copy of pMem, then verify that
|
||||
** no significant changes have been made to pX since the OP_SCopy.
|
||||
** A significant change would indicated a missed call to this
|
||||
@@ -980,7 +984,6 @@ void sqlite3VdbeMemAboutToChange(Vdbe *pVdbe, Mem *pMem){
|
||||
}
|
||||
#endif /* SQLITE_DEBUG */
|
||||
|
||||
|
||||
/*
|
||||
** Make an shallow copy of pFrom into pTo. Prior contents of
|
||||
** pTo are freed. The pFrom->z field is not duplicated. If
|
||||
|
||||
Reference in New Issue
Block a user