2014-09-08 23:40 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)

* contrib/hbct/ctwin.c
    ! fixed typo in window area checking when current window is 0
      It fixes problem with debugger reported by Rolf.

  * src/debug/dbgentry.c
    % few optimizations
    ! added few protections against GPF when wrong parameters are passed
    ! fixed missing support for symbol, date and timestamp values in
      tracepoints
    + added __dbgCntWatch()

  * src/rtl/filesys.c
  * src/rtl/hbproces.c
    * pacified warning in more aggressive way for newer GCC versions

  * include/harbour.hbx
    * refreshed
This commit is contained in:
Przemysław Czerpak
2014-09-08 23:40:20 +02:00
parent a777fd8568
commit e31d7b4ca7
6 changed files with 87 additions and 49 deletions

View File

@@ -10,6 +10,25 @@
* Change, ! Fix, % Optimization, + Addition, - Removal, ; Comment
*/
2014-09-08 23:40 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
* contrib/hbct/ctwin.c
! fixed typo in window area checking when current window is 0
It fixes problem with debugger reported by Rolf.
* src/debug/dbgentry.c
% few optimizations
! added few protections against GPF when wrong parameters are passed
! fixed missing support for symbol, date and timestamp values in
tracepoints
+ added __dbgCntWatch()
* src/rtl/filesys.c
* src/rtl/hbproces.c
* pacified warning in more aggressive way for newer GCC versions
* include/harbour.hbx
* refreshed
2014-09-05 13:24 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
* include/harbour.hbx
* src/rtl/val.c

View File

@@ -1985,7 +1985,7 @@ static HB_BOOL hb_ctw_gt_PutChar( PHB_GT pGT, int iRow, int iCol,
{
iWndRow = iRow - pWnd->iFirstRow;
iWndCol = iCol - pWnd->iFirstCol;
iWndHeight = pWnd->iWidth;
iWndHeight = pWnd->iHeight;
iWndWidth = pWnd->iWidth;
}
else if( pWnd->fClip &&

View File

@@ -649,9 +649,9 @@ DYNAMIC hb_langErrMsg
DYNAMIC hb_langMessage
DYNAMIC hb_langName
DYNAMIC hb_langNew
DYNAMIC hb_langSelect
DYNAMIC hb_LeftEq
DYNAMIC hb_LeftEqI
DYNAMIC hb_langSelect
DYNAMIC hb_libError
DYNAMIC hb_libExt
DYNAMIC hb_libFree
@@ -949,6 +949,8 @@ DYNAMIC IndexKey
DYNAMIC IndexOrd
DYNAMIC Inkey
DYNAMIC Int
DYNAMIC IOUSR_Register
DYNAMIC IOUSR_SetError
DYNAMIC IsAffirm
DYNAMIC IsAlpha
DYNAMIC IsColor

View File

@@ -222,8 +222,10 @@ static void hb_dbgActivate( HB_DEBUGINFO * info )
for( i = 0; i < info->nCallStackLen; i++ )
{
HB_CALLSTACKINFO * pEntry = &info->aCallStack[ i ];
PHB_ITEM aEntry = hb_itemArrayNew( 6 );
PHB_ITEM pItem;
PHB_ITEM aEntry, pItem;
aEntry = hb_arrayGetItemPtr( aCallStack, info->nCallStackLen - i );
hb_arrayNew( aEntry, 6 );
hb_arraySetC( aEntry, 1, pEntry->szModule );
hb_arraySetC( aEntry, 2, pEntry->szFunction );
@@ -237,9 +239,6 @@ static void hb_dbgActivate( HB_DEBUGINFO * info )
pItem = hb_dbgActivateVarArray( pEntry->nStatics, pEntry->aStatics );
hb_arraySet( aEntry, 6, pItem );
hb_itemRelease( pItem );
hb_arraySet( aCallStack, info->nCallStackLen - i, aEntry );
hb_itemRelease( aEntry );
}
aModules = hb_dbgActivateModuleArray();
@@ -272,8 +271,9 @@ static PHB_ITEM hb_dbgActivateBreakArray( HB_DEBUGINFO * info )
for( i = 0; i < info->nBreakPoints; i++ )
{
PHB_ITEM pBreak = hb_itemArrayNew( 3 );
PHB_ITEM pBreak = hb_arrayGetItemPtr( pArray, i + 1 );
hb_arrayNew( pBreak, 3 );
if( ! info->aBreak[ i ].szFunction )
{
hb_arraySetNI( pBreak, 1, info->aBreak[ i ].nLine );
@@ -281,9 +281,6 @@ static PHB_ITEM hb_dbgActivateBreakArray( HB_DEBUGINFO * info )
}
else
hb_arraySetC( pBreak, 3, info->aBreak[ i ].szFunction );
hb_arraySet( pArray, i + 1, pBreak );
hb_itemRelease( pBreak );
}
return pArray;
}
@@ -300,8 +297,9 @@ static PHB_ITEM hb_dbgActivateModuleArray( void )
for( i = 0; i < s_common.nModules; i++ )
{
PHB_ITEM pModule = hb_itemArrayNew( 4 );
PHB_ITEM item;
PHB_ITEM pModule = hb_arrayGetItemPtr( pArray, i + 1 ), item;
hb_arrayNew( pModule, 4 );
hb_arraySetC( pModule, 1, s_common.aModules[ i ].szModule );
@@ -319,9 +317,6 @@ static PHB_ITEM hb_dbgActivateModuleArray( void )
s_common.aModules[ i ].aExternGlobals );
hb_arraySet( pModule, 4, item );
hb_itemRelease( item );
hb_arraySet( pArray, i + 1, pModule );
hb_itemRelease( pModule );
}
HB_DBGCOMMON_UNLOCK();
@@ -337,7 +332,9 @@ static PHB_ITEM hb_dbgActivateVarArray( int nVars, HB_VARINFO * aVars )
for( i = 0; i < nVars; i++ )
{
PHB_ITEM aVar = hb_itemArrayNew( 4 );
PHB_ITEM aVar = hb_arrayGetItemPtr( pArray, i + 1 );
hb_arrayNew( aVar, 4 );
hb_arraySetC( aVar, 1, aVars[ i ].szName );
hb_arraySetNL( aVar, 2, aVars[ i ].nIndex );
@@ -346,9 +343,6 @@ static PHB_ITEM hb_dbgActivateVarArray( int nVars, HB_VARINFO * aVars )
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 );
}
return pArray;
}
@@ -441,7 +435,7 @@ void hb_dbgEntry( int nMode, int nLine, const char * szName, int nIndex, PHB_ITE
xValue = hb_dbgEval( info, &info->aWatch[ tp->nIndex ] );
if( ! ( xValue == NULL && tp->xValue == NULL ) &&
if( xValue != tp->xValue &&
( xValue == NULL || tp->xValue == NULL ||
HB_ITEM_TYPE( xValue ) != HB_ITEM_TYPE( tp->xValue ) ||
! hb_dbgEqual( xValue, tp->xValue ) ) )
@@ -858,6 +852,14 @@ static void hb_dbgClearWatch( HB_WATCHPOINT * pWatch )
}
static int hb_dbgCountWatch( void * handle )
{
HB_DEBUGINFO * info = ( HB_DEBUGINFO * ) handle;
return info->nWatchPoints;
}
void hb_dbgDelBreak( void * handle, int nBreak )
{
HB_DEBUGINFO * info = ( HB_DEBUGINFO * ) handle;
@@ -879,30 +881,33 @@ void hb_dbgDelBreak( void * handle, int nBreak )
void hb_dbgDelWatch( void * handle, int nWatch )
{
HB_DEBUGINFO * info = ( HB_DEBUGINFO * ) handle;
HB_WATCHPOINT * pWatch = &info->aWatch[ nWatch ];
int i;
hb_dbgClearWatch( pWatch );
ARRAY_DEL( HB_WATCHPOINT, info->aWatch, info->nWatchPoints, nWatch );
for( i = 0; i < info->nTracePoints; i++ )
if( nWatch >= 0 && nWatch < info->nWatchPoints )
{
HB_TRACEPOINT * pTrace = &info->aTrace[ i ];
HB_WATCHPOINT * pWatch = &info->aWatch[ nWatch ];
int i;
if( pTrace->nIndex == nWatch )
hb_dbgClearWatch( pWatch );
ARRAY_DEL( HB_WATCHPOINT, info->aWatch, info->nWatchPoints, nWatch );
for( i = 0; i < info->nTracePoints; i++ )
{
if( pTrace->xValue )
hb_itemRelease( pTrace->xValue );
HB_TRACEPOINT * pTrace = &info->aTrace[ i ];
ARRAY_DEL( HB_TRACEPOINT, info->aTrace, info->nTracePoints, i );
i--;
if( pTrace->nIndex == nWatch )
{
if( pTrace->xValue )
hb_itemRelease( pTrace->xValue );
ARRAY_DEL( HB_TRACEPOINT, info->aTrace, info->nTracePoints, i );
i--;
}
else if( pTrace->nIndex > nWatch )
pTrace->nIndex--;
}
else if( pTrace->nIndex > nWatch )
pTrace->nIndex--;
}
}
static void hb_dbgEndProc( HB_DEBUGINFO * info )
{
HB_CALLSTACKINFO * top;
@@ -938,12 +943,18 @@ static HB_BOOL hb_dbgEqual( PHB_ITEM pItem1, PHB_ITEM pItem2 )
return hb_itemGetL( pItem1 ) == hb_itemGetL( pItem2 );
if( HB_IS_POINTER( pItem1 ) )
return hb_itemGetPtr( pItem1 ) == hb_itemGetPtr( pItem2 );
if( HB_IS_SYMBOL( pItem1 ) )
return hb_itemGetSymbol( pItem1 ) == hb_itemGetSymbol( pItem2 );
if( HB_IS_STRING( pItem1 ) )
return ! hb_itemStrCmp( pItem1, pItem2, HB_TRUE );
if( HB_IS_NUMINT( pItem1 ) )
return hb_itemGetNInt( pItem1 ) == hb_itemGetNInt( pItem2 );
if( HB_IS_NUMERIC( pItem1 ) )
return hb_itemGetND( pItem1 ) == hb_itemGetND( pItem2 );
if( HB_IS_DATE( pItem1 ) )
return hb_itemGetDL( pItem1 ) == hb_itemGetDL( pItem2 );
if( HB_IS_TIMESTAMP( pItem1 ) )
return hb_itemGetTD( pItem1 ) == hb_itemGetTD( pItem2 );
if( HB_IS_ARRAY( pItem1 ) )
return hb_arrayId( pItem1 ) == hb_arrayId( pItem2 );
if( HB_IS_HASH( pItem1 ) )
@@ -965,26 +976,21 @@ static PHB_ITEM hb_dbgEval( HB_DEBUGINFO * info, HB_WATCHPOINT * watch )
if( watch->pBlock )
{
PHB_ITEM aVars = hb_dbgEvalResolve( info, watch );
PHB_ITEM aNewVars = hb_itemArrayNew( watch->nVars );
PHB_ITEM aNewVars = hb_itemClone( aVars );
HB_BOOL bInside = info->bInside;
int i;
hb_arrayCopy( aVars, aNewVars, NULL, NULL, NULL );
info->bInside = HB_TRUE;
xResult = hb_itemDo( watch->pBlock, 1, aNewVars );
info->bInside = bInside;
for( i = 0; i < watch->nVars; i++ )
{
PHB_ITEM xOldValue = hb_itemArrayGet( aVars, i + 1 );
PHB_ITEM xNewValue = hb_itemArrayGet( aNewVars, i + 1 );
PHB_ITEM xOldValue = hb_arrayGetItemPtr( aVars, i + 1 );
PHB_ITEM xNewValue = hb_arrayGetItemPtr( aNewVars, i + 1 );
if( ! hb_dbgEqual( xOldValue, xNewValue ) )
hb_dbgVarSet( &watch->aScopes[ i ], xNewValue );
hb_itemRelease( xOldValue );
hb_itemRelease( xNewValue );
}
hb_itemRelease( aVars );
@@ -1352,7 +1358,10 @@ PHB_ITEM hb_dbgGetWatchValue( void * handle, int nWatch )
{
HB_DEBUGINFO * info = ( HB_DEBUGINFO * ) handle;
return hb_dbgEval( info, &( info->aWatch[ nWatch ] ) );
if( nWatch >= 0 && nWatch < info->nWatchPoints )
return hb_dbgEval( info, &( info->aWatch[ nWatch ] ) );
else
return NULL;
}
@@ -1817,6 +1826,14 @@ HB_FUNC( __DBGSETWATCH )
hb_dbgSetWatch( ptr, hb_parni( 2 ), hb_parc( 3 ), hb_parl( 4 ) );
}
HB_FUNC( __DBGCNTWATCH )
{
void * ptr = hb_parptr( 1 );
if( ptr )
hb_retni( hb_dbgCountWatch( ptr ) );
}
HB_FUNC( __DBGGETMODULENAME )
{
void * ptr = hb_parptr( 1 );

View File

@@ -719,8 +719,8 @@ HB_FHANDLE hb_fsPOpen( const char * pszFileName, const char * pszMode )
iMaxFD = 1024;
for( hNullHandle = 3; hNullHandle < iMaxFD; ++hNullHandle )
hb_fsClose( hNullHandle );
( void ) setuid( getuid() );
( void ) setgid( getgid() );
if( setuid( getuid() ) == -1 ) {}
if( setgid( getgid() ) == -1 ) {}
#if defined( __WATCOMC__ )
HB_FAILURE_RETRY( iResult, execv( "/bin/sh", argv ) );
#else

View File

@@ -568,8 +568,8 @@ HB_FHANDLE hb_fsProcessOpen( const char * pszFileName,
}
/* reset extended process attributes */
( void ) setuid( getuid() );
( void ) setgid( getgid() );
if( setuid( getuid() ) == -1 ) {}
if( setgid( getgid() ) == -1 ) {}
/* execute command */
{