2014-09-17 16:45 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)

* include/hbdebug.ch
    + added HB_DBG_* constant values for arrays returned by __dbg*()
      functions

  * include/hbset.h
  * src/vm/set.c
    + added new C function: hb_setGetItem();

  * src/debug/dbgentry.c
    * use HB_DBG_* constant values
    + added new debugger function: __dbgGetSETs() - it returns array with
      all HVM SETs: { { <nSet>, <cSetName>, <xSetValue> }, ... }
    % optimized hb_dbgActivateCallStackArray() and hb_dbgActivateModuleArray()

  * src/debug/debugger.prg
    * use HB_DBG_* constant values
    * use __dbgGetSETs() for "System Settings" window
    + added support for Harbour SET extensions

  * ChangeLog.txt
    * updated description for structure of array returned
      by __dbgGetBreakPoints()
This commit is contained in:
Przemysław Czerpak
2014-09-17 16:45:44 +02:00
parent b30c509fb0
commit 030baa1068
6 changed files with 538 additions and 364 deletions

View File

@@ -54,6 +54,7 @@
#include "hbdebug.ch"
#include "hbmacro.ch"
#include "set.ch"
/* dummy function declaration */
static HB_BOOL hb_clsSetScope( HB_BOOL fScope )
@@ -199,6 +200,122 @@ static void hb_dbgRelease( void );
static PHB_ITEM hb_dbgVarGet( HB_VARINFO * scope );
static void hb_dbgVarSet( HB_VARINFO * scope, PHB_ITEM xNewValue );
static const char * hb_dbgSetName( HB_set_enum setId )
{
switch( setId )
{
case HB_SET_EXACT: return "Exact";
case HB_SET_FIXED: return "Fixed";
case HB_SET_DECIMALS: return "Decimals";
case HB_SET_DATEFORMAT: return "DateFormat";
case HB_SET_EPOCH: return "Epoch";
case HB_SET_PATH: return "Path";
case HB_SET_DEFAULT: return "Default";
case HB_SET_EXCLUSIVE: return "Exclusive";
case HB_SET_SOFTSEEK: return "SoftSeek";
case HB_SET_UNIQUE: return "Unique";
case HB_SET_DELETED: return "Deleted";
case HB_SET_CANCEL: return "Cancel";
case HB_SET_DEBUG: return "Debug";
case HB_SET_TYPEAHEAD: return "TypeAhead";
case HB_SET_COLOR: return "Color";
case HB_SET_CURSOR: return "Cursor";
case HB_SET_CONSOLE: return "Console";
case HB_SET_ALTERNATE: return "Alternate";
case HB_SET_ALTFILE: return "AltFile";
case HB_SET_DEVICE: return "Device";
case HB_SET_EXTRA: return "Extra";
case HB_SET_EXTRAFILE: return "ExtraFile";
case HB_SET_PRINTER: return "Printer";
case HB_SET_PRINTFILE: return "PrintFile";
case HB_SET_MARGIN: return "Margin";
case HB_SET_BELL: return "Bell";
case HB_SET_CONFIRM: return "Confirm";
case HB_SET_ESCAPE: return "Escape";
case HB_SET_INSERT: return "Insert";
case HB_SET_EXIT: return "Exit";
case HB_SET_INTENSITY: return "Intensity";
case HB_SET_SCOREBOARD: return "ScoreBoard";
case HB_SET_DELIMITERS: return "Delimeters";
case HB_SET_DELIMCHARS: return "DelimChars";
case HB_SET_WRAP: return "Wrap";
case HB_SET_MESSAGE: return "Message";
case HB_SET_MCENTER: return "MCenter";
case HB_SET_SCROLLBREAK: return "ScrollBreak";
case HB_SET_EVENTMASK: return "EventMask";
case HB_SET_VIDEOMODE: return "VideoMode";
case HB_SET_MBLOCKSIZE: return "MBlockSize";
case HB_SET_MFILEEXT: return "MFileExt";
case HB_SET_STRICTREAD: return "StrictRead";
case HB_SET_OPTIMIZE: return "Optimize";
case HB_SET_AUTOPEN: return "Autopen";
case HB_SET_AUTORDER: return "Autorder";
case HB_SET_AUTOSHARE: return "AutoShare";
/* Harbour SET extensions */
case HB_SET_LANGUAGE: return "Language";
case HB_SET_IDLEREPEAT: return "IdleRepeat";
case HB_SET_FILECASE: return "FileCase";
case HB_SET_DIRCASE: return "DirCase";
case HB_SET_DIRSEPARATOR: return "DirSeparator";
case HB_SET_EOF: return "EOF";
case HB_SET_HARDCOMMIT: return "HardCommit";
case HB_SET_FORCEOPT: return "ForceOpt";
case HB_SET_DBFLOCKSCHEME: return "DBFLockScheme";
case HB_SET_DEFEXTENSIONS: return "DefExtensions";
case HB_SET_EOL: return "EOL";
case HB_SET_TRIMFILENAME: return "TrimFileName";
case HB_SET_HBOUTLOG: return "OutLogFile";
case HB_SET_HBOUTLOGINFO: return "OutLogInfo";
case HB_SET_CODEPAGE: return "CodePage";
case HB_SET_OSCODEPAGE: return "OSCodePage";
case HB_SET_TIMEFORMAT: return "TimeFormat";
case HB_SET_DBCODEPAGE: return "DBCodePage";
case HB_SET_INVALID_:
break;
}
return NULL;
}
static PHB_ITEM hb_dbgSetArray( void )
{
PHB_ITEM pArray;
int iSet, iPos;
pArray = hb_itemArrayNew( _SET_COUNT + HB_SET_COUNT );
iPos = iSet = 1;
while( iPos <= _SET_COUNT + HB_SET_COUNT )
{
const char * szName = hb_dbgSetName( ( HB_set_enum ) iSet );
PHB_ITEM pSet = hb_arrayGetItemPtr( pArray, iPos++ );
hb_arrayNew( pSet, HB_DBG_SET_LEN );
hb_arraySetNI( pSet, HB_DBG_SET_POS, iSet );
hb_arraySetC( pSet, HB_DBG_SET_NAME, szName );
hb_setGetItem( ( HB_set_enum ) iSet,
hb_arrayGetItemPtr( pSet, HB_DBG_SET_VALUE ),
NULL, NULL );
if( iSet == _SET_COUNT )
iSet = HB_SET_BASE;
else
iSet++;
}
return pArray;
}
static PHB_ITEM hb_dbgActivateBreakArray( HB_DEBUGINFO * info )
{
int i;
@@ -208,14 +325,14 @@ static PHB_ITEM hb_dbgActivateBreakArray( HB_DEBUGINFO * info )
{
PHB_ITEM pBreak = hb_arrayGetItemPtr( pArray, i + 1 );
hb_arrayNew( pBreak, 3 );
hb_arrayNew( pBreak, HB_DBG_BP_LEN );
if( ! info->aBreak[ i ].szFunction )
{
hb_arraySetNI( pBreak, 1, info->aBreak[ i ].nLine );
hb_arraySetC( pBreak, 2, info->aBreak[ i ].szModule );
hb_arraySetNI( pBreak, HB_DBG_BP_LINE, info->aBreak[ i ].nLine );
hb_arraySetC( pBreak, HB_DBG_BP_MODULE, info->aBreak[ i ].szModule );
}
else
hb_arraySetC( pBreak, 3, info->aBreak[ i ].szFunction );
hb_arraySetC( pBreak, HB_DBG_BP_FUNC, info->aBreak[ i ].szFunction );
}
return pArray;
}
@@ -236,13 +353,13 @@ static PHB_ITEM hb_dbgActivateWatchArray( HB_DEBUGINFO * info )
break;
}
xValue = hb_dbgEval( info, &info->aWatch[ i ] );
hb_arrayNew( pWatch, 4 );
hb_arraySetC( pWatch, 1, info->aWatch[ i ].szExpr );
hb_arraySetL( pWatch, 2, j < info->nTracePoints );
hb_arraySetL( pWatch, 3, xValue != NULL );
hb_arrayNew( pWatch, HB_DBG_WP_LEN );
hb_arraySetC( pWatch, HB_DBG_WP_EXPR, info->aWatch[ i ].szExpr );
hb_arraySetL( pWatch, HB_DBG_WP_ISTRACE, j < info->nTracePoints );
hb_arraySetL( pWatch, HB_DBG_WP_VALID, xValue != NULL );
if( xValue )
{
hb_arraySetForward( pWatch, 4, xValue );
hb_arraySetForward( pWatch, HB_DBG_WP_RESULT, xValue );
hb_itemRelease( xValue );
}
}
@@ -250,24 +367,24 @@ static PHB_ITEM hb_dbgActivateWatchArray( HB_DEBUGINFO * info )
}
static PHB_ITEM hb_dbgActivateVarArray( int nVars, HB_VARINFO * aVars )
static PHB_ITEM hb_dbgActivateVarArray( PHB_ITEM pArray, int nVars, HB_VARINFO * aVars )
{
int i;
PHB_ITEM pArray = hb_itemArrayNew( nVars );
hb_arrayNew( pArray, nVars );
for( i = 0; i < nVars; i++ )
{
PHB_ITEM aVar = hb_arrayGetItemPtr( pArray, i + 1 );
hb_arrayNew( aVar, 4 );
hb_arrayNew( aVar, HB_DBG_VAR_LEN );
hb_arraySetC( aVar, 1, aVars[ i ].szName );
hb_arraySetNL( aVar, 2, aVars[ i ].nIndex );
hb_arraySetCL( aVar, 3, &aVars[ i ].cType, 1 );
hb_arraySetC( aVar, HB_DBG_VAR_NAME, aVars[ i ].szName );
hb_arraySetNL( aVar, HB_DBG_VAR_INDEX, aVars[ i ].nIndex );
hb_arraySetCL( aVar, HB_DBG_VAR_TYPE, &aVars[ i ].cType, 1 );
if( aVars[ i ].cType == 'S' )
hb_arraySet( aVar, 4, aVars[ i ].frame.ptr );
hb_arraySet( aVar, HB_DBG_VAR_FRAME, aVars[ i ].frame.ptr );
else
hb_arraySetNL( aVar, 4, aVars[ i ].frame.num );
hb_arraySetNL( aVar, HB_DBG_VAR_FRAME, aVars[ i ].frame.num );
}
return pArray;
}
@@ -284,26 +401,19 @@ static PHB_ITEM hb_dbgActivateModuleArray( void )
for( i = 0; i < s_common.nModules; i++ )
{
PHB_ITEM pModule = hb_arrayGetItemPtr( pArray, i + 1 ), item;
PHB_ITEM pModule = hb_arrayGetItemPtr( pArray, i + 1 );
hb_arrayNew( pModule, 4 );
hb_arraySetC( pModule, 1, s_common.aModules[ i ].szModule );
item = hb_dbgActivateVarArray( s_common.aModules[ i ].nStatics,
s_common.aModules[ i ].aStatics );
hb_arraySetForward( pModule, 2, item );
hb_itemRelease( item );
item = hb_dbgActivateVarArray( s_common.aModules[ i ].nGlobals,
s_common.aModules[ i ].aGlobals );
hb_arraySetForward( pModule, 3, item );
hb_itemRelease( item );
item = hb_dbgActivateVarArray( s_common.aModules[ i ].nExternGlobals,
s_common.aModules[ i ].aExternGlobals );
hb_arraySetForward( pModule, 4, item );
hb_itemRelease( item );
hb_arrayNew( pModule, HB_DBG_MOD_LEN );
hb_arraySetC( pModule, HB_DBG_MOD_NAME, s_common.aModules[ i ].szModule );
hb_dbgActivateVarArray( hb_arrayGetItemPtr( pModule, HB_DBG_MOD_STATICS ),
s_common.aModules[ i ].nStatics,
s_common.aModules[ i ].aStatics );
hb_dbgActivateVarArray( hb_arrayGetItemPtr( pModule, HB_DBG_MOD_GLOBALS ),
s_common.aModules[ i ].nGlobals,
s_common.aModules[ i ].aGlobals );
hb_dbgActivateVarArray( hb_arrayGetItemPtr( pModule, HB_DBG_MOD_EXTGLOBALS ),
s_common.aModules[ i ].nExternGlobals,
s_common.aModules[ i ].aExternGlobals );
}
HB_DBGCOMMON_UNLOCK();
@@ -320,23 +430,19 @@ static PHB_ITEM hb_dbgActivateCallStackArray( HB_DEBUGINFO * info )
for( i = 0; i < info->nCallStackLen; i++ )
{
HB_CALLSTACKINFO * pEntry = &info->aCallStack[ i ];
PHB_ITEM aEntry, pItem;
PHB_ITEM aEntry;
aEntry = hb_arrayGetItemPtr( aCallStack, info->nCallStackLen - i );
hb_arrayNew( aEntry, 6 );
hb_arrayNew( aEntry, HB_DBG_CS_LEN );
hb_arraySetC( aEntry, 1, pEntry->szModule );
hb_arraySetC( aEntry, 2, pEntry->szFunction );
hb_arraySetNL( aEntry, 3, pEntry->nLine );
hb_arraySetNL( aEntry, 4, pEntry->nProcLevel );
pItem = hb_dbgActivateVarArray( pEntry->nLocals, pEntry->aLocals );
hb_arraySetForward( aEntry, 5, pItem );
hb_itemRelease( pItem );
pItem = hb_dbgActivateVarArray( pEntry->nStatics, pEntry->aStatics );
hb_arraySetForward( aEntry, 6, pItem );
hb_itemRelease( pItem );
hb_arraySetC( aEntry, HB_DBG_CS_MODULE, pEntry->szModule );
hb_arraySetC( aEntry, HB_DBG_CS_FUNCTION, pEntry->szFunction );
hb_arraySetNL( aEntry, HB_DBG_CS_LINE, pEntry->nLine );
hb_arraySetNL( aEntry, HB_DBG_CS_LEVEL, pEntry->nProcLevel );
hb_dbgActivateVarArray( hb_arrayGetItemPtr( aEntry, HB_DBG_CS_LOCALS ),
pEntry->nLocals, pEntry->aLocals );
hb_dbgActivateVarArray( hb_arrayGetItemPtr( aEntry, HB_DBG_CS_STATICS ),
pEntry->nStatics, pEntry->aStatics );
}
return aCallStack;
@@ -1898,6 +2004,11 @@ HB_FUNC( __DBGGETWATCHPOINTS )
hb_itemReturnRelease( hb_dbgActivateWatchArray( ( HB_DEBUGINFO * ) ptr ) );
}
HB_FUNC( __DBGGETSETS )
{
hb_itemReturnRelease( hb_dbgSetArray() );
}
HB_FUNC( __DBGGETMODULENAME )
{
void * ptr = hb_parptr( 1 );

View File

@@ -70,31 +70,13 @@
#include "setcurs.ch"
/* Information structure stored in DATA aCallStack */
#define CSTACK_MODULE 1 // module name (.prg file)
#define CSTACK_FUNCTION 2 // function name
#define CSTACK_LINE 3 // start line
#define CSTACK_LEVEL 4 // eval stack level of the function
#define CSTACK_LOCALS 5 // an array with local variables
#define CSTACK_STATICS 6 // an array with static variables
/* Information structure stored in aCallStack[ n ][ CSTACK_LOCALS ]
{ cLocalName, nLocalIndex, "Local", ProcName( 1 ), nLevel } */
#define VAR_NAME 1
#define VAR_POS 2
#define VAR_TYPE 3
#define VAR_LEVEL 4 // eval stack level of the function
/* Public or Private created in ::LoadVars(), value stored in HB_DBG_VAR_INDEX */
#define HB_DBG_VAR_MVALUE HB_DBG_VAR_INDEX
/* Information structure stored in ::aWatch (watchpoints) */
#define WP_TYPE 1 // wp: watchpoint, tr: tracepoint
#define WP_EXPR 2 // source of an expression
/* Information structure stored in ::aModules */
#define MODULE_NAME 1
#define MODULE_STATICS 2
#define MODULE_GLOBALS 3
#define MODULE_EXTERNGLOBALS 4
/* The dimensions of the debugger window */
#define DEBUGGER_MINROW 0
#define DEBUGGER_MINCOL 0
@@ -102,7 +84,7 @@
#define DEBUGGER_MAXCOL 77
/* command window scroll history */
#define DEBUGGER_CMDHIST_SIZE 64
#define DEBUGGER_CMDHIST_SIZE 128
THREAD STATIC t_oDebugger
@@ -304,7 +286,7 @@ CREATE CLASS HBDebugger
METHOD ShowHelp( cTopic )
METHOD ShowVars()
METHOD LocatePrgPath( cPrgName )
METHOD Sort() INLINE ASort( ::aVars,,, {| x, y | x[ 1 ] < y[ 1 ] } ), ;
METHOD Sort() INLINE ASort( ::aVars,,, {| x, y | x[ HB_DBG_VAR_NAME ] < y[ HB_DBG_VAR_NAME ] } ), ;
::lSortVars := .T., ;
iif( ::oBrwVars != NIL, ::oBrwVars:RefreshAll(), NIL ), ;
iif( ::oWndVars != NIL .AND. ::oWndVars:lVisible, iif( ! ::lGo .AND. ::oBrwVars != NIL, ::oBrwVars:ForceStable(), NIL ), NIL )
@@ -456,7 +438,7 @@ METHOD PROCEDURE Activate() CLASS HBDebugger
ENDIF
// show the topmost procedure
::ShowCodeLine( 1 ) // ::aCallStack[ 1 ][ CSTACK_LINE ], ::aCallStack[ 1 ][ CSTACK_MODULE ] )
::ShowCodeLine( 1 ) // ::aCallStack[ 1 ][ HB_DBG_CS_LINE ], ::aCallStack[ 1 ][ HB_DBG_CS_MODULE ] )
// Most commands can be executed only after activation
IF lFirst
@@ -520,7 +502,7 @@ METHOD PROCEDURE BuildBrowseStack() CLASS HBDebugger
::oBrwStack:Cargo := 1 // Actual highligthed row
::oBrwStack:AddColumn( HBDbColumnNew( "", {|| iif( Len( ::aProcStack ) > 0, ;
PadC( ::aProcStack[ ::oBrwStack:Cargo ][ CSTACK_FUNCTION ], 14 ), Space( 14 ) ) } ) )
PadC( ::aProcStack[ ::oBrwStack:Cargo ][ HB_DBG_CS_FUNCTION ], 14 ), Space( 14 ) ) } ) )
ENDIF
RETURN
@@ -642,8 +624,8 @@ METHOD PROCEDURE CallStackProcessKey( nKey ) CLASS HBDebugger
// jump to source line for a function
#if 0
IF ::aCallStack[ ::oBrwStack:Cargo ][ CSTACK_LINE ] != NIL
::ShowCodeLine( ::aCallStack[ ::oBrwStack:Cargo ][ CSTACK_LINE ], ::aCallStack[ ::oBrwStack:Cargo ][ CSTACK_MODULE ] )
IF ::aCallStack[ ::oBrwStack:Cargo ][ HB_DBG_CS_LINE ] != NIL
::ShowCodeLine( ::aCallStack[ ::oBrwStack:Cargo ][ HB_DBG_CS_LINE ], ::aCallStack[ ::oBrwStack:Cargo ][ HB_DBG_CS_MODULE ] )
ELSE
::GotoLine( 1 )
ENDIF
@@ -746,14 +728,15 @@ METHOD PROCEDURE Colors() CLASS HBDebugger
oBrwColors:skipBlock := {| nPos | ( nPos := ArrayBrowseSkip( nPos, oBrwColors ), oBrwColors:cargo[ 1 ] := ;
oBrwColors:cargo[ 1 ] + nPos, nPos ) }
oBrwColors:AddColumn( oCol := HBDbColumnNew( "", {|| PadR( aColors[ oBrwColors:Cargo[ 1 ] ], 14 ) } ) )
oBrwColors:AddColumn( oCol := HBDbColumnNew( "", {|| aColors[ oBrwColors:Cargo[ 1 ] ] } ) )
oCol:Width := 14
oCol:defColor := { 1, 2 }
AAdd( oBrwColors:Cargo[ 2 ], aColors )
oBrwColors:AddColumn( oCol := HBDbColumnNew( "", ;
{|| PadR( '"' + ::aColors[ oBrwColors:Cargo[ 1 ] ] + '"', nWidth - 15 ) } ) )
AAdd( oBrwColors:Cargo[ 2 ], aColors )
oCol:defColor := { 1, 3 }
ocol:width := 50
oCol:Width := 50
oBrwColors:autolite := .F.
oWndColors:bPainted := {|| oBrwColors:ForceStable(), RefreshVarsS( oBrwColors ) }
@@ -1287,7 +1270,8 @@ METHOD PROCEDURE EditColor( nColor, oBrwColors ) CLASS HBDebugger
oBrwColors:RefreshCurrent()
oBrwColors:ForceStable()
IF __dbgInput( Row(), Col() + 15, oBrwColors:getColumn( 2 ):Width, ;
IF __dbgInput( Row(), oBrwColors:nLeft + oBrwColors:GetColumn( 1 ):width + 1, ;
oBrwColors:getColumn( 2 ):Width, ;
@cColor, __dbgExprValidBlock( "C" ), ;
SubStr( ::ClrModal(), 5 ) )
::aColors[ nColor ] := &cColor
@@ -1307,7 +1291,8 @@ METHOD PROCEDURE EditSet( nSet, oBrwSets ) CLASS HBDebugger
oBrwSets:RefreshCurrent()
oBrwSets:ForceStable()
IF __dbgInput( Row(), Col() + 13, oBrwSets:getColumn( 2 ):Width, ;
IF __dbgInput( Row(), oBrwSets:nLeft + oBrwSets:GetColumn( 1 ):width + 1, ;
oBrwSets:getColumn( 2 ):Width, ;
@cSet, __dbgExprValidBlock( cType ), ;
SubStr( ::ClrModal(), 5 ), 256 )
Set( nSet, &cSet )
@@ -1838,7 +1823,7 @@ METHOD PROCEDURE LoadCallStack() CLASS HBDebugger
FOR i := nDebugLevel TO nCurrLevel
nLevel := nCurrLevel - i + 1
IF ( nPos := AScan( ::aCallStack, {| a | a[ CSTACK_LEVEL ] == nLevel } ) ) > 0
IF ( nPos := AScan( ::aCallStack, {| a | a[ HB_DBG_CS_LEVEL ] == nLevel } ) ) > 0
// a procedure with debug info
::aProcStack[ i - nDebugLevel + 1 ] := ::aCallStack[ nPos ]
ELSE
@@ -1916,20 +1901,20 @@ METHOD PROCEDURE LoadVars() CLASS HBDebugger // updates monitored variables
ENDIF
ENDIF
IF ::aProcStack[ ::oBrwStack:Cargo ][ CSTACK_LINE ] != NIL
IF ::aProcStack[ ::oBrwStack:Cargo ][ HB_DBG_CS_LINE ] != NIL
IF ::lShowGlobals
cName := ::aProcStack[ ::oBrwStack:Cargo ][ CSTACK_MODULE ]
cName := ::aProcStack[ ::oBrwStack:Cargo ][ HB_DBG_CS_MODULE ]
FOR EACH n IN ::aModules
IF ! ::lShowAllGlobals
IF ! ::ModuleMatch( n[ MODULE_NAME ], cName )
IF ! ::ModuleMatch( n[ HB_DBG_MOD_NAME ], cName )
LOOP
ENDIF
ENDIF
FOR EACH m IN n[ MODULE_GLOBALS ]
FOR EACH m IN n[ HB_DBG_MOD_GLOBALS ]
AAdd( aBVars, m )
NEXT
IF ! ::lShowAllGlobals
FOR EACH m IN n[ MODULE_EXTERNGLOBALS ]
FOR EACH m IN n[ HB_DBG_MOD_EXTGLOBALS ]
AAdd( aBVars, m )
NEXT
ENDIF
@@ -1937,22 +1922,22 @@ METHOD PROCEDURE LoadVars() CLASS HBDebugger // updates monitored variables
ENDIF
IF ::lShowStatics
cName := ::aProcStack[ ::oBrwStack:Cargo ][ CSTACK_MODULE ]
IF ( n := AScan( ::aModules, {| a | ::ModuleMatch( a[ MODULE_NAME ], cName ) } ) ) > 0
FOR EACH m IN ::aModules[ n ][ MODULE_STATICS ]
cName := ::aProcStack[ ::oBrwStack:Cargo ][ HB_DBG_CS_MODULE ]
IF ( n := AScan( ::aModules, {| a | ::ModuleMatch( a[ HB_DBG_MOD_NAME ], cName ) } ) ) > 0
FOR EACH m IN ::aModules[ n ][ HB_DBG_MOD_STATICS ]
AAdd( aBVars, m )
NEXT
ENDIF
FOR EACH n IN ::aProcStack[ ::oBrwStack:Cargo ][ CSTACK_STATICS ]
FOR EACH n IN ::aProcStack[ ::oBrwStack:Cargo ][ HB_DBG_CS_STATICS ]
AAdd( aBVars, n )
NEXT
ENDIF
IF ::lShowLocals
FOR EACH n IN ::aProcStack[ ::oBrwStack:Cargo ][ CSTACK_LOCALS ]
cName := n[ VAR_NAME ]
FOR EACH n IN ::aProcStack[ ::oBrwStack:Cargo ][ HB_DBG_CS_LOCALS ]
cName := n[ HB_DBG_VAR_NAME ]
// Is there another var with this name ?
IF ( m := AScan( aBVars, {| aVar | aVar[ VAR_NAME ] == cName .AND. hb_LeftEq( aVar[ VAR_TYPE ], "S" ) } ) ) > 0
IF ( m := AScan( aBVars, {| aVar | aVar[ HB_DBG_VAR_NAME ] == cName .AND. aVar[ HB_DBG_VAR_TYPE ] == "S" } ) ) > 0
aBVars[ m ] := n
ELSE
AAdd( aBVars, n )
@@ -2513,8 +2498,8 @@ METHOD PROCEDURE SaveSettings( cFileName ) CLASS HBDebugger
ENDIF
FOR EACH aBreak IN __dbgGetBreakPoints( ::pInfo )
cInfo += "BP " + hb_ntos( aBreak[ 1 ] ) + " " + ;
AllTrim( aBreak[ 2 ] ) + hb_eol()
cInfo += "BP " + hb_ntos( aBreak[ HB_DBG_BP_LINE ] ) + " " + ;
aBreak[ HB_DBG_BP_MODULE ] + hb_eol()
NEXT
FOR EACH aWatch IN ::aWatch
@@ -2715,12 +2700,12 @@ METHOD PROCEDURE ShowCodeLine( nProc ) CLASS HBDebugger
::oBrwStack:RefreshAll()
ENDIF
nLine := ::aProcStack[ nProc ][ CSTACK_LINE ]
cPrgName := ::aProcStack[ nProc ][ CSTACK_MODULE ]
nLine := ::aProcStack[ nProc ][ HB_DBG_CS_LINE ]
cPrgName := ::aProcStack[ nProc ][ HB_DBG_CS_MODULE ]
IF nLine == NIL
::oBrwText := NIL
::oWndCode:Browser := NIL
::oWndCode:SetCaption( ::aProcStack[ nProc ][ CSTACK_FUNCTION ] + ;
::oWndCode:SetCaption( ::aProcStack[ nProc ][ HB_DBG_CS_FUNCTION ] + ;
": Code not available" )
::oWndCode:Refresh() // to force the window caption to update
RETURN
@@ -2744,7 +2729,7 @@ METHOD PROCEDURE ShowCodeLine( nProc ) CLASS HBDebugger
IF ! hb_FileExists( cPrgName )
::oBrwText := NIL
::oWndCode:Browser := NIL
::oWndCode:SetCaption( ::aProcStack[ nProc ][ CSTACK_MODULE ] + ;
::oWndCode:SetCaption( ::aProcStack[ nProc ][ HB_DBG_CS_MODULE ] + ;
" File not found" )
::oWndCode:Refresh()
RETURN
@@ -3051,8 +3036,10 @@ METHOD BreakPointList() CLASS HBDebugger
LOCAL aBreak, cType
FOR EACH aBreak IN __dbgGetBreakPoints( ::pInfo )
cType := iif( aBreak[ 3 ] != NIL, aBreak[ 3 ], ;
hb_ntos( aBreak[ 1 ] ) + " " + aBreak[ 2 ] )
cType := iif( aBreak[ HB_DBG_BP_FUNC ] != NIL, ;
aBreak[ HB_DBG_BP_FUNC ], ;
hb_ntos( aBreak[ HB_DBG_BP_LINE ] ) + " " + ;
aBreak[ HB_DBG_BP_MODULE ] )
::CommandWindowDisplay( hb_ntos( aBreak:__enumIndex() - 1 ) + ") " + ;
cType, .F. )
NEXT
@@ -3097,46 +3084,47 @@ METHOD VarGetInfo( aVar ) CLASS HBDebugger
LOCAL uValue := ::VarGetValue( aVar )
LOCAL cType
SWITCH Left( aVar[ VAR_TYPE ], 1 )
SWITCH aVar[ HB_DBG_VAR_TYPE ]
CASE "G" ; cType := "Global" ; EXIT
CASE "L" ; cType := "Local" ; EXIT
CASE "S" ; cType := "Static" ; EXIT
OTHERWISE ; cType := aVar[ VAR_TYPE ]
OTHERWISE ; cType := aVar[ HB_DBG_VAR_TYPE ]
ENDSWITCH
RETURN aVar[ VAR_NAME ] + " <" + cType + ", " + ValType( uValue ) + ">: " + __dbgValToStr( uValue )
RETURN aVar[ HB_DBG_VAR_NAME ] + " <" + cType + ", " + ValType( uValue ) + ">: " + __dbgValToStr( uValue )
METHOD VarGetValue( aVar ) CLASS HBDebugger
SWITCH Left( aVar[ VAR_TYPE ], 1 )
CASE "G" ; RETURN __dbgVMVarGGet( aVar[ VAR_LEVEL ], aVar[ VAR_POS ] )
CASE "L" ; RETURN __dbgVMVarLGet( __dbgProcLevel() - aVar[ VAR_LEVEL ], aVar[ VAR_POS ] )
CASE "S" ; RETURN __dbgVMVarSGet( aVar[ VAR_LEVEL ], aVar[ VAR_POS ] )
SWITCH aVar[ HB_DBG_VAR_TYPE ]
CASE "G" ; RETURN __dbgVMVarGGet( aVar[ HB_DBG_VAR_FRAME ], aVar[ HB_DBG_VAR_INDEX ] )
CASE "L" ; RETURN __dbgVMVarLGet( __dbgProcLevel() - aVar[ HB_DBG_VAR_FRAME ], aVar[ HB_DBG_VAR_INDEX ] )
CASE "S" ; RETURN __dbgVMVarSGet( aVar[ HB_DBG_VAR_FRAME ], aVar[ HB_DBG_VAR_INDEX ] )
ENDSWITCH
RETURN aVar[ VAR_POS ] // Public or Private
// Public or Private created in ::LoadVars(), value stored in HB_DBG_VAR_INDEX
RETURN aVar[ HB_DBG_VAR_MVALUE ]
METHOD VarSetValue( aVar, uValue ) CLASS HBDebugger
LOCAL nProcLevel
SWITCH Left( aVar[ VAR_TYPE ], 1 )
SWITCH aVar[ HB_DBG_VAR_TYPE ]
CASE "G"
__dbgVMVarGSet( aVar[ VAR_LEVEL ], aVar[ VAR_POS ], uValue )
__dbgVMVarGSet( aVar[ HB_DBG_VAR_FRAME ], aVar[ HB_DBG_VAR_INDEX ], uValue )
EXIT
CASE "L"
nProcLevel := __dbgProcLevel() - aVar[ VAR_LEVEL ] // skip debugger stack
__dbgVMVarLSet( nProcLevel, aVar[ VAR_POS ], uValue )
nProcLevel := __dbgProcLevel() - aVar[ HB_DBG_VAR_FRAME ] // skip debugger stack
__dbgVMVarLSet( nProcLevel, aVar[ HB_DBG_VAR_INDEX ], uValue )
EXIT
CASE "S"
__dbgVMVarSSet( aVar[ VAR_LEVEL ], aVar[ VAR_POS ], uValue )
__dbgVMVarSSet( aVar[ HB_DBG_VAR_FRAME ], aVar[ HB_DBG_VAR_INDEX ], uValue )
EXIT
OTHERWISE
// Public or Private
aVar[ VAR_POS ] := uValue
&( aVar[ VAR_NAME ] ) := uValue
// Public or Private created in ::LoadVars(), value stored in HB_DBG_VAR_INDEX
aVar[ HB_DBG_VAR_MVALUE ] := uValue
&( aVar[ HB_DBG_VAR_NAME ] ) := uValue
ENDSWITCH
RETURN Self
@@ -3144,19 +3132,9 @@ METHOD VarSetValue( aVar, uValue ) CLASS HBDebugger
METHOD PROCEDURE ViewSets() CLASS HBDebugger
LOCAL oWndSets := HBDbWindow():New( 1, 8, ::nMaxRow - 2, ::nMaxCol - 8, ;
"System Settings[1..47]", ::ClrModal() )
LOCAL aSets := { ;
"Exact", "Fixed", "Decimals", "DateFormat", "Epoch", "Path", ;
"Default", "Exclusive", "SoftSeek", "Unique", "Deleted", ;
"Cancel", "Debug", "TypeAhead", "Color", "Cursor", "Console", ;
"Alternate", "AltFile", "Device", "Extra", "ExtraFile", ;
"Printer", "PrintFile", "Margin", "Bell", "Confirm", "Escape", ;
"Insert", "Exit", "Intensity", "ScoreBoard", "Delimeters", ;
"DelimChars", "Wrap", "Message", "MCenter", "ScrollBreak", ;
"EventMask", "VideoMode", "MBlockSize", "MFileExt", ;
"StrictRead", "Optimize", "Autopen", "Autorder", "AutoShare" }
LOCAL aSets := __dbgGetSETs()
LOCAL oWndSets := HBDbWindow():New( 1, 7, ::nMaxRow - 2, ::nMaxCol - 7, ;
"System Settings[1.." + hb_ntos( aTail( aSets )[ HB_DBG_SET_POS ] ) + "]", ::ClrModal() )
LOCAL oBrwSets := HBDbBrowser():new( oWndSets:nTop + 1, oWndSets:nLeft + 1, ;
oWndSets:nBottom - 1, oWndSets:nRight - 1 )
LOCAL nWidth := oWndSets:nRight - oWndSets:nLeft - 1
@@ -3169,17 +3147,18 @@ METHOD PROCEDURE ViewSets() CLASS HBDebugger
oBrwSets:goBottomBlock := {|| oBrwSets:cargo[ 1 ] := Len( oBrwSets:cargo[ 2 ][ 1 ] ) }
oBrwSets:skipBlock := {| nPos | ( nPos := ArrayBrowseSkip( nPos, oBrwSets ), oBrwSets:cargo[ 1 ] := ;
oBrwSets:cargo[ 1 ] + nPos, nPos ) }
oBrwSets:AddColumn( oCol := HBDbColumnNew( "", {|| PadR( aSets[ oBrwSets:cargo[ 1 ] ], 12 ) } ) )
oBrwSets:AddColumn( oCol := HBDbColumnNew( "", {|| aSets[ oBrwSets:cargo[ 1 ] ][ HB_DBG_SET_NAME ] } ) )
AAdd( oBrwSets:Cargo[ 2 ], aSets )
ocol:defcolor := { 1, 2 }
oCol:Width := 14
oCol:defcolor := { 1, 2 }
oBrwSets:AddColumn( oCol := HBDbColumnNew( "", ;
{|| PadR( __dbgValToExp( Set( oBrwSets:cargo[ 1 ] ) ), nWidth - 13 ) } ) )
ocol:defcolor := { 1, 3 }
ocol:width := 40
{|| PadR( __dbgValToExp( Set( aSets[ oBrwSets:cargo[ 1 ] ][ HB_DBG_SET_POS ] ) ), nWidth - 13 ) } ) )
oCol:defcolor := { 1, 3 }
oCol:width := 40
oWndSets:bPainted := {|| oBrwSets:ForceStable(), RefreshVarsS( oBrwSets ) }
oWndSets:bKeyPressed := {| nKey | SetsKeyPressed( nKey, oBrwSets, Len( aSets ), ;
oWndSets, "System Settings", ;
{|| ::EditSet( oBrwSets:Cargo[ 1 ], oBrwSets ) } ) }
{|| ::EditSet( aSets[ oBrwSets:Cargo[ 1 ] ][ HB_DBG_SET_POS ], oBrwSets ) } ) }
oWndSets:ShowModal()