From ecbbead1643e4418ea4f0dbdde6c5a0197faba9d Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Tue, 5 Aug 2008 21:47:58 +0000 Subject: [PATCH] 2008-08-05 23:47 UTC+0200 Viktor Szakats (harbour.01 syenar hu) * source/rtl/errorint.c * source/vm/estack.c * source/vm/hvm.c * source/vm/extrap.c + Added filename to stack traces. Someone please review me. Also, pls test if it compiles cleanly with OS/2. --- harbour/ChangeLog | 8 ++++++++ harbour/source/rtl/errorint.c | 5 +++-- harbour/source/vm/estack.c | 5 +++-- harbour/source/vm/extrap.c | 10 ++++++---- harbour/source/vm/hvm.c | 5 +++-- 5 files changed, 23 insertions(+), 10 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index d874616972..d9edcee255 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,14 @@ 2008-12-31 13:59 UTC+0100 Foo Bar */ +2008-08-05 23:47 UTC+0200 Viktor Szakats (harbour.01 syenar hu) + * source/rtl/errorint.c + * source/vm/estack.c + * source/vm/hvm.c + * source/vm/extrap.c + + Added filename to stack traces. Someone please review me. + Also, pls test if it compiles cleanly with OS/2. + 2008-08-05 21:39 UTC+0200 Viktor Szakats (harbour.01 syenar hu) * source/hbpcre/_hbconf.h * source/hbzlib/zconf.h diff --git a/harbour/source/rtl/errorint.c b/harbour/source/rtl/errorint.c index b775e5e14c..1e5626649a 100644 --- a/harbour/source/rtl/errorint.c +++ b/harbour/source/rtl/errorint.c @@ -62,6 +62,7 @@ void hb_errInternal( ULONG ulIntCode, const char * szText, const char * szPar1, const char * szPar2 ) { char buffer[ 1024 ]; + char file[ _POSIX_PATH_MAX + 1 ]; USHORT uiLine; int iLevel; FILE * hLog; @@ -117,11 +118,11 @@ void hb_errInternal( ULONG ulIntCode, const char * szText, const char * szPar1, fprintf( hLog, "%s\n", buffer ); iLevel = 0; - while( hb_procinfo( iLevel++, buffer, &uiLine, NULL ) ) + while( hb_procinfo( iLevel++, buffer, &uiLine, file ) ) { char msg[ HB_SYMBOL_NAME_LEN + HB_SYMBOL_NAME_LEN + 32 ]; - snprintf( msg, sizeof( msg ), HB_I_("Called from %s(%hu)\n"), buffer, uiLine ); + snprintf( msg, sizeof( msg ), HB_I_("Called from %s(%hu)%s%s\n"), buffer, uiLine, *file ? HB_I_(" in ") : "", file ); hb_conOutErr( msg, 0 ); if( hLog ) diff --git a/harbour/source/vm/estack.c b/harbour/source/vm/estack.c index 3dd95ec85a..12edafbdae 100644 --- a/harbour/source/vm/estack.c +++ b/harbour/source/vm/estack.c @@ -588,6 +588,7 @@ void hb_stackDispLocal( void ) void hb_stackDispCall( void ) { char buffer[ HB_SYMBOL_NAME_LEN + HB_SYMBOL_NAME_LEN + 5 + 10 ]; /* additional 10 bytes for line info (%hu) overhead */ + char file[ _POSIX_PATH_MAX + 1 ]; USHORT uiLine; int iLevel; @@ -595,10 +596,10 @@ void hb_stackDispCall( void ) iLevel = 0; - while( hb_procinfo( iLevel++, buffer, &uiLine, NULL ) ) + while( hb_procinfo( iLevel++, buffer, &uiLine, file ) ) { int l = strlen( buffer ); - snprintf( buffer + l, sizeof( buffer ) - l, "(%hu)", uiLine ); + snprintf( buffer + l, sizeof( buffer ) - l, "(%hu)%s%s", uiLine, *file ? HB_I_(" in ") : "", file ); hb_conOutErr( "Called from ", 0 ); hb_conOutErr( buffer, 0 ); diff --git a/harbour/source/vm/extrap.c b/harbour/source/vm/extrap.c index 2f0c2b1043..a64d397ef2 100644 --- a/harbour/source/vm/extrap.c +++ b/harbour/source/vm/extrap.c @@ -76,6 +76,7 @@ LONG WINAPI hb_win32ExceptionHandler( struct _EXCEPTION_POINTERS * pExceptionInf { char msg[ ( HB_SYMBOL_NAME_LEN + HB_SYMBOL_NAME_LEN + 32 ) * 32 ]; char buffer[ HB_SYMBOL_NAME_LEN + HB_SYMBOL_NAME_LEN + 5 ]; + char file[ _POSIX_PATH_MAX + 1 ]; char * ptr; USHORT uiLine; int iLevel; @@ -189,10 +190,10 @@ LONG WINAPI hb_win32ExceptionHandler( struct _EXCEPTION_POINTERS * pExceptionInf ptr = msg; iLevel = 0; - while( hb_procinfo( iLevel++, buffer, &uiLine, NULL ) ) + while( hb_procinfo( iLevel++, buffer, &uiLine, file ) ) { snprintf( ptr, sizeof( msg ) - ( ptr - msg ), - HB_I_("Called from %s(%hu)\n"), buffer, uiLine ); + HB_I_("Called from %s(%hu)%s%s\n"), buffer, uiLine, *file ? HB_I_(" in ") : "", file ); if( hLog ) fwrite( ptr, sizeof( *ptr ), strlen( ptr ), hLog ); @@ -235,13 +236,14 @@ ULONG _System hb_os2ExceptionHandler( PEXCEPTIONREPORTRECORD p1, if( p1->ExceptionNum != XCPT_UNWIND && p1->ExceptionNum < XCPT_BREAKPOINT ) { char buffer[ HB_SYMBOL_NAME_LEN + HB_SYMBOL_NAME_LEN + 5 ]; + char file[ _POSIX_PATH_MAX + 1 ]; USHORT uiLine; int iLevel = 0; fprintf( stderr, HB_I_("\nException %lx at address %p \n"), p1->ExceptionNum, p1->ExceptionAddress ); - while( hb_procinfo( iLevel++, buffer, &uiLine, NULL ) ) - fprintf( stderr, HB_I_("Called from %s(%hu)\n"), buffer, uiLine ); + while( hb_procinfo( iLevel++, buffer, &uiLine, file ) ) + fprintf( stderr, HB_I_("Called from %s(%hu)%s%s\n"), buffer, uiLine, *file ? HB_I_(" in ") : "", file ); } return XCPT_CONTINUE_SEARCH; /* Exception not resolved... */ diff --git a/harbour/source/vm/hvm.c b/harbour/source/vm/hvm.c index 8277d577c2..aedc9dedf4 100644 --- a/harbour/source/vm/hvm.c +++ b/harbour/source/vm/hvm.c @@ -7122,16 +7122,17 @@ void hb_vmRequestCancel( void ) if( hb_set.HB_SET_CANCEL ) { char buffer[ HB_SYMBOL_NAME_LEN + HB_SYMBOL_NAME_LEN + 5 + 10 ]; /* additional 10 bytes for line info (%hu) overhead */ + char file[ _POSIX_PATH_MAX + 1 ]; USHORT uiLine; int iLevel = 0, l; hb_conOutErr( hb_conNewLine(), 0 ); hb_conOutErr( "Cancelled at: ", 0 ); - while( hb_procinfo( iLevel++, buffer, &uiLine, NULL ) ) + while( hb_procinfo( iLevel++, buffer, &uiLine, file ) ) { l = strlen( buffer ); - snprintf( buffer + l, sizeof( buffer ) - l, " (%hu)", uiLine ); + snprintf( buffer + l, sizeof( buffer ) - l, " (%hu)%s%s", uiLine, *file ? HB_I_(" in ") : "", file ); hb_conOutErr( buffer, 0 ); hb_conOutErr( hb_conNewLine(), 0 );