From: Terrance S. <ts...@us...> - 2006-08-28 13:59:08
|
Update of /cvsroot/xsb/XSB/emu In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv9038 Modified Files: emuloop.c debug_xsb.h emudef.h debug_xsb.c Log Message: debug_xsb.c -- changes to allow print_delay_list from generic debug config emuloop.c -- removed call to gdb_dummy emudef.h -- Change to affect the ordering of checks for interrupt vectors at call and proceed. We had been checking for spy points before checking for attributed variable interrupts, and I reversed the order, allowing me to use the debugger/tracer on CHR programs (still not a great way to debug, but better than nothing for now). I've been using this change for a couple of days, and it seems to have no effect (as indeed it shouldn't) but please let me know if it seems to be changing anything in your code. Index: emuloop.c =================================================================== RCS file: /cvsroot/xsb/XSB/emu/emuloop.c,v retrieving revision 1.141 retrieving revision 1.142 diff -u -r1.141 -r1.142 --- emuloop.c 21 Jul 2006 20:20:46 -0000 1.141 +++ emuloop.c 28 Aug 2006 13:58:47 -0000 1.142 @@ -1291,7 +1291,6 @@ XSB_End_Instr() XSB_Start_Instr(dyntrustmeelsefail,_dyntrustmeelsefail) /* PPA-L, second word ignored */ - gdb_dummy(); Def1op Op1(get_xxa); handle_xsb_profile_interrupt; Index: debug_xsb.h =================================================================== RCS file: /cvsroot/xsb/XSB/emu/debug_xsb.h,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- debug_xsb.h 9 Jan 2006 00:06:30 -0000 1.7 +++ debug_xsb.h 28 Aug 2006 13:58:47 -0000 1.8 @@ -68,6 +68,12 @@ #define LOG_BD LOG_LOUD #define LOG_COMPLETION LOG_LOUD +#ifndef MULTI_THREAD +extern void print_delay_list(FILE *, CPtr); +#else +extern void print_delay_list(struct th_context * ,FILE *, CPtr); +#endif + /* dbg_* macros */ #ifdef DEBUG_VERBOSE /* in error_xsb.c */ @@ -92,12 +98,10 @@ if (LOG_LEVEL <= cur_log_level) \ dsPrint(DS,COMMENT) - #define dbg_smPrint(LOG_LEVEL,SM_RECORD,STRING) \ if (LOG_LEVEL <= cur_log_level) \ smPrint(SM_RECORD,STRING) - /* in tst_utils.c */ #define dbg_printTriePathType(LOG_LEVEL,FP,TYPE,LEAF) \ if (LOG_LEVEL <= cur_log_level) \ @@ -110,7 +114,6 @@ printAnswerTemplate(FP,PAT,S) extern void print_completion_stack(void); extern void print_subgoal(FILE *, VariantSF); -extern void print_delay_list(FILE *, CPtr); extern void printterm(FILE *, Cell, int); #else @@ -118,6 +121,7 @@ #define dbg_print_subgoal(L,F,S) #define dbg_printterm(L,F,T,D) #define dbg_print_completion_stack(L) + #define dbg_print_delay_list(L,F,D) #define dbg_dsPrint(L,D,C) #define dbg_smPrint(L,SR,ST) Index: emudef.h =================================================================== RCS file: /cvsroot/xsb/XSB/emu/emudef.h,v retrieving revision 1.59 retrieving revision 1.60 diff -u -r1.59 -r1.60 --- emudef.h 6 Feb 2006 20:20:03 -0000 1.59 +++ emudef.h 28 Aug 2006 13:58:47 -0000 1.60 @@ -324,8 +324,13 @@ if ( !(asynint_val) & !int_val(cell(interrupt_reg)) ) { \ lpcreg = (pb)get_ep(PSC); \ } else { \ - if (asynint_val) { \ - if (asynint_val & KEYINT_MARK) { \ + if (int_val(cell(interrupt_reg))) { \ + synint_proc(CTXTc PSC, MYSIG_ATTV); \ + lpcreg = pcreg; \ + } \ + else { \ + if (asynint_val) { \ + if (asynint_val & KEYINT_MARK) { \ synint_proc(CTXTc PSC, MYSIG_KEYB); \ lpcreg = pcreg; \ asynint_val = asynint_val & ~KEYINT_MARK; \ @@ -348,11 +353,9 @@ lpcreg = (byte *)get_ep(PSC); \ asynint_val = 0; \ } \ - } else if (int_val(cell(interrupt_reg))) { \ - synint_proc(CTXTc PSC, MYSIG_ATTV); \ - lpcreg = pcreg; \ } \ } \ + } \ } #define proceed_sub { \ Index: debug_xsb.c =================================================================== RCS file: /cvsroot/xsb/XSB/emu/debug_xsb.c,v retrieving revision 1.33 retrieving revision 1.34 diff -u -r1.33 -r1.34 --- debug_xsb.c 21 Aug 2006 10:47:26 -0000 1.33 +++ debug_xsb.c 28 Aug 2006 13:58:47 -0000 1.34 @@ -462,36 +462,13 @@ fclose(where) ; } /* print_cp */ -/*======================================================================*/ -/* The third set of routines should be useful with gdb. They need to */ -/* be revised to get rid of the xsb_dbg stuff, and so that they're */ -/* defined whenever we configure with -dbg */ -/*======================================================================*/ - -#if (defined(DEBUG_VERBOSE) || defined(DEBUG_VM)) - -static int count_producer_subgoals(void) -{ - int i; - TIFptr tif; - VariantSF temp_ptr; - - i = 0; - - SYS_MUTEX_LOCK( MUTEX_TABLE ); - for ( tif = tif_list.first; IsNonNULL(tif); tif = TIF_NextTIF(tif) ) - for ( temp_ptr = TIF_Subgoals(tif); IsNonNULL(temp_ptr); - temp_ptr = (VariantSF)subg_next_subgoal(temp_ptr) ) - i ++; - SYS_MUTEX_UNLOCK( MUTEX_TABLE ); - return(i); -} - /*----- For table debugging --------------------------------------------*/ +#ifndef MULTI_THREAD static Cell cell_array[500]; +#endif -static void print_term_of_subgoal(FILE *fp, int *i) +static void print_term_of_subgoal(CTXTdeclc FILE *fp, int *i) { Cell term; int j, args; @@ -508,7 +485,7 @@ if (args > 0) fprintf(fp, "("); for (j = args; j > 0; j--) { (*i)--; - print_term_of_subgoal(fp, i); + print_term_of_subgoal(CTXTc fp, i); if (j > 1) fprintf(fp, ","); } if (args > 0) fprintf(fp, ")"); @@ -525,9 +502,9 @@ */ fprintf(fp, "["); (*i)--; - print_term_of_subgoal(fp, i); + print_term_of_subgoal(CTXTc fp, i); (*i)--; - print_term_of_subgoal(fp, i); + print_term_of_subgoal(CTXTc fp, i); fprintf(fp, "]"); break; case XSB_STRING: @@ -549,7 +526,7 @@ /*----------------------------------------------------------------------*/ -void print_subgoal(FILE *fp, VariantSF subg) +void print_subgoal(CTXTdeclc FILE *fp, VariantSF subg) { BTNptr leaf; int i = 0; @@ -563,7 +540,7 @@ if (get_arity(psc) > 0) { fprintf(fp, "("); for (i = i-2; i >= 0 ; i--) { - print_term_of_subgoal(fp, &i); + print_term_of_subgoal(CTXTc fp, &i); if (i > 0) fprintf(fp, ", "); } fprintf(fp, ")"); @@ -572,7 +549,7 @@ /*----------------------------------------------------------------------*/ -static void print_delay_element(FILE *fp, Cell del_elem) +static void print_delay_element(CTXTdeclc FILE *fp, Cell del_elem) { Psc psc = 0; CPtr cptr; @@ -584,7 +561,7 @@ fprintf(fp, "%s(", get_name(psc)); cptr = (CPtr)cs_val(del_elem); tmp_cell = cell(cptr + 1); - print_subgoal(fp, (VariantSF) addr_val(tmp_cell)); fprintf(fp, ","); + print_subgoal(CTXTc fp, (VariantSF) addr_val(tmp_cell)); fprintf(fp, ","); tmp_cell = cell(cptr + 2); fprintf(fp, "%p", (BTNptr) addr_val(tmp_cell)); fprintf(fp, ","); tmp_cell = cell(cptr + 3); @@ -617,7 +594,7 @@ /*----------------------------------------------------------------------*/ -void print_delay_list(FILE *fp, CPtr dlist) +void print_delay_list(CTXTdeclc FILE *fp, CPtr dlist) { CPtr cptr; @@ -628,7 +605,7 @@ fprintf(fp, "["); cptr = dlist; while (islist(cptr)) { cptr = clref_val(cptr); - print_delay_element(fp, cell(cptr)); + print_delay_element(CTXTc fp, cell(cptr)); cptr = (CPtr)cell(cptr+1); if (islist(cptr)) fprintf(fp, ", "); } @@ -643,6 +620,31 @@ } } +/*======================================================================*/ +/* The third set of routines should be useful with gdb. They need to */ +/* be revised to get rid of the xsb_dbg stuff, and so that they're */ +/* defined whenever we configure with -dbg */ +/*======================================================================*/ + +#if (defined(DEBUG_VERBOSE) || defined(DEBUG_VM)) + +static int count_producer_subgoals(void) +{ + int i; + TIFptr tif; + VariantSF temp_ptr; + + i = 0; + + SYS_MUTEX_LOCK( MUTEX_TABLE ); + for ( tif = tif_list.first; IsNonNULL(tif); tif = TIF_NextTIF(tif) ) + for ( temp_ptr = TIF_Subgoals(tif); IsNonNULL(temp_ptr); + temp_ptr = (VariantSF)subg_next_subgoal(temp_ptr) ) + i ++; + SYS_MUTEX_UNLOCK( MUTEX_TABLE ); + return(i); +} + /*-------------------------------------------------------------------------*/ /* |