Re: [Monetdb-developers] [Monetdb-checkins] MonetDB5/src/mal mal_debugger.mx, Feb2009, 1.256.2.2, 1.256.2.3
[Pre-nighlty testing compilation check service] Fails to compile with icc & gcc with optimization enabled: .../MonetDB5/src/mal/mal_debugger.mx(1501): error #592: variable "p" is used before its value is set mdbCommand(cntxt, mb, stk, p, pc); ^ Stefam On Wed, Mar 04, 2009 at 03:54:07PM +0000, Martin Kersten wrote:
Update of /cvsroot/monetdb/MonetDB5/src/mal In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv10776
Modified Files: Tag: Feb2009 mal_debugger.mx Log Message: The debugger command 'bbp trace <pattern>' has been added to keep a watch over the lref status of bats in the bbp.
U mal_debugger.mx Index: mal_debugger.mx =================================================================== RCS file: /cvsroot/monetdb/MonetDB5/src/mal/mal_debugger.mx,v retrieving revision 1.256.2.2 retrieving revision 1.256.2.3 diff -u -d -r1.256.2.2 -r1.256.2.3 --- mal_debugger.mx 12 Feb 2009 06:34:16 -0000 1.256.2.2 +++ mal_debugger.mx 4 Mar 2009 15:54:04 -0000 1.256.2.3 @@ -489,6 +489,7 @@ mal_export void printBatInfo(stream *f, VarPtr n, ValPtr v); mal_export void printBatProperties(stream *f, VarPtr n, ValPtr v, str props); mal_export void printTraceCall(stream *out, MalBlkPtr mb, MalStkPtr stk, int pc, int flags); +mal_export char BBPTraceCall(Client cntxt, MalBlkPtr mb, MalStkPtr stk, int pc); mal_export str call2str(MalBlkPtr mb, MalStkPtr stk, int pc, int flags);
mal_export str runMALDebugger(Client cntxt, Symbol s); @@ -742,6 +743,63 @@ stream_printf(out, "#%s\n", msg); GDKfree(msg); } +static void +mdbBacktrace(Client cntxt, MalStkPtr stk, int pci){ + for (; stk != NULL; stk = stk->up) { + printCall(cntxt, stk->blk, stk, pci); + if (stk->up) + pci = stk->up->pcup; + } +} +@- +Sometimes we may want to trace the changes applied to the +BAT buffer pool and report them together with the MAL +instruction where it happened. +@c +static int BBPtraceEnabled = 0; +static str BBPtracePattern = NULL; +char +BBPTraceCall(Client cntxt, MalBlkPtr mb, MalStkPtr stk, int pc) +{ + static int *BBPmirror = NULL; + static int bbpsize; + char lbuf[1024], pbuf[1024]; + int i, action; + (void) mb; + + if ( BBPtraceEnabled == 0) + return 0; + if (BBPmirror == NULL ){ + bbpsize= BBPsize; + BBPmirror = (int*) GDKzalloc(sizeof(int) * BBPsize); + } + if( BBPsize > bbpsize) { + int *old = BBPmirror; + BBPmirror = (int*) GDKzalloc(sizeof(int) * BBPsize); + memcpy((char*)BBPmirror, (char*)old, sizeof(int) * bbpsize); + bbpsize= BBPsize; + GDKfree(old); + } + /* no growing BBP yet */ + action = 0; + for ( i=0; i
fdout, "#BBP state change of %s %s entry %d refs %d:\n", + lbuf,pbuf,i, BBP_lrefs(i)); + action = 1; + } + BBPmirror[i] = BBP_lrefs(i); + } + if ( action ) + mdbBacktrace(cntxt, stk, pc); + return 's'; +} static void printBATproperties(stream *f, BAT *b){ @@ -756,7 +814,7 @@ if (b->T->parentid) stream_printf(f, "tail view on %s ", BBPname(b->T->parentid)); } -@+ MAL parser +@+ MAL debugger parser The debugger structure is inherited from GDB. The routine mdbCommand is called with p=0 after finishing a mal- function call and before continuing at the next level of invocation. @@ -802,14 +860,6 @@ return getMalBlkHistory(mb,-1); }
-static void -mdbBacktrace(Client cntxt, MalStkPtr stk, int pci){ - for (; stk != NULL; stk = stk->up) { - printCall(cntxt, stk->blk, stk, pci); - if (stk->up) - pci = stk->up->pcup; - } -}
void mdbCommand(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr p, int pc) @@ -1089,6 +1139,16 @@ int i,limit;
skipWord(cntxt, b); + /* bbp change tracing enabling */ + if ( strncmp(b,"trace",5) == 0){ + skipWord(cntxt, b); + BBPtraceEnabled = !BBPtraceEnabled; + if ( BBPtraceEnabled && *b ) + BBPtracePattern = GDKstrdup(b); + stream_printf(out,"#bbp trace enabled %d\n", BBPtraceEnabled); + stk->cmd = 'c'; + break; + } i = BBPindex(b); if( i) limit=i+1; @@ -1437,6 +1497,8 @@ return; }
+ if ( BBPTraceCall(cntxt,mb,stk,pc)) + mdbCommand(cntxt, mb, stk, p, pc); switch (stk->cmd) { case 'c': p = getInstrPtr(mb, pc);
------------------------------------------------------------------------------ Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise -Strategies to boost innovation and cut costs with open source participation -Receive a $600 discount off the registration fee with the source code: SFAD http://p.sf.net/sfu/XcvMzF8H _______________________________________________ Monetdb-checkins mailing list Monetdb-checkins@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/monetdb-checkins
-- | Dr. Stefan Manegold | mailto:Stefan.Manegold@cwi.nl | | CWI, P.O.Box 94079 | http://www.cwi.nl/~manegold/ | | 1090 GB Amsterdam | Tel.: +31 (20) 592-4212 | | The Netherlands | Fax : +31 (20) 592-4312 |
participants (1)
-
Stefan Manegold