2009-02-02 11:02 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)

* harbour/source/vm/fm.c
    ! fixed typo in default FM module setting/

  * harbour/include/hbapicls.h
  * harbour/source/vm/classes.c
  * harbour/source/debug/dbgentry.c
    * renamed hb_dbgObjSendMessage() to hb_dbg_objSendMessage() to keep
      naming convention used for other C debugger functions

  * harbour/source/vm/debug.c
    * added information about existing debugger functions and where they
      are used.

  * harbour/include/hbvm.h
  * harbour/include/hbapidbg.h
  * harbour/include/hbvmpub.h
  * harbour/include/hbstack.h
  * harbour/include/hbapi.h
  * harbour/source/vm/codebloc.c
  * harbour/source/vm/estack.c
  * harbour/source/vm/hvm.c
  * harbour/source/debug/dbgentry.c
    * changed the method of static variable handling. Now we do not
      have centralized array of all statics used by application (s_aStatics)
      but each module uses it's own array to keep statics. The old
      s_aStatics has been removed. It means that loading new PCODE module
      from .hrb file or shared/dynamic library does not cause any static
      table reallocation so it does not creates potential GPF trap for MT
      code which may operate on static vars.
      This modification changed a little bit the debugger interface.
      I also updated some unused by us debug functions like __DBGVMVARSLIST()
      or __DBGVMVARSLEN() anyhow any 3-rd party debuggers should be
      updated for new API and modified hb_dbgEntry() syntax.
This commit is contained in:
Przemyslaw Czerpak
2009-02-02 09:58:22 +00:00
parent 90b1b10207
commit 77df7fd78f
14 changed files with 331 additions and 122 deletions

View File

@@ -8,6 +8,41 @@
2008-12-31 13:59 UTC+0100 Foo Bar (foo.bar foobar.org)
*/
2009-02-02 11:02 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/source/vm/fm.c
! fixed typo in default FM module setting/
* harbour/include/hbapicls.h
* harbour/source/vm/classes.c
* harbour/source/debug/dbgentry.c
* renamed hb_dbgObjSendMessage() to hb_dbg_objSendMessage() to keep
naming convention used for other C debugger functions
* harbour/source/vm/debug.c
* added information about existing debugger functions and where they
are used.
* harbour/include/hbvm.h
* harbour/include/hbapidbg.h
* harbour/include/hbvmpub.h
* harbour/include/hbstack.h
* harbour/include/hbapi.h
* harbour/source/vm/codebloc.c
* harbour/source/vm/estack.c
* harbour/source/vm/hvm.c
* harbour/source/debug/dbgentry.c
* changed the method of static variable handling. Now we do not
have centralized array of all statics used by application (s_aStatics)
but each module uses it's own array to keep statics. The old
s_aStatics has been removed. It means that loading new PCODE module
from .hrb file or shared/dynamic library does not cause any static
table reallocation so it does not creates potential GPF trap for MT
code which may operate on static vars.
This modification changed a little bit the debugger interface.
I also updated some unused by us debug functions like __DBGVMVARSLIST()
or __DBGVMVARSLEN() anyhow any 3-rd party debuggers should be
updated for new API and modified hb_dbgEntry() syntax.
2009-02-01 10:21 UTC+0100 Viktor Szakats (harbour.01 syenar hu)
+ doc/inet.txt
+ Added from xhb.

View File

@@ -242,8 +242,8 @@ struct _HB_EXTREF;
typedef struct _HB_STACK_STATE
{
LONG lBaseItem; /* stack base offset of previous func/proc */
LONG lStatics; /* statics offset of previous func/proc */
ULONG ulPrivateBase; /* memvars base offset of previous func/proc */
void * pStatics; /* statics frame of previous func/proc */
USHORT uiClass; /* class when message is sent */
USHORT uiMethod; /* number of class method */
USHORT uiLineNo; /* current line number */
@@ -410,7 +410,7 @@ typedef struct _HB_CODEBLOCK
PHB_SYMB pSymbols; /* codeblocks symbols */
PHB_SYMB pDefSymb; /* symbol where the codeblock was created */
PHB_ITEM pLocals; /* table with referenced local variables */
LONG lStatics; /* STATICs base address */
void * pStatics; /* STATICs base frame */
USHORT uiLocals; /* number of referenced local variables */
SHORT dynBuffer; /* is pcode buffer allocated dynamically, SHORT used instead of BOOL intentionally to force optimal alignment */
} HB_CODEBLOCK, * PHB_CODEBLOCK, * HB_CODEBLOCK_PTR;

View File

@@ -129,7 +129,7 @@ HB_EXPORT extern PHB_ITEM hb_objSendMsg( PHB_ITEM pObj, const char *sMsg, ULON
HB_EXPORT extern PHB_ITEM hb_objSendMessage( PHB_ITEM pObj, PHB_DYNS pMessage, ULONG ulArg, ... );
/* send message which allows to set execution context for debugger */
HB_EXPORT extern void hb_dbgObjSendMessage( int iProcLevel, PHB_ITEM pObject, PHB_ITEM pMessage, int iParamOffset );
HB_EXPORT extern void hb_dbg_objSendMessage( int iProcLevel, PHB_ITEM pObject, PHB_ITEM pMessage, int iParamOffset );
/* Harbour equivalent for Clipper internal __mdCreate() */
USHORT hb_clsCreate( USHORT usSize, const char * szClassName );

View File

@@ -60,17 +60,17 @@ HB_EXTERN_BEGIN
/*Debugger API */
/* HVM debugger function */
typedef void (*HB_DBGENTRY_FUNC) ( int , int , char *, int , int );
typedef void (*HB_DBGENTRY_FUNC) ( int , int , char *, int , PHB_ITEM );
HB_EXPORT extern HB_DBGENTRY_FUNC hb_dbg_SetEntry( HB_DBGENTRY_FUNC pFunDbgEntry );
HB_EXPORT extern BOOL hb_dbg_InvokeDebug( BOOL bInvoke );
HB_EXPORT extern ULONG hb_dbg_ProcLevel( void );
HB_EXPORT extern PHB_ITEM hb_dbg_vmVarSGet( int nStatic, int nOffset );
HB_EXPORT extern PHB_ITEM hb_dbg_vmVarSGet( PHB_ITEM pStaticsBase, int nOffset );
HB_EXPORT extern PHB_ITEM hb_dbg_vmVarLGet( int iLevel, int iLocal );
HB_EXPORT extern ULONG hb_dbg_vmVarGCount( void );
HB_EXPORT extern PHB_ITEM hb_dbg_vmVarGGet( int nGlobal, int nOffset );
/* internal debugger function */
HB_EXPORT extern void hb_dbgEntry( int nMode, int nLine, char *szName, int nIndex, int nFrame );
HB_EXPORT extern void hb_dbgEntry( int nMode, int nLine, char *szName, int nIndex, PHB_ITEM pFrame );
HB_EXPORT extern void hb_dbgAddBreak( void *handle, char *cModule, int nLine, char *szFunction );
HB_EXPORT extern void hb_dbgAddWatch( void *handle, char *szExpr, BOOL bTrace );
HB_EXPORT extern void hb_dbgDelBreak( void *handle, int nBreak );

View File

@@ -158,7 +158,6 @@ typedef struct
PHB_ITEM * pBase; /* stack frame position for the current function call */
HB_ITEM Return; /* latest returned value */
LONG wItems; /* total items that may be holded on the stack */
LONG lStatics; /* statics base for the current function call */
LONG lWithObject; /* stack offset to base current WITH OBJECT item */
LONG lRecoverBase; /* current SEQUENCE envelope offset or 0 if no SEQUENCE is active */
USHORT uiActionRequest;/* request for some action - stop processing of opcodes */
@@ -172,6 +171,7 @@ typedef struct
void * hGT; /* current GT module */
int iTSD; /* number of allocated TSD holders */
PHB_TSD_HOLDER pTSD; /* thread specific data holder */
void * pStatics; /* statics base for the current function call */
HB_PRIVATE_STACK privates; /* private variables stack */
HB_SET_STRUCT set;
int iKeyPoll; /* counter for GT/keyboard polling */
@@ -306,8 +306,8 @@ extern void hb_stackSetRecoverBase( LONG lBase );
extern USHORT hb_stackGetActionRequest( void );
extern void hb_stackSetActionRequest( USHORT uiAction );
extern void hb_stackSetStaticsBase( LONG lBase );
extern LONG hb_stackGetStaticsBase( void );
extern void hb_stackSetStaticsBase( void * pBase );
extern void * hb_stackGetStaticsBase( void );
extern PHB_ITEM hb_stackWithObjectItem( void );
extern LONG hb_stackWithObjectOffset( void );
@@ -359,8 +359,8 @@ extern void hb_stackIsStackRef( void *, PHB_TSD_FUNC );
#define hb_stackReturnItem( ) ( &hb_stack.Return )
#define hb_stackDateBuffer( ) ( hb_stack.szDate )
#define hb_stackItemBasePtr( ) ( &hb_stack.pItems )
#define hb_stackGetStaticsBase( ) ( hb_stack.lStatics )
#define hb_stackSetStaticsBase( n ) do { hb_stack.lStatics = ( n ); } while ( 0 )
#define hb_stackGetStaticsBase( ) ( hb_stack.pStatics )
#define hb_stackSetStaticsBase( p ) do { hb_stack.pStatics = ( p ); } while ( 0 )
#define hb_stackGetRecoverBase( ) ( hb_stack.lRecoverBase )
#define hb_stackSetRecoverBase( n ) do { hb_stack.lRecoverBase = ( n ); } while( 0 )
#define hb_stackGetActionRequest( ) ( hb_stack.uiActionRequest )

View File

@@ -78,6 +78,7 @@ extern HB_EXPORT PHB_SYMB hb_vmProcessDynLibSymbols( PHB_SYMB pSymbols, USHORT u
{
PHB_SYMB pModuleSymbols; /* pointer to module symbol table */
USHORT uiModuleSymbols; /* number of symbols on that table */
USHORT uiStaticsOffset; /* ofset of statics base symbol */
struct _HB_SYMBOLS * pNext; /* pointer to the next SYMBOLS structure */
HB_SYMBOLSCOPE hScope; /* scope collected from all symbols in module used to speed initialization code */
void * hDynLib; /* handler to dynamic library */

View File

@@ -201,7 +201,7 @@ typedef struct _HB_SYMB
{
PHB_FUNC pFunPtr; /* machine code function address for function symbol table entries */
PHB_PCODEFUNC pCodeFunc; /* PCODE function address */
LONG lStaticsBase; /* base offset to array of statics */
void * pStaticsBase; /* base offset to array of statics */
} value;
PHB_DYNS pDynSym; /* pointer to its dynamic symbol if defined */
} HB_SYMB, * PHB_SYMB;
@@ -230,6 +230,7 @@ typedef struct _HB_FUNC_LIST
#define HB_FS_LOCAL ( ( HB_SYMBOLSCOPE ) 0x0200 )
#define HB_FS_DYNCODE ( ( HB_SYMBOLSCOPE ) 0x0400 )
#define HB_FS_DEFERRED ( ( HB_SYMBOLSCOPE ) 0x0800 )
#define HB_FS_FRAME ( ( HB_SYMBOLSCOPE ) 0x1000 )
#define HB_FS_INITEXIT ( HB_FS_INIT | HB_FS_EXIT )

View File

@@ -107,7 +107,10 @@ typedef struct
{
char *szName;
char cType;
int nFrame;
union {
int num;
PHB_ITEM ptr;
} frame;
int nIndex;
} HB_VARINFO;
@@ -181,9 +184,9 @@ static PHB_ITEM hb_dbgActivateVarArray( int nVars, HB_VARINFO *aVars );
static void hb_dbgAddLocal( HB_DEBUGINFO *info, char *szName, int nIndex, int nFrame );
static void hb_dbgAddModule( HB_DEBUGINFO *info, char *szName );
static void hb_dbgAddStack( HB_DEBUGINFO *info, char *szName, int nProcLevel );
static void hb_dbgAddStatic( HB_DEBUGINFO *info, char *szName, int nIndex, int nFrame );
static void hb_dbgAddStatic( HB_DEBUGINFO *info, char *szName, int nIndex, PHB_ITEM pFrame );
static void hb_dbgAddVar( int *nVars, HB_VARINFO **aVars, char *szName, char cType, int nIndex, int nFrame, PHB_ITEM pFrame );
static void hb_dbgAddStopLines( HB_DEBUGINFO *info, PHB_ITEM pItem );
static void hb_dbgAddVar( int *nVars, HB_VARINFO **aVars, char *szName, char cType, int nIndex, int nFrame );
static void hb_dbgEndProc( HB_DEBUGINFO *info );
static PHB_ITEM hb_dbgEval( HB_DEBUGINFO *info, HB_WATCHPOINT *watch );
static PHB_ITEM hb_dbgEvalMacro( char *szExpr, PHB_ITEM pItem );
@@ -323,7 +326,10 @@ static PHB_ITEM hb_dbgActivateVarArray( int nVars, HB_VARINFO *aVars )
hb_arraySetC( aVar, 1, aVars[ i ].szName );
hb_arraySetNL( aVar, 2, aVars[ i ].nIndex );
hb_arraySetCL( aVar, 3, &aVars[ i ].cType, 1 );
hb_arraySetNL( aVar, 4, aVars[ i ].nFrame );
if( aVars[ i ].cType == 'S' )
hb_arraySet( aVar, 4, aVars[ i ].frame.ptr );
else
hb_arraySetNL( aVar, 4, aVars[ i ].frame.num );
hb_arraySet( pArray, i + 1, aVar );
hb_itemRelease( aVar );
@@ -332,7 +338,7 @@ static PHB_ITEM hb_dbgActivateVarArray( int nVars, HB_VARINFO *aVars )
}
void hb_dbgEntry( int nMode, int nLine, char *szName, int nIndex, int nFrame )
void hb_dbgEntry( int nMode, int nLine, char *szName, int nIndex, PHB_ITEM pFrame )
{
int i;
ULONG nProcLevel;
@@ -396,9 +402,9 @@ void hb_dbgEntry( int nMode, int nLine, char *szName, int nIndex, int nFrame )
return;
case HB_DBG_STATICNAME:
HB_TRACE( HB_TR_DEBUG, ( "STATICNAME %s index %d frame %d", szName, nIndex, nFrame ) );
HB_TRACE( HB_TR_DEBUG, ( "STATICNAME %s index %d frame %p", szName, nIndex, pFrame ) );
hb_dbgAddStatic( info, szName, nIndex, nFrame );
hb_dbgAddStatic( info, szName, nIndex, pFrame );
return;
case HB_DBG_SHOWLINE:
@@ -574,13 +580,13 @@ static void hb_dbgAddLocal( HB_DEBUGINFO *info, char *szName, int nIndex, int nF
{
HB_MODULEINFO *module = &info->aModules[ info->nModules - 1 ];
hb_dbgAddVar( &module->nGlobals, &module->aGlobals, szName, 'G', nIndex, hb_dbg_vmVarGCount() );
hb_dbgAddVar( &module->nGlobals, &module->aGlobals, szName, 'G', nIndex, hb_dbg_vmVarGCount(), NULL );
}
else
{
HB_CALLSTACKINFO *top = &info->aCallStack[ info->nCallStackLen - 1 ];
hb_dbgAddVar( &top->nLocals, &top->aLocals, szName, 'L', nIndex, nFrame );
hb_dbgAddVar( &top->nLocals, &top->aLocals, szName, 'L', nIndex, nFrame, NULL );
}
}
@@ -659,26 +665,26 @@ static void hb_dbgAddStack( HB_DEBUGINFO *info, char *szName, int nProcLevel )
}
static void hb_dbgAddStatic( HB_DEBUGINFO *info, char *szName, int nIndex, int nFrame )
static void hb_dbgAddStatic( HB_DEBUGINFO *info, char *szName, int nIndex, PHB_ITEM pFrame )
{
if ( info->bInitGlobals )
{
HB_MODULEINFO *module = &info->aModules[ info->nModules - 1 ];
hb_dbgAddVar( &module->nExternGlobals, &module->aExternGlobals, szName,
'G', nIndex, hb_dbg_vmVarGCount() );
'G', nIndex, hb_dbg_vmVarGCount(), NULL );
}
else if ( info->bInitStatics )
{
HB_MODULEINFO *module = &info->aModules[ info->nModules - 1 ];
hb_dbgAddVar( &module->nStatics, &module->aStatics, szName, 'S', nIndex, nFrame );
hb_dbgAddVar( &module->nStatics, &module->aStatics, szName, 'S', nIndex, 0, pFrame );
}
else
{
HB_CALLSTACKINFO *top = &info->aCallStack[ info->nCallStackLen - 1 ];
hb_dbgAddVar( &top->nStatics, &top->aStatics, szName, 'S', nIndex, nFrame );
hb_dbgAddVar( &top->nStatics, &top->aStatics, szName, 'S', nIndex, 0, pFrame );
}
}
@@ -763,7 +769,7 @@ static void hb_dbgAddStopLines( HB_DEBUGINFO *info, PHB_ITEM pItem )
}
static void hb_dbgAddVar( int *nVars, HB_VARINFO **aVars, char *szName, char cType, int nIndex, int nFrame )
static void hb_dbgAddVar( int *nVars, HB_VARINFO **aVars, char *szName, char cType, int nIndex, int nFrame, PHB_ITEM pFrame )
{
HB_VARINFO *var;
@@ -771,7 +777,10 @@ static void hb_dbgAddVar( int *nVars, HB_VARINFO **aVars, char *szName, char cTy
var->szName = szName;
var->cType = cType;
var->nIndex = nIndex;
var->nFrame = nFrame;
if( cType == 'S' )
var->frame.ptr = pFrame;
else
var->frame.num = nFrame;
}
@@ -1223,7 +1232,7 @@ static PHB_ITEM hb_dbgEvalResolve( HB_DEBUGINFO *info, HB_WATCHPOINT *watch )
if ( !strcmp( name, var->szName ) )
{
scopes[ i ].cType = 'L';
scopes[ i ].nFrame = nProcLevel - var->nFrame;
scopes[ i ].frame.num = nProcLevel - var->frame.num;
scopes[ i ].nIndex = var->nIndex;
hb_itemArrayPut( aVars, i + 1, hb_dbgVarGet( &scopes[ i ] ) );
break;
@@ -1238,7 +1247,7 @@ static PHB_ITEM hb_dbgEvalResolve( HB_DEBUGINFO *info, HB_WATCHPOINT *watch )
if ( !strcmp( name, var->szName ) )
{
scopes[ i ].cType = 'S';
scopes[ i ].nFrame = var->nFrame;
scopes[ i ].frame.ptr = var->frame.ptr;
scopes[ i ].nIndex = var->nIndex;
hb_itemArrayPut( aVars, i + 1, hb_dbgVarGet( &scopes[ i ] ) );
break;
@@ -1255,7 +1264,7 @@ static PHB_ITEM hb_dbgEvalResolve( HB_DEBUGINFO *info, HB_WATCHPOINT *watch )
if ( !strcmp( name, var->szName ) )
{
scopes[ i ].cType = 'S';
scopes[ i ].nFrame = var->nFrame;
scopes[ i ].frame.ptr = var->frame.ptr;
scopes[ i ].nIndex = var->nIndex;
hb_itemArrayPut( aVars, i + 1, hb_dbgVarGet( &scopes[ i ] ) );
break;
@@ -1270,7 +1279,7 @@ static PHB_ITEM hb_dbgEvalResolve( HB_DEBUGINFO *info, HB_WATCHPOINT *watch )
if ( !strcmp( name, var->szName ) )
{
scopes[ i ].cType = 'G';
scopes[ i ].nFrame = var->nFrame;
scopes[ i ].frame.num = var->frame.num;
scopes[ i ].nIndex = var->nIndex;
hb_itemArrayPut( aVars, i + 1, hb_dbgVarGet( &scopes[ i ] ) );
break;
@@ -1285,7 +1294,7 @@ static PHB_ITEM hb_dbgEvalResolve( HB_DEBUGINFO *info, HB_WATCHPOINT *watch )
if ( !strcmp( name, var->szName ) )
{
scopes[ i ].cType = 'G';
scopes[ i ].nFrame = var->nFrame;
scopes[ i ].frame.num = var->frame.num;
scopes[ i ].nIndex = var->nIndex;
hb_itemArrayPut( aVars, i + 1, hb_dbgVarGet( &scopes[ i ] ) );
break;
@@ -1541,11 +1550,11 @@ static PHB_ITEM hb_dbgVarGet( HB_VARINFO *scope )
switch ( scope->cType )
{
case 'G':
return hb_dbg_vmVarGGet( scope->nFrame, scope->nIndex );
return hb_dbg_vmVarGGet( scope->frame.num, scope->nIndex );
case 'L':
return hb_dbg_vmVarLGet( scope->nFrame, scope->nIndex );
return hb_dbg_vmVarLGet( scope->frame.num, scope->nIndex );
case 'S':
return hb_dbg_vmVarSGet( scope->nFrame, scope->nIndex );
return hb_dbg_vmVarSGet( scope->frame.ptr, scope->nIndex );
case 'M':
{
PHB_DYNS pDyn;
@@ -1724,6 +1733,6 @@ HB_FUNC( __DBGSETWATCH )
HB_FUNC( __DBGSENDMSG )
{
hb_dbgObjSendMessage( hb_parnl( 1 ), hb_param( 2, HB_IT_ANY ),
hb_param( 3, HB_IT_ANY ), 4 );
hb_dbg_objSendMessage( hb_parnl( 1 ), hb_param( 2, HB_IT_ANY ),
hb_param( 3, HB_IT_ANY ), 4 );
}

View File

@@ -2377,7 +2377,7 @@ static PHB_SYMB hb_objGetFuncSym( PHB_ITEM pItem )
}
/* send message which allows to set execution context for debugger */
void hb_dbgObjSendMessage( int iProcLevel, PHB_ITEM pObject, PHB_ITEM pMessage, int iParamOffset )
void hb_dbg_objSendMessage( int iProcLevel, PHB_ITEM pObject, PHB_ITEM pMessage, int iParamOffset )
{
PHB_DYNS pMsgSym;
@@ -2441,7 +2441,7 @@ void hb_dbgObjSendMessage( int iProcLevel, PHB_ITEM pObject, PHB_ITEM pMessage,
hb_vmSend( uiParams );
}
else
hb_errRT_BASE( EG_ARG, 3000, NULL, "hb_dbgObjSendMessage()", 2, pObject, pMsgSym );
hb_errRT_BASE( EG_ARG, 3000, NULL, "hb_dbg_objSendMessage()", 2, pObject, pMsgSym );
}
static USHORT hb_clsUpdateScope( USHORT uiScope, BOOL fAssign )

View File

@@ -221,7 +221,7 @@ HB_CODEBLOCK_PTR hb_codeblockNew( const BYTE * pBuffer,
pCBlock->pDefSymb = pBase->item.asSymbol.stackstate->uiClass ?
hb_clsMethodSym( pBase ) : pBase->item.asSymbol.value;
pCBlock->pSymbols = pSymbols;
pCBlock->lStatics = hb_stackGetStaticsBase();
pCBlock->pStatics = hb_stackGetStaticsBase();
pCBlock->uiLocals = uiLocals;
pCBlock->pLocals = pLocals;
@@ -259,7 +259,7 @@ HB_CODEBLOCK_PTR hb_codeblockMacroNew( const BYTE * pBuffer, ULONG ulLen )
pCBlock->pDefSymb = pBase->item.asSymbol.stackstate->uiClass ?
hb_clsMethodSym( pBase ) : pBase->item.asSymbol.value;
pCBlock->pSymbols = NULL; /* macro-compiled codeblock cannot acces a local symbol table */
pCBlock->lStatics = hb_stackGetStaticsBase();
pCBlock->pStatics = hb_stackGetStaticsBase();
pCBlock->uiLocals = 0;
pCBlock->pLocals = NULL;
@@ -278,7 +278,7 @@ void hb_codeblockEvaluate( HB_ITEM_PTR pItem )
{
HB_TRACE(HB_TR_DEBUG, ("hb_codeblockEvaluate(%p)", pItem));
hb_stackSetStaticsBase( pItem->item.asBlock.value->lStatics );
hb_stackSetStaticsBase( pItem->item.asBlock.value->pStatics );
hb_vmExecute( pItem->item.asBlock.value->pCode, pItem->item.asBlock.value->pSymbols );
}

View File

@@ -57,6 +57,54 @@
#include "hbapierr.h"
#include "hbstack.h"
/* Existing debug functions
* from debug.c:
* __DBGVMSTKGCOUNT()
* __DBGVMSTKGLIST()
* __DBGVMSTKLCOUNT()
* __DBGVMPARLLIST()
* for locals:
* __DBGVMVARLGET() (debugger.prg)
* __DBGVMVARLSET() (debugger.prg)
* hb_dbg_vmVarLGet(int,int) (dbgentry.c)
*
* form classes.c:
* hb_dbg_objSendMessage(...) (dbgentry.c)
*
* form hvm.c
* general:
* __DBGINVOKEDEBUG() (debugger.prg)
* __DBGPROCLEVEL() (debugger.prg)
* hb_dbg_InvokeDebug(BOOL) (dbgentry.c)
* hb_dbg_ProcLevel() (dbgentry.c)
* hb_dbg_SetEntry(*ENTRY_FUNC) (dbgentry.c)
* for statics:
* __DBGVMVARSLIST()
* __DBGVMVARSLEN()
* __DBGVMVARSGET() (debugger.prg)
* __DBGVMVARSSET() (debugger.prg)
* hb_dbg_vmVarSGet(int,int) (dbgentry.c)
* for globals (unused):
* __DBGVMVARGLIST()
* __DBGVMVARGGET() (debugger.prg)
* __DBGVMVARGSET() (debugger.prg)
* hb_dbg_vmVarGCount() (dbgentry.c)
* hb_dbg_vmVarGGet(int,int) (dbgentry.c)
*
*
* Information from HVM send to debugger by __DBGENTRY()
* HB_DBG_MODULENAME, cName
* HB_DBG_STATICNAME, nBase, nIndex, cName
* HB_DBG_LOCALNAME, nIndex, cName
* HB_DBG_SHOWLINE, nLine
* HB_DBG_ENDPROC
* HB_DBG_GETENTRY
* HB_DBG_VMQUIT
*/
/* $Doc$
* $FuncName$ AddToArray( <pItem>, <pReturn>, <uiPos> )
* $Description$ Add <pItem> to array <pReturn> at pos <uiPos>

View File

@@ -650,7 +650,8 @@ HB_ITEM_PTR hb_stackNewFrame( PHB_STACK_STATE pFrame, USHORT uiParams )
}
pFrame->lBaseItem = hb_stack.pBase - hb_stack.pItems;
pFrame->lStatics = hb_stack.lStatics;
pFrame->pStatics = hb_stack.pStatics;
/* as some type of protection we can set hb_stack.pStatics to NULL here */
pFrame->ulPrivateBase = hb_memvarGetPrivatesBase();
pFrame->uiClass = pFrame->uiMethod = pFrame->uiLineNo = 0;
pFrame->fDebugging = FALSE;
@@ -681,7 +682,7 @@ void hb_stackOldFrame( PHB_STACK_STATE pFrame )
while( hb_stack.pPos > hb_stack.pBase );
hb_stack.pBase = hb_stack.pItems + pFrame->lBaseItem;
hb_stack.lStatics = pFrame->lStatics;
hb_stack.pStatics = pFrame->pStatics;
hb_memvarSetPrivatesBase( pFrame->ulPrivateBase );
}
@@ -854,17 +855,17 @@ PHB_STACKRDD hb_stackRDD( void )
#undef hb_stackGetStaticsBase
LONG hb_stackGetStaticsBase( void )
void * hb_stackGetStaticsBase( void )
{
HB_STACK_TLS_PRELOAD
return hb_stack.lStatics;
return hb_stack.pStatics;
}
#undef hb_stackSetStaticsBase
void hb_stackSetStaticsBase( LONG lBase )
void hb_stackSetStaticsBase( void * pBase )
{
HB_STACK_TLS_PRELOAD
hb_stack.lStatics = lBase;
hb_stack.pStatics = pBase;
}
#undef hb_stackGetRecoverBase

View File

@@ -778,7 +778,7 @@ void hb_xinit( void ) /* Initialize fixed memory subsystem */
else if( hb_stricmp( "no", buffer ) == 0 )
s_fStatistic = FALSE;
}
#ifdef HB_FM_STATISTICS_DYN_OFF
#ifndef HB_FM_STATISTICS_DYN_OFF
else
s_fStatistic = TRUE; /* enabled by default */
#endif /* HB_FM_STATISTICS_DYN_OFF */

View File

@@ -161,6 +161,8 @@ static void hb_vmVFrame( USHORT usLocals, BYTE bParams ); /* increases the st
static void hb_vmSFrame( PHB_SYMB pSym ); /* sets the statics frame for a function */
static void hb_vmStatics( PHB_SYMB pSym, USHORT uiStatics ); /* increases the global statics array to hold a PRG statics */
static void hb_vmInitThreadStatics( USHORT uiCount, const BYTE * pCode ); /* mark thread static variables */
static void hb_vmStaticsClear( void ); /* clear complex static variables */
static void hb_vmStaticsRelease( void ); /* release arrays with static variables */
/* Push */
static void hb_vmPushAlias( void ); /* pushes the current workarea number */
static void hb_vmPushAliasedField( PHB_SYMB ); /* pushes an aliased field on the eval stack */
@@ -212,7 +214,7 @@ static void hb_vmLocalName( USHORT uiLocal, char * szLocalName ); /* locals a
static void hb_vmStaticName( BYTE bIsGlobal, USHORT uiStatic, char * szStaticName ); /* statics vars information for the debugger */
static void hb_vmModuleName( char * szModuleName ); /* PRG and function name information for the debugger */
static void hb_vmDebugEntry( int nMode, int nLine, char *szName, int nIndex, int nFrame );
static void hb_vmDebugEntry( int nMode, int nLine, char *szName, int nIndex, PHB_ITEM pFrame );
static void hb_vmDebuggerExit( BOOL fRemove ); /* shuts down the debugger */
static void hb_vmDebuggerShowLine( USHORT uiLine ); /* makes the debugger shows a specific source code line */
static void hb_vmDebuggerEndProc( void ); /* notifies the debugger for an endproc */
@@ -254,8 +256,6 @@ const char * hb_vm_pszLinkedMain = NULL; /* name of startup function set by link
HB_SYMB hb_symEval = { "EVAL", {HB_FS_PUBLIC}, {hb_vmDoBlock}, NULL }; /* symbol to evaluate codeblocks */
static HB_ITEM s_aStatics; /* Harbour array to hold all application statics variables */
static BOOL s_fHVMActive = FALSE; /* is HVM ready for PCODE executing */
static BOOL s_fDoExitProc = TRUE; /* execute EXIT procedures */
static int s_nErrorLevel = 0; /* application exit errorlevel */
@@ -847,9 +847,6 @@ void hb_vmInit( BOOL bStartMainProc )
{
HB_TRACE(HB_TR_DEBUG, ("hb_vmInit()"));
/* initialize internal data structures */
s_aStatics.type = HB_IT_NIL;
hb_xinit();
hb_vmSetExceptionHandler();
@@ -910,7 +907,7 @@ void hb_vmInit( BOOL bStartMainProc )
{
/* Try to get C dbgEntry() function pointer */
if( !s_pFunDbgEntry )
hb_vmDebugEntry( HB_DBG_GETENTRY, 0, NULL, 0, 0 );
hb_vmDebugEntry( HB_DBG_GETENTRY, 0, NULL, 0, NULL );
if( !s_pFunDbgEntry )
s_pFunDbgEntry = hb_vmDebugEntry;
}
@@ -1052,10 +1049,12 @@ int hb_vmQuit( void )
/* stop executing PCODE (HVM reenter request) */
s_fHVMActive = FALSE;
hb_vmStaticsClear();
hb_errExit();
hb_clsReleaseAll();
hb_itemClear( &s_aStatics );
hb_vmStaticsRelease();
/* release all remaining items */
@@ -5719,14 +5718,12 @@ void hb_vmFunction( USHORT uiParams )
#ifndef HB_NO_DEBUG
static void hb_vmDebugEntry( int nMode, int nLine, char *szName, int nIndex, int nFrame )
static void hb_vmDebugEntry( int nMode, int nLine, char *szName, int nIndex, PHB_ITEM pFrame )
{
HB_STACK_TLS_PRELOAD
HB_TRACE(HB_TR_DEBUG, ("hb_vmDebugEntry"));
HB_SYMBOL_UNUSED( nFrame );
switch( nMode )
{
case HB_DBG_MODULENAME:
@@ -5750,12 +5747,20 @@ static void hb_vmDebugEntry( int nMode, int nLine, char *szName, int nIndex, int
hb_vmPushDynSym( s_pDynsDbgEntry );
hb_vmPushNil();
hb_vmPushInteger( HB_DBG_STATICNAME );
hb_vmPushLong( hb_stackGetStaticsBase() ); /* current static frame */
hb_vmPushInteger( nIndex ); /* variable index */
hb_vmPush( pFrame ); /* current static frame */
hb_vmPushInteger( nIndex ); /* variable index */
hb_vmPushString( szName, strlen( szName ) );
hb_vmDo( 4 );
break;
case HB_DBG_SHOWLINE:
hb_vmPushDynSym( s_pDynsDbgEntry );
hb_vmPushNil();
hb_vmPushInteger( HB_DBG_SHOWLINE );
hb_vmPushInteger( nLine );
hb_vmDo( 2 );
break;
case HB_DBG_ENDPROC:
hb_stackPushReturn(); /* saves the previous returned value */
hb_vmPushDynSym( s_pDynsDbgEntry );
@@ -5765,14 +5770,6 @@ static void hb_vmDebugEntry( int nMode, int nLine, char *szName, int nIndex, int
hb_stackPopReturn(); /* restores the previous returned value */
break;
case HB_DBG_SHOWLINE:
hb_vmPushDynSym( s_pDynsDbgEntry );
hb_vmPushNil();
hb_vmPushInteger( HB_DBG_SHOWLINE );
hb_vmPushInteger( nLine );
hb_vmDo( 2 );
break;
case HB_DBG_GETENTRY:
/* Try to get C dbgEntry() function pointer */
hb_vmPushDynSym( s_pDynsDbgEntry );
@@ -5790,7 +5787,7 @@ static void hb_vmDebugEntry( int nMode, int nLine, char *szName, int nIndex, int
}
}
static void hb_vmDummyDebugEntry( int nMode, int nLine, char *szName, int nIndex, int nFrame )
static void hb_vmDummyDebugEntry( int nMode, int nLine, char *szName, int nIndex, PHB_ITEM pFrame )
{
HB_TRACE(HB_TR_DEBUG, ("hb_vmDummyDebugEntry"));
@@ -5798,7 +5795,7 @@ static void hb_vmDummyDebugEntry( int nMode, int nLine, char *szName, int nIndex
HB_SYMBOL_UNUSED( nLine );
HB_SYMBOL_UNUSED( szName );
HB_SYMBOL_UNUSED( nIndex );
HB_SYMBOL_UNUSED( nFrame );
HB_SYMBOL_UNUSED( pFrame );
}
static void hb_vmDebuggerExit( BOOL fRemove )
@@ -5809,7 +5806,7 @@ static void hb_vmDebuggerExit( BOOL fRemove )
if( s_pFunDbgEntry )
{
/* inform debugger that we are quitting now */
s_pFunDbgEntry( HB_DBG_VMQUIT, 0, NULL, 0, 0 );
s_pFunDbgEntry( HB_DBG_VMQUIT, 0, NULL, 0, NULL );
/* set dummy debugger function to avoid debugger activation in .prg
* destructors if any */
if( fRemove )
@@ -5821,14 +5818,14 @@ static void hb_vmDebuggerEndProc( void )
{
HB_TRACE(HB_TR_DEBUG, ("hb_vmDebuggerEndProc()"));
s_pFunDbgEntry( HB_DBG_ENDPROC, 0, NULL, 0, 0 );
s_pFunDbgEntry( HB_DBG_ENDPROC, 0, NULL, 0, NULL );
}
static void hb_vmDebuggerShowLine( USHORT uiLine ) /* makes the debugger shows a specific source code line */
{
HB_TRACE(HB_TR_DEBUG, ("hb_vmDebuggerShowLine(%hu)", uiLine));
s_pFunDbgEntry( HB_DBG_SHOWLINE, uiLine, NULL, 0, 0 );
s_pFunDbgEntry( HB_DBG_SHOWLINE, uiLine, NULL, 0, NULL );
}
static void hb_vmLocalName( USHORT uiLocal, char * szLocalName ) /* locals and parameters index and name information for the debugger */
@@ -5838,7 +5835,7 @@ static void hb_vmLocalName( USHORT uiLocal, char * szLocalName ) /* locals and p
HB_TRACE(HB_TR_DEBUG, ("hb_vmLocalName(%hu, %s)", uiLocal, szLocalName));
if( hb_stackBaseItem()->item.asSymbol.stackstate->fDebugging )
s_pFunDbgEntry( HB_DBG_LOCALNAME, 0, szLocalName, uiLocal, 0 );
s_pFunDbgEntry( HB_DBG_LOCALNAME, 0, szLocalName, uiLocal, NULL );
}
static void hb_vmStaticName( BYTE bIsGlobal, USHORT uiStatic, char * szStaticName ) /* statics vars information for the debugger */
@@ -5850,7 +5847,7 @@ static void hb_vmStaticName( BYTE bIsGlobal, USHORT uiStatic, char * szStaticNam
HB_SYMBOL_UNUSED( bIsGlobal );
if( hb_stackBaseItem()->item.asSymbol.stackstate->fDebugging )
s_pFunDbgEntry( HB_DBG_STATICNAME, 0, szStaticName, uiStatic, hb_stackGetStaticsBase() );
s_pFunDbgEntry( HB_DBG_STATICNAME, 0, szStaticName, uiStatic, ( PHB_ITEM ) hb_stackGetStaticsBase() );
}
static void hb_vmModuleName( char * szModuleName ) /* PRG and function name information for the debugger */
@@ -5860,7 +5857,7 @@ static void hb_vmModuleName( char * szModuleName ) /* PRG and function name info
if( s_pFunDbgEntry )
{
HB_STACK_TLS_PRELOAD
s_pFunDbgEntry( HB_DBG_MODULENAME, 0, szModuleName, 0, 0 );
s_pFunDbgEntry( HB_DBG_MODULENAME, 0, szModuleName, 0, NULL );
hb_stackBaseItem()->item.asSymbol.stackstate->fDebugging = TRUE;
}
}
@@ -5945,23 +5942,16 @@ static void hb_vmSFrame( PHB_SYMB pSym ) /* sets the statics frame for a fu
HB_TRACE(HB_TR_DEBUG, ("hb_vmSFrame(%p)", pSym));
/* _INITSTATICS is now the statics frame. Statics() changed it! */
hb_stackSetStaticsBase( pSym->value.lStaticsBase );
hb_stackSetStaticsBase( pSym->value.pStaticsBase );
}
static void hb_vmStatics( PHB_SYMB pSym, USHORT uiStatics ) /* initializes the global aStatics array or redimensionates it */
{
HB_TRACE(HB_TR_DEBUG, ("hb_vmStatics(%p, %hu)", pSym, uiStatics));
if( HB_IS_NIL( &s_aStatics ) )
{
pSym->value.lStaticsBase = 0; /* statics frame for this PRG */
hb_arrayNew( &s_aStatics, uiStatics );
}
else
{
pSym->value.lStaticsBase = hb_arrayLen( &s_aStatics );
hb_arraySize( &s_aStatics, ( ULONG ) pSym->value.lStaticsBase + uiStatics );
}
/* statics frame for this PRG */
pSym->value.pStaticsBase = ( void * ) hb_itemArrayNew( uiStatics );
pSym->scope.value |= HB_FS_FRAME;
}
#if defined( HB_MT_VM )
@@ -6088,7 +6078,7 @@ static void hb_vmInitThreadStatics( USHORT uiCount, const BYTE * pCode )
while( uiCount-- )
{
USHORT uiStatic = HB_PCODE_MKUSHORT( pCode );
PHB_ITEM pStatic = s_aStatics.item.asArray.value->pItems + hb_stackGetStaticsBase() + uiStatic - 1;
PHB_ITEM pStatic = ( ( PHB_ITEM ) hb_stackGetStaticsBase() )->item.asArray.value->pItems + uiStatic - 1;
hb_vmTSVReference( pStatic );
pCode += 2;
}
@@ -6637,7 +6627,7 @@ static void hb_vmPushStatic( USHORT uiStatic )
HB_TRACE(HB_TR_DEBUG, ("hb_vmPushStatic(%hu)", uiStatic));
pStatic = s_aStatics.item.asArray.value->pItems + hb_stackGetStaticsBase() + uiStatic - 1;
pStatic = ( ( PHB_ITEM ) hb_stackGetStaticsBase() )->item.asArray.value->pItems + uiStatic - 1;
hb_itemCopy( hb_stackAllocItem(),
HB_IS_BYREF( pStatic ) ? hb_itemUnRef( pStatic ) : pStatic );
}
@@ -6645,15 +6635,18 @@ static void hb_vmPushStatic( USHORT uiStatic )
static void hb_vmPushStaticByRef( USHORT uiStatic )
{
HB_STACK_TLS_PRELOAD
HB_ITEM_PTR pTop = hb_stackAllocItem();
PHB_ITEM pTop, pBase
HB_TRACE(HB_TR_DEBUG, ("hb_vmPushStaticByRef(%hu)", uiStatic));
pTop = hb_stackAllocItem();
pTop->type = HB_IT_BYREF;
/* we store the offset instead of a pointer to support a dynamic stack */
pTop->item.asRefer.value = hb_stackGetStaticsBase() + uiStatic - 1;
pTop->item.asRefer.value = uiStatic - 1;
pTop->item.asRefer.offset = 0; /* 0 for static variables */
pTop->item.asRefer.BasePtr.array = s_aStatics.item.asArray.value;
hb_gcRefInc( s_aStatics.item.asArray.value );
pBase = ( PHB_ITEM ) hb_stackGetStaticsBase();
pTop->item.asRefer.BasePtr.array = pBase->item.asArray.value;
hb_gcRefInc( pBase->item.asArray.value );
}
static void hb_vmPushVariable( PHB_SYMB pVarSymb )
@@ -6908,7 +6901,7 @@ static void hb_vmPopStatic( USHORT uiStatic )
/* Remove MEMOFLAG if exists (assignment from field). */
pVal->type &= ~( HB_IT_MEMOFLAG | HB_IT_DEFAULT );
pStatic = s_aStatics.item.asArray.value->pItems + hb_stackGetStaticsBase() + uiStatic - 1;
pStatic = ( ( PHB_ITEM ) hb_stackGetStaticsBase() )->item.asArray.value->pItems + uiStatic - 1;
hb_itemMoveToRef( pStatic, pVal );
hb_stackDec();
@@ -6999,6 +6992,115 @@ BOOL hb_vmFindModuleSymbols( PHB_SYMB pSym, PHB_SYMB * pSymbols,
return FALSE;
}
#define HB_SYM_STATICSBASE( p ) \
( ( PHB_ITEM ) ( ( (p)->scope.value & HB_FS_FRAME ) ? \
(p)->value.pStaticsBase : NULL ) )
static void hb_vmStaticsClear( void )
{
PHB_SYMBOLS pLastSymbols = s_pSymbols;
while( pLastSymbols )
{
if( pLastSymbols->uiStaticsOffset )
{
PHB_SYMB pSym = pLastSymbols->pModuleSymbols + pLastSymbols->uiStaticsOffset;
PHB_ITEM pStatics = HB_SYM_STATICSBASE( pSym );
if( pStatics )
{
ULONG ulLen = hb_arrayLen( pStatics ), ul;
for( ul = 1; ul <= ulLen; ++ul )
{
PHB_ITEM pItem = hb_arrayGetItemPtr( pStatics, ul );
if( HB_IS_COMPLEX( pItem ) )
hb_itemClear( pItem );
}
}
}
pLastSymbols = pLastSymbols->pNext;
}
}
static void hb_vmStaticsRelease( void )
{
PHB_SYMBOLS pLastSymbols = s_pSymbols;
while( pLastSymbols )
{
if( pLastSymbols->uiStaticsOffset )
{
PHB_SYMB pSym = pLastSymbols->pModuleSymbols + pLastSymbols->uiStaticsOffset;
PHB_ITEM pStatics = HB_SYM_STATICSBASE( pSym );
if( pStatics )
{
hb_itemRelease( pStatics );
pSym->value.pStaticsBase = NULL;
}
}
pLastSymbols = pLastSymbols->pNext;
}
}
static ULONG hb_vmStaticsCount( void )
{
ULONG ulStatics = 0;
if( hb_vmLockModuleSymbols() )
{
PHB_SYMBOLS pLastSymbols = s_pSymbols;
while( pLastSymbols )
{
if( pLastSymbols->uiStaticsOffset )
{
PHB_SYMB pSym = pLastSymbols->pModuleSymbols + pLastSymbols->uiStaticsOffset;
PHB_ITEM pStatics = HB_SYM_STATICSBASE( pSym );
if( pStatics )
ulStatics += hb_arrayLen( pStatics );
}
pLastSymbols = pLastSymbols->pNext;
}
hb_vmUnlockModuleSymbols();
}
return ulStatics;
}
static PHB_ITEM hb_vmStaticsArray( void )
{
PHB_ITEM pArray = NULL;
if( hb_vmLockModuleSymbols() )
{
PHB_SYMBOLS pLastSymbols = s_pSymbols;
ULONG ulOffset, ulCount;
ulCount = hb_vmStaticsCount();
pArray = hb_itemArrayNew( ulCount );
ulOffset = 0;
while( pLastSymbols )
{
if( pLastSymbols->uiStaticsOffset )
{
PHB_SYMB pSym = pLastSymbols->pModuleSymbols + pLastSymbols->uiStaticsOffset;
PHB_ITEM pStatics = HB_SYM_STATICSBASE( pSym );
if( pStatics )
{
ULONG ulLen = hb_arrayLen( pStatics ), ul;
for( ul = 1; ul <= ulLen; ++ul )
hb_arraySet( pArray, ++ulOffset, hb_arrayGetItemPtr( pStatics, ul ) );
}
}
pLastSymbols = pLastSymbols->pNext;
}
hb_vmUnlockModuleSymbols();
}
return pArray;
}
static PHB_SYMBOLS hb_vmFindFreeModule( PHB_SYMB pSymbols, USHORT uiSymbols,
const char * szModuleName, ULONG ulID )
{
@@ -7021,8 +7123,10 @@ static PHB_SYMBOLS hb_vmFindFreeModule( PHB_SYMB pSymbols, USHORT uiSymbols,
for( ui = 0; ui < uiSymbols; ++ui )
{
if( ( pSymbols[ ui ].scope.value & ~( HB_FS_PCODEFUNC | HB_FS_DYNCODE ) ) !=
( pModuleSymbols[ ui ].scope.value & ~HB_FS_DEFERRED ) ||
if( ( ( pSymbols[ ui ].scope.value & ~( HB_FS_PCODEFUNC | HB_FS_DYNCODE | HB_FS_DEFERRED ) ) !=
( pModuleSymbols[ ui ].scope.value & ~HB_FS_DEFERRED ) &&
!( ui !=0 && ui == pLastSymbols->uiStaticsOffset &&
HB_SYM_STATICSBASE( &pModuleSymbols[ ui ] ) ) ) ||
strcmp( pSymbols[ ui ].szName, pModuleSymbols[ ui ].szName ) != 0 )
{
break;
@@ -7053,18 +7157,18 @@ void hb_vmFreeSymbols( PHB_SYMBOLS pSymbols )
for( ui = 0; ui < pSymbols->uiModuleSymbols; ++ui )
{
HB_SYMBOLSCOPE scope = pSymbols->pModuleSymbols[ ui ].scope.value & HB_FS_INITEXIT;
PHB_SYMB pSymbol = &pSymbols->pModuleSymbols[ ui ];
/* do not overwrite already initialized statics' frame */
if( scope != HB_FS_INITEXIT )
if( ui == 0 || ui != pSymbols->uiStaticsOffset ||
! HB_SYM_STATICSBASE( pSymbol ) )
{
PHB_SYMB pSymbol = &pSymbols->pModuleSymbols[ ui ];
pSymbol->value.pFunPtr = NULL;
if( pSymbol->pDynSym && pSymbol->pDynSym->pSymbol != pSymbol &&
( pSymbol->scope.value & HB_FS_LOCAL ) == 0 )
pSymbol->scope.value |= HB_FS_DEFERRED;
}
pSymbols->pModuleSymbols[ ui ].scope.value &= ~( HB_FS_PCODEFUNC | HB_FS_DYNCODE );
pSymbol->scope.value &= ~( HB_FS_PCODEFUNC | HB_FS_DYNCODE );
}
pSymbols->hDynLib = NULL;
pSymbols->fActive = FALSE;
@@ -7109,7 +7213,9 @@ void hb_vmInitSymbolGroup( void * hNewDynLib, int argc, char * argv[] )
{
HB_SYMBOLSCOPE scope = ( pLastSymbols->pModuleSymbols + ui )->scope.value & HB_FS_INITEXIT;
if( scope == HB_FS_INITEXIT )
if( scope == HB_FS_INITEXIT &&
!( ui != 0 && ui == pLastSymbols->uiStaticsOffset &&
HB_SYM_STATICSBASE( pLastSymbols->pModuleSymbols + ui ) ) )
{
hb_vmPushSymbol( pLastSymbols->pModuleSymbols + ui );
hb_vmPushNil();
@@ -7242,6 +7348,7 @@ PHB_SYMBOLS hb_vmRegisterSymbols( PHB_SYMB pModuleSymbols, USHORT uiSymbols,
pNewSymbols = ( PHB_SYMBOLS ) hb_xgrab( sizeof( HB_SYMBOLS ) );
pNewSymbols->pModuleSymbols = pModuleSymbols;
pNewSymbols->uiModuleSymbols = uiSymbols;
pNewSymbols->uiStaticsOffset = 0;
pNewSymbols->szModuleName = hb_strdup( szModuleName );
pNewSymbols->ulID = ulID;
pNewSymbols->fAllocated = fClone;
@@ -7271,7 +7378,9 @@ PHB_SYMBOLS hb_vmRegisterSymbols( PHB_SYMB pModuleSymbols, USHORT uiSymbols,
HB_SYMBOLSCOPE hSymScope;
BOOL fPublic, fStatics;
fStatics = ( pSymbol->scope.value & HB_FS_INITEXIT ) == HB_FS_INITEXIT;
fStatics = ( pSymbol->scope.value & HB_FS_INITEXIT ) == HB_FS_INITEXIT ||
( fRecycled && ui != 0 && ui == pNewSymbols->uiStaticsOffset &&
HB_SYM_STATICSBASE( pSymbol ) );
if( fRecycled && !fStatics )
{
@@ -7286,19 +7395,21 @@ PHB_SYMBOLS hb_vmRegisterSymbols( PHB_SYMB pModuleSymbols, USHORT uiSymbols,
hSymScope = pSymbol->scope.value;
pNewSymbols->hScope |= hSymScope;
/* fPublic = ( hSymScope & ( HB_FS_PUBLIC | HB_FS_MESSAGE | HB_FS_MEMVAR ) ) != 0; */
fPublic = ( hSymScope & ( HB_FS_INITEXIT | HB_FS_STATIC ) ) == 0;
fPublic = ( hSymScope & ( HB_FS_INITEXIT | HB_FS_STATIC | HB_FS_FRAME ) ) == 0;
if( fStatics )
{
if( !fRecycled && strncmp( pSymbol->szName, "(_INITSTATICS", 13 ) == 0 )
pNewSymbols->uiStaticsOffset = ui;
fInitStatics = TRUE;
}
if( ( hSymScope & HB_FS_PCODEFUNC ) && ( hSymScope & HB_FS_LOCAL ) &&
( fRecycled || fClone ) )
if( ( hSymScope & ( HB_FS_PCODEFUNC | HB_FS_LOCAL | HB_FS_FRAME ) ) ==
( HB_FS_PCODEFUNC | HB_FS_LOCAL ) && ( fRecycled || fClone ) )
{
pSymbol->value.pCodeFunc->pSymbols = pNewSymbols->pModuleSymbols;
}
if( !s_pSymStart && !fDynLib &&
if( !s_pSymStart && !fDynLib && !fStatics &&
( hSymScope & HB_FS_FIRST ) != 0 &&
( hSymScope & HB_FS_INITEXIT ) == 0 )
{
@@ -7316,7 +7427,7 @@ PHB_SYMBOLS hb_vmRegisterSymbols( PHB_SYMB pModuleSymbols, USHORT uiSymbols,
if( fPublic )
{
if( fDynLib && pSymbol->value.pFunPtr )
if( fDynLib && HB_VM_ISFUNC( pSymbol ) )
{
PHB_DYNS pDynSym;
@@ -7325,7 +7436,7 @@ PHB_SYMBOLS hb_vmRegisterSymbols( PHB_SYMB pModuleSymbols, USHORT uiSymbols,
if( pDynSym )
{
pSymbol->pDynSym = pDynSym;
if( pDynSym->pSymbol->value.pFunPtr )
if( pDynSym->pSymbol != pSymbol && HB_VM_ISFUNC( pDynSym->pSymbol ) )
{
pSymbol->scope.value =
( pSymbol->scope.value & ~( HB_FS_PCODEFUNC | HB_FS_LOCAL ) ) |
@@ -8880,7 +8991,7 @@ BOOL hb_xvmStaticAdd( USHORT uiStatic )
HB_TRACE(HB_TR_DEBUG, ("hb_xvmStaticAdd(%hu)", uiStatic));
pStatic = s_aStatics.item.asArray.value->pItems + hb_stackGetStaticsBase() + uiStatic - 1;
pStatic = ( ( PHB_ITEM ) hb_stackGetStaticsBase() )->item.asArray.value->pItems + uiStatic - 1;
if( HB_IS_BYREF( pStatic ) )
pStatic = hb_itemUnRef( pStatic );
hb_vmPlus( pStatic, hb_stackItemFromTop( -2 ), hb_stackItemFromTop( -1 ) );
@@ -10679,9 +10790,12 @@ HB_DBGENTRY_FUNC hb_dbg_SetEntry( HB_DBGENTRY_FUNC pFunDbgEntry )
return pPrevFunc;
}
PHB_ITEM hb_dbg_vmVarSGet( int nStatic, int nOffset )
PHB_ITEM hb_dbg_vmVarSGet( PHB_ITEM pStaticsBase, int nOffset )
{
return hb_arrayGetItemPtr( &s_aStatics, nStatic + nOffset );
if( pStaticsBase )
return hb_arrayGetItemPtr( pStaticsBase, nOffset );
else
return NULL;
}
ULONG hb_dbg_ProcLevel( void )
@@ -10713,9 +10827,7 @@ HB_FUNC( __DBGINVOKEDEBUG )
* $End$ */
HB_FUNC( __DBGVMVARSLIST )
{
PHB_ITEM pStatics = hb_itemClone( &s_aStatics );
hb_itemReturnRelease( pStatics );
hb_itemReturnRelease( hb_vmStaticsArray() );
}
/* $Doc$
@@ -10725,7 +10837,7 @@ HB_FUNC( __DBGVMVARSLIST )
HB_FUNC( __DBGVMVARSLEN )
{
HB_STACK_TLS_PRELOAD
hb_retnl( hb_arrayLen( &s_aStatics ) );
hb_retnint( hb_vmStaticsCount() );
}
/* $Doc$
@@ -10734,7 +10846,7 @@ HB_FUNC( __DBGVMVARSLEN )
* $End$ */
HB_FUNC( __DBGVMVARSGET )
{
hb_itemReturn( hb_dbg_vmVarSGet( hb_parni( 1 ), hb_parni( 2 ) ) );
hb_itemReturn( hb_dbg_vmVarSGet( hb_param( 1, HB_IT_ARRAY ), hb_parni( 2 ) ) );
}
/* $Doc$
@@ -10743,9 +10855,10 @@ HB_FUNC( __DBGVMVARSGET )
* $End$ */
HB_FUNC( __DBGVMVARSSET )
{
PHB_ITEM pStaticsBase = hb_param( 1, HB_IT_ARRAY );
PHB_ITEM pItem = hb_param( 3, HB_IT_ANY );
if( pItem )
hb_arraySet( &s_aStatics, hb_parni( 1 ) + hb_parni( 2 ), pItem );
if( pStaticsBase && pItem )
hb_arraySet( pStaticsBase, hb_parni( 2 ), pItem );
}
HB_FUNC( __DBGPROCLEVEL )
@@ -10820,8 +10933,9 @@ void hb_vmIsStaticRef( void )
{
HB_TRACE(HB_TR_DEBUG, ("hb_vmIsStaticRef()"));
/* statics are stored as an item of array type */
hb_gcItemRef( &s_aStatics );
/* statics are stored as an item of arrays allocated by hb_itemNew() so
* they do not need any special GC support
*/
}
void hb_vmIsStackRef( void )