diff --git a/harbour/ChangeLog b/harbour/ChangeLog index ca28664363..08c64ee30a 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,27 @@ +2001-11-01 05:10 UTC-0800 Brian Hays + + * harbour/include/hbsetup.h + * Wrapped HB_FM_STATISTICS in #ifndef test so it can be + turned off by defining + HB_FM_STATISTICS_OFF in your make or bat files. + + * harbour/source/rtl/trace.c + + added HB_TRACESTRING() which lets prg code trace a + string into same trace file/window as C traces + + * harbour/source/vm/hvm.c + + added __TRACEPRGCALLS( ) --> + Turns on | off tracing of PRG-level function and + method calls. Dumps symbol name just before it's called. + Implementation follows example of + the Profiler; all actions are wrapped in an + "if" of a BOOL so there should be no performance + hit if it's turned off. + This is very useful when debugging GPFs as it will + trace all PRG-level calls up until the crash. + Uses HB_TRACE so traces are in line with any + C-level traces. + 2001-11-01 18:30 GMT+1 Martin Vogel + contrib/libct/datetime.prg diff --git a/harbour/include/hbsetup.h b/harbour/include/hbsetup.h index 89ba01a7c5..1496b3f306 100644 --- a/harbour/include/hbsetup.h +++ b/harbour/include/hbsetup.h @@ -56,13 +56,13 @@ #include /* *********************************************************************** - * Include settings common for .PRG and .C files + * Include settings common for .PRG and .C files */ #include "hbsetup.ch" /* *********************************************************************** * NOTE: You can select the default language modul used by Harbour, by - * defining this to a valid language modul identifier. + * defining this to a valid language modul identifier. */ #ifndef HB_LANG_DEFAULT @@ -119,9 +119,11 @@ * Note that if you turn this on, Harbour will be slighlty slower, larger * and will consume more memory. * - * By default this is turned on. + * By default this is turned on. Define HB_FM_STATISTICS_OFF to turn it off. */ -#define HB_FM_STATISTICS +#ifndef HB_FM_STATISTICS_OFF + #define HB_FM_STATISTICS +#endif /* *********************************************************************** * This symbol defines if we want an ability to create and link OBJ files @@ -195,7 +197,7 @@ * that the set of items doesn't change (there're no deleted or new * items, just swapping) in this functions. * Using this option makes sorting *much* faster, but if you have a - * problem, or the low level stuff changes, turn it off. [vszakats] + * problem, or the low level stuff changes, turn it off. [vszakats] */ #define HB_ASORT_OPT_ITEMCOPY diff --git a/harbour/source/rtl/trace.c b/harbour/source/rtl/trace.c index 11263a195b..c6fa2f6c57 100644 --- a/harbour/source/rtl/trace.c +++ b/harbour/source/rtl/trace.c @@ -51,6 +51,7 @@ */ #include "hbapi.h" +#include "hbtrace.h" #ifdef HB_EXTENSION @@ -64,5 +65,10 @@ HB_FUNC( HB_TRACELEVEL ) hb_retni( hb_tracelevel( ISNUM( 1 ) ? hb_parni( 1 ) : -1 ) ); } +HB_FUNC( HB_TRACESTRING ) +{ + HB_TRACE(HB_TR_ALWAYS, (hb_parc( 1 )) ); +} + #endif diff --git a/harbour/source/vm/hvm.c b/harbour/source/vm/hvm.c index d08b65394e..2e46e51c90 100644 --- a/harbour/source/vm/hvm.c +++ b/harbour/source/vm/hvm.c @@ -232,6 +232,7 @@ extern void * hb_mthRequested( void ); /* profiler from classes.c */ extern void hb_mthAddTime( void *, ULONG ); /* profiler from classes.c */ BOOL hb_bProfiler = FALSE; /* profiler status is off */ +BOOL hb_bTracePrgCalls = FALSE; /* prg tracing is off */ /* virtual machine state */ @@ -3046,6 +3047,9 @@ void hb_vmDo( USHORT uiParams ) if( bProfiler ) pMethod = hb_mthRequested(); + if ( hb_bTracePrgCalls ) + HB_TRACE(HB_TR_ALWAYS, ("Calling: %s", pSym->szName)); + pFunc(); if (lPopSuper && pSelfBase->puiClsTree) @@ -3093,6 +3097,9 @@ void hb_vmDo( USHORT uiParams ) pSym->pDynSym->ulRecurse++; } + if ( hb_bTracePrgCalls ) + HB_TRACE(HB_TR_ALWAYS, ("Calling: %s", pSym->szName)); + pFunc(); if( bProfiler && pSym->pDynSym ) @@ -3205,6 +3212,9 @@ void hb_vmSend( USHORT uiParams ) if( bProfiler ) pMethod = hb_mthRequested(); + if ( hb_bTracePrgCalls ) + HB_TRACE(HB_TR_ALWAYS, ("Calling: %s", pSym->szName)); + pFunc(); if (lPopSuper && pSelfBase->puiClsTree) @@ -3300,6 +3310,9 @@ void hb_vmSend( USHORT uiParams ) pSym->pDynSym->ulRecurse++; } + if ( hb_bTracePrgCalls ) + HB_TRACE(HB_TR_ALWAYS, ("Calling: %s", pSym->szName)); + pFunc(); if( bProfiler && pSym->pDynSym ) @@ -4715,3 +4728,16 @@ HB_FUNC( __SETPROFILER ) hb_retl( bOldValue ); } + +/* $Doc$ + * $FuncName$ __TRACEPRGCALLS( ) --> + * $Description$ Turns on | off tracing of PRG-level function and method calls + * $End$ */ +HB_FUNC( __TRACEPRGCALLS ) +{ + BOOL bOldValue = hb_bTracePrgCalls; + + hb_bTracePrgCalls = hb_parl( 1 ); + + hb_retl( bOldValue ); +}