From 2bb711b6c896d9d0c300b1810ade96d4ec9ae1e4 Mon Sep 17 00:00:00 2001 From: Przemyslaw Czerpak Date: Sun, 15 Apr 2007 12:37:15 +0000 Subject: [PATCH] 2007-04-15 14:35 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/source/compiler/hbmain.c * harbour/source/vm/dbgentry.c * harbour/source/vm/hvm.c ! fixed GPF in debugger --- harbour/ChangeLog | 5 +++++ harbour/source/compiler/hbmain.c | 10 ++++++++-- harbour/source/vm/dbgentry.c | 14 +++++++++----- harbour/source/vm/hvm.c | 4 ++-- 4 files changed, 24 insertions(+), 9 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 53ad332137..0f454fe66a 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,11 @@ 2002-12-01 13:30 UTC+0100 Foo Bar */ +2007-04-15 14:35 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/source/compiler/hbmain.c + * harbour/source/vm/dbgentry.c + * harbour/source/vm/hvm.c + ! fixed GPF in debugger 2007-04-15 11:20 UTC+0200 Francesco Saverio Giudice (info/at/fsgiudice.com) + harbour/contrib/gd/tests/images_in/conv_test.jpeg diff --git a/harbour/source/compiler/hbmain.c b/harbour/source/compiler/hbmain.c index 26810505ba..584f478274 100644 --- a/harbour/source/compiler/hbmain.c +++ b/harbour/source/compiler/hbmain.c @@ -4072,6 +4072,7 @@ void hb_compCodeBlockEnd( HB_COMP_DECL ) { PFUNCTION pCodeblock; /* pointer to the current codeblock */ PFUNCTION pFunc;/* pointer to a function that owns a codeblock */ + char * pFuncName; ULONG ulSize; USHORT wLocals = 0; /* number of referenced local variables */ USHORT wLocalsCnt, wLocalsLen; @@ -4092,8 +4093,13 @@ void hb_compCodeBlockEnd( HB_COMP_DECL ) /* find the function that owns the codeblock */ pFunc = pCodeblock->pOwner; + pFuncName = pFunc->szName; while( pFunc->pOwner ) + { pFunc = pFunc->pOwner; + if( pFunc->szName && *pFunc->szName ) + pFuncName = pFunc->szName; + } pFunc->bFlags |= ( pCodeblock->bFlags & FUN_USES_STATICS ); @@ -4119,7 +4125,7 @@ void hb_compCodeBlockEnd( HB_COMP_DECL ) ulSize = pCodeblock->lPCodePos + 2; if( HB_COMP_PARAM->fDebugInfo ) { - ulSize += 3 + strlen( hb_pp_fileName( HB_COMP_PARAM->pLex->pPP ) ) + strlen( pFunc->szName ); + ulSize += 3 + strlen( HB_COMP_PARAM->currModule ) + strlen( pFuncName ); ulSize += wLocalsLen; } @@ -4159,7 +4165,7 @@ void hb_compCodeBlockEnd( HB_COMP_DECL ) if( HB_COMP_PARAM->fDebugInfo ) { - hb_compGenModuleName( HB_COMP_PARAM, pFunc->szName ); + hb_compGenModuleName( HB_COMP_PARAM, pFuncName ); /* generate the name of referenced local variables */ pVar = pCodeblock->pStatics; diff --git a/harbour/source/vm/dbgentry.c b/harbour/source/vm/dbgentry.c index e6b342010c..41eabfe8aa 100644 --- a/harbour/source/vm/dbgentry.c +++ b/harbour/source/vm/dbgentry.c @@ -424,6 +424,7 @@ hb_dbgEntry( int nMode, int nLine, char *szName, int nIndex, int nFrame ) if ( szName[ strlen( szName ) - 1 ] == ':' ) return; + hb_procinfo( 0, szProcName, NULL, NULL ); if ( !strncmp( szProcName, "(_INITSTATICS", 13 ) ) info->bInitStatics = TRUE; @@ -431,12 +432,14 @@ hb_dbgEntry( int nMode, int nLine, char *szName, int nIndex, int nFrame ) info->bInitGlobals = TRUE; else if ( !strncmp( szProcName, "(_INITLINES", 11 ) ) info->bInitLines = TRUE; + if ( info->bInitStatics || info->bInitGlobals ) hb_dbgAddModule( info, szName ); else if ( !strncmp( szProcName, "(b)", 3 ) ) info->bCodeBlock = TRUE; else if ( info->bNextRoutine ) info->bNextRoutine = FALSE; + hb_dbgAddStack( info, szName, hb_dbg_ProcLevel() ); for ( i = 0; i < info->nBreakPoints; i++ ) { @@ -678,7 +681,7 @@ hb_dbgAddStack( HB_DEBUGINFO *info, char *szName, int nProcLevel ) else { /* We're in an (_INITSTATICSnnnnn) pseudo-function */ - char szName[ HB_SYMBOL_NAME_LEN + HB_SYMBOL_NAME_LEN + 5]; + char szName[ HB_SYMBOL_NAME_LEN + HB_SYMBOL_NAME_LEN + 5 ]; hb_procinfo( 0, szName, NULL, NULL ); top->szFunction = STRDUP( szName ); @@ -925,7 +928,7 @@ hb_dbgEndProc( HB_DEBUGINFO *info ) if ( !info->nCallStackLen ) return; - top = &info->aCallStack[ info->nCallStackLen - 1 ]; + top = &info->aCallStack[ --info->nCallStackLen ]; FREE( top->szFunction ); FREE( top->szModule ); if ( top->nLocals ) @@ -936,10 +939,10 @@ hb_dbgEndProc( HB_DEBUGINFO *info ) { FREE( top->aStatics ); } - info->nCallStackLen--; if ( !info->nCallStackLen ) { FREE( info->aCallStack ); + info->aCallStack = NULL; } } @@ -1480,12 +1483,13 @@ hb_dbgQuit( HB_DEBUGINFO *info ) } while ( info->nModules ) { - HB_MODULEINFO *module = &info->aModules[ info->nModules - 1 ]; + int nModules = info->nModules - 1; + HB_MODULEINFO *module = &info->aModules[ nModules ]; if ( module->nStatics ) { FREE( module->aStatics ); } - ARRAY_DEL( HB_MODULEINFO, info->aModules, info->nModules, info->nModules - 1 ); + ARRAY_DEL( HB_MODULEINFO, info->aModules, info->nModules, nModules ); } } diff --git a/harbour/source/vm/hvm.c b/harbour/source/vm/hvm.c index 54707b54f3..88d117fed3 100644 --- a/harbour/source/vm/hvm.c +++ b/harbour/source/vm/hvm.c @@ -5053,7 +5053,7 @@ static void hb_vmLocalName( USHORT uiLocal, char * szLocalName ) /* locals and p { HB_TRACE(HB_TR_DEBUG, ("hb_vmLocalName(%hu, %s)", uiLocal, szLocalName)); - if( s_pDynsDbgEntry ) + if( s_pDynsDbgEntry && s_bDebugging ) { s_bDebugging = TRUE; s_bDebugShowLines = FALSE; @@ -5080,7 +5080,7 @@ static void hb_vmStaticName( BYTE bIsGlobal, USHORT uiStatic, char * szStaticNam HB_SYMBOL_UNUSED( bIsGlobal ); - if( s_pDynsDbgEntry ) + if( s_pDynsDbgEntry && s_bDebugging ) { s_bDebugging = TRUE; s_bDebugShowLines = FALSE;