diff --git a/harbour/ChangeLog b/harbour/ChangeLog index e9c8b56a7e..da7d37856a 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,43 @@ 2002-12-01 23:12 UTC+0100 Foo Bar */ +2004-02-11 13:40 UTC+0100 Ryszard Glab + + source/debug/dbgbrwsr.prg + + The new file with TDbgBrowser class which inherits + from TBrowse + + * hrbdll.bc + * hrbdll.vc + * makefile.bc + * makefile.nt + * makefile.vc + * source/debug/Makefile + + added the reference to dbgbrwsr.prg + + * source/debug/dbgmenu.prg + + added "Run at Startup' option + + * source/debug/dbgtwin.prg + * source/debug/debugger.prg + * source/debug/tbrwtext.prg + + added "Run at Startup' option - if it is enabled then + the debugged application runs until ALTD() is called or + Alt+D keys pressed (Clipper compatibility - the default + option). If it is disabled the the debugger shows up at + the first code line with the debug info. + This setting is stored in the initialization file + (init.cld) as 'Options NoRunAtStartup'. + * fixed more display/refreshing issues + * fixed quiting the debugger + + * source/rtl/alert.prg + * fixed bug with messages longer then 60 bytes + + * source/vm/hvm.c + * hb_vmDebugEndProc() is called before the eval stack + is cleaned - this allows to handle INIT/EXIT procedures + correctly + 2004-02-05 18:49 UTC-0800 Luis Krause Mantilla * source/vm/debug.c + add wrappers (some 3rd-party-libs still use these ones) for: diff --git a/harbour/hrbdll.bc b/harbour/hrbdll.bc index 440ffa87c3..2ec0e040b4 100644 --- a/harbour/hrbdll.bc +++ b/harbour/hrbdll.bc @@ -2153,6 +2153,12 @@ $(OBJ_DIR)\debugger.c : $(DEBUG_DIR)\debugger.prg $(OBJ_DIR)\debugger.obj : $(OBJ_DIR)\debugger.c $(CC) $(CLIBFLAGS) -o$@ $** +$(OBJ_DIR)\dbgbrwsr.c : $(DEBUG_DIR)\dbgbrwsr.prg + $(HARBOUR_EXE) $(HARBOURFLAGS) $** -o$@ + +$(OBJ_DIR)\dbgbrwsr.obj : $(OBJ_DIR)\dbgbrwsr.c + $(CC) $(CLIBFLAGS) -o$@ $** + $(OBJ_DIR)\tbrwtext.c : $(DEBUG_DIR)\tbrwtext.prg $(HARBOUR_EXE) $(HARBOURFLAGS) $** -o$@ diff --git a/harbour/hrbdll.vc b/harbour/hrbdll.vc index 28e4a4a7dc..e3bea225bb 100644 --- a/harbour/hrbdll.vc +++ b/harbour/hrbdll.vc @@ -1654,6 +1654,12 @@ $(OBJ_DIR)\debugger.c : $(DEBUG_DIR)\debugger.prg $(OBJ_DIR)\debugger.obj : $(OBJ_DIR)\debugger.c $(CC) $(CLIBFLAGS) /Fo$@ $** +$(OBJ_DIR)\dbgbrwsr.c : $(DEBUG_DIR)\dbgbrwsr.prg + $(HARBOUR_EXE) $(HARBOURFLAGS) $** -o$@ + +$(OBJ_DIR)\dbgbrwsr.obj : $(OBJ_DIR)\dbgbrwsr.c + $(CC) $(CLIBFLAGS) /Fo$@ $** + $(OBJ_DIR)\tbrwtext.c : $(DEBUG_DIR)\tbrwtext.prg $(HARBOUR_EXE) $(HARBOURFLAGS) $** -o$@ diff --git a/harbour/makefile.bc b/harbour/makefile.bc index 03a09b5d94..4d604ef4db 100644 --- a/harbour/makefile.bc +++ b/harbour/makefile.bc @@ -2486,6 +2486,13 @@ $(OBJ_DIR)\debugger.obj : $(OBJ_DIR)\debugger.c $(CC) $(CLIBFLAGS) -o$@ $** tlib $(DEBUG_LIB) $(ARFLAGS) -+$@,, +$(OBJ_DIR)\dbgbrwsr.c : $(DEBUG_DIR)\dbgbrwsr.prg + $(HARBOUR_EXE) $(HARBOURFLAGS) $** -o$@ + +$(OBJ_DIR)\dbgbrwsr.obj : $(OBJ_DIR)\dbgbrwsr.c + $(CC) $(CLIBFLAGS) -o$@ $** + tlib $(DEBUG_LIB) $(ARFLAGS) -+$@,, + $(OBJ_DIR)\tbrwtext.c : $(DEBUG_DIR)\tbrwtext.prg $(HARBOUR_EXE) $(HARBOURFLAGS) $** -o$@ diff --git a/harbour/makefile.nt b/harbour/makefile.nt index 0ba9c3e543..514f62728f 100644 --- a/harbour/makefile.nt +++ b/harbour/makefile.nt @@ -681,6 +681,7 @@ DEBUG_LIB_OBJS = \ $(OBJ_DIR)\dbgtmitm.obj \ $(OBJ_DIR)\dbgtwin.obj \ $(OBJ_DIR)\debugger.obj \ + $(OBJ_DIR)\dbgbrwsr.obj \ $(OBJ_DIR)\dbgtarr.obj \ $(OBJ_DIR)\dbgtobj.obj \ $(OBJ_DIR)\dbghelp.obj \ diff --git a/harbour/makefile.vc b/harbour/makefile.vc index a02228705b..f890008953 100644 --- a/harbour/makefile.vc +++ b/harbour/makefile.vc @@ -645,6 +645,7 @@ DEBUG_LIB_OBJS = \ $(OBJ_DIR)\dbgtmitm.obj \ $(OBJ_DIR)\dbgtwin.obj \ $(OBJ_DIR)\debugger.obj \ + $(OBJ_DIR)\dbgbrwsr.obj \ $(OBJ_DIR)\dbgtarr.obj \ $(OBJ_DIR)\dbgtobj.obj \ $(OBJ_DIR)\dbghelp.obj \ diff --git a/harbour/source/debug/Makefile b/harbour/source/debug/Makefile index c8c6e6c7d2..ecc342ebf2 100644 --- a/harbour/source/debug/Makefile +++ b/harbour/source/debug/Makefile @@ -14,7 +14,8 @@ PRG_SOURCES=\ dbgtobj.prg \ tbrwtext.prg \ dbgwa.prg \ - dbghelp.prg + dbghelp.prg \ + dbgbrwsr.prg LIBNAME=debug diff --git a/harbour/source/debug/dbgbrwsr.prg b/harbour/source/debug/dbgbrwsr.prg new file mode 100644 index 0000000000..e2f1fee9ed --- /dev/null +++ b/harbour/source/debug/dbgbrwsr.prg @@ -0,0 +1,94 @@ +/* + * $Id$ + */ + +/* + * Harbour Project source code: + * The Debugger Browser + * + * Copyright 2004 Ryszard Glab + * www - http://www.harbour-project.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this software; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/). + * + * As a special exception, the Harbour Project gives permission for + * additional uses of the text contained in its release of Harbour. + * + * The exception is that, if you link the Harbour libraries with other + * files to produce an executable, this does not by itself cause the + * resulting executable to be covered by the GNU General Public License. + * Your use of that executable is in no way restricted on account of + * linking the Harbour library code into it. + * + * This exception does not however invalidate any other reasons why + * the executable file might be covered by the GNU General Public License. + * + * This exception applies only to the code released by the Harbour + * Project under the name Harbour. If you copy code from other + * Harbour Project or Free Software Foundation releases into a copy of + * Harbour, as the General Public License permits, the exception does + * not apply to the code that you add in this way. To avoid misleading + * anyone as to the status of such modified files, you must delete + * this exception notice from them. + * + * If you write modifications of your own for Harbour, it is your choice + * whether to permit this exception to apply to your modifications. + * If you do not wish that, delete this exception notice. + * + */ + +#include "hbclass.ch" + +CLASS TDbgBrowser FROM TBrowse // Debugger browser + + DATA Window + + METHOD New( nTop, nLeft, nBottom, nRight, oParentWindow ) + METHOD Resize( nTop, nLeft, nBottom, nRight ) + +ENDCLASS + +METHOD New( nTop, nLeft, nBottom, nRight, oParentWindow ) CLASS TDbgBrowser + + ::Window := oParentWindow + ::super:New( nTop, nLeft, nBottom, nRight ) + +RETURN Self + +METHOD Resize( nTop, nLeft, nBottom, nRight ) +LOCAL lResize:=.F. + + IF( nTop != ::nTop ) + ::nTop := nTop + lResize := .T. + ENDIF + IF( nLeft != ::nLeft ) + ::nLeft := nLeft + lResize := .T. + ENDIF + IF( nBottom != ::nBottom ) + ::nBottom := nBottom + lResize := .T. + ENDIF + IF( nRight != ::nRight ) + ::nRight := nRight + lResize := .T. + ENDIF + IF( lResize ) + ::configure() + ENDIF + +RETURN self diff --git a/harbour/source/debug/dbgmenu.prg b/harbour/source/debug/dbgmenu.prg index 8e2fd1bebe..b5c2769eb5 100644 --- a/harbour/source/debug/dbgmenu.prg +++ b/harbour/source/debug/dbgmenu.prg @@ -71,6 +71,7 @@ function __dbgBuildMenu( oDebugger ) // Builds the debugger pulldown menu local oCallStack local oCBTrace local oPPo + local oRunAtStartup MENU oMenu MENUITEM " ~File " @@ -79,7 +80,7 @@ function __dbgBuildMenu( oDebugger ) // Builds the debugger pulldown menu MENUITEM " ~Resume" ACTION oDebugger:Resume() MENUITEM " O~S Shell" ACTION oDebugger:OSShell() SEPARATOR - MENUITEM " e~Xit Alt-X " ACTION oDebugger:Exit(), oDebugger:Hide(), __Quit() + MENUITEM " e~Xit Alt-X " ACTION oDebugger:Quit() ENDMENU MENUITEM " ~Locate " @@ -163,6 +164,8 @@ function __dbgBuildMenu( oDebugger ) // Builds the debugger pulldown menu MENUITEM " ~Colors..." ACTION oDebugger:Colors() MENUITEM " ~Tab Width..." ACTION oDebugger:TabWidth() MENUITEM " path for ~Files..." ACTION oDebugger:PathForFiles() + MENUITEM oRunAtStartup PROMPT " R~un at startup" IDENT "ALTD"; + ACTION ( oDebugger:RunAtStartup(), oRunAtStartup:Toggle() ) CHECKED SEPARATOR MENUITEM " ~Save Settings..." ACTION oDebugger:SaveSettings() MENUITEM " ~Restore Settings... " ACTION oDebugger:RestoreSettings() diff --git a/harbour/source/debug/dbgtwin.prg b/harbour/source/debug/dbgtwin.prg index 61b88ec0c2..cd8ebcac41 100644 --- a/harbour/source/debug/dbgtwin.prg +++ b/harbour/source/debug/dbgtwin.prg @@ -89,6 +89,7 @@ CLASS TDbWindow // Debugger windows and dialogs METHOD Move() METHOD KeyPressed( nKey ) METHOD Refresh() + METHOD Resize() ENDCLASS @@ -104,6 +105,7 @@ METHOD New( nTop, nLeft, nBottom, nRight, cCaption, cColor ) CLASS TDbWindow ::cColor := cColor ::lShadow := .f. ::lVisible := .f. + ::lFocused := .f. return Self @@ -166,10 +168,6 @@ METHOD SetFocus( lOnOff ) CLASS TDbWindow if ::bPainted != nil Eval( ::bPainted, Self ) endif - - IF( ::Browser != NIL ) - ::Browser:RefreshAll() - ENDIF DispEnd() @@ -196,17 +194,13 @@ METHOD Refresh() CLASS TDbWindow Eval( ::bPainted, Self ) endif - IF( ::Browser != NIL ) - ::Browser:RefreshAll() - ENDIF - DispEnd() return nil METHOD Show( lFocused ) CLASS TDbWindow - DEFAULT lFocused TO .f. + DEFAULT lFocused TO ::lFocused ::cBackImage := SaveScreen( ::nTop, ::nLeft, ::nBottom + iif( ::lShadow, 1, 0 ),; ::nRight + iif( ::lShadow, 2, 0 ) ) @@ -347,3 +341,31 @@ LOCAL aClr:=__DbgColors() RETURN nil +METHOD Resize( nTop, nLeft, nBottom, nRight ) CLASS TDbWindow +LOCAL lShow + + IF( lShow:=::lVisible ) + ::Hide() + ENDIF + IF( nTop != NIL ) + ::nTop := nTop + ENDIF + IF( nBottom != NIL ) + ::nBottom := nBottom + ENDIF + IF( nLeft != NIL ) + ::nLeft := nLeft + ENDIF + IF( nRight != NIL ) + ::nRight := nRight + ENDIF + + IF( ::Browser != NIL ) + ::Browser:Resize( ::nTop+1, ::nLeft+1, ::nBottom-1, ::nRight-1 ) + ENDIF + + IF( lShow ) + ::Show( ::lFocused ) + ENDIF + +RETURN self \ No newline at end of file diff --git a/harbour/source/debug/debugger.prg b/harbour/source/debug/debugger.prg index 203b043810..ca39eec047 100644 --- a/harbour/source/debug/debugger.prg +++ b/harbour/source/debug/debugger.prg @@ -106,7 +106,6 @@ static s_oDebugger static s_lExit := .F. -Static nDump memvar __DbgStatics procedure AltD( nAction ) @@ -234,6 +233,10 @@ procedure __dbgEntry( nMode, uParam1, uParam2, uParam3 ) // debugger entry poin return // We can not use s_oDebugger yet, so we return endif + IF( s_lExit ) + RETURN + ENDIF + IF( s_oDebugger == NIL ) s_oDebugger := TDebugger():New() ENDIF @@ -246,7 +249,22 @@ procedure __dbgEntry( nMode, uParam1, uParam2, uParam3 ) // debugger entry poin endif s_oDebugger:StackProc( uParam1, hb_dbg_ProcLevel()-1 ) + case nMode == HB_DBG_ENDPROC + if ProcName( 1 ) == "(_INITSTATICS)" + return + endif + IF( s_lExit ) + RETURN + ENDIF + if s_oDebugger:lCodeblock + s_oDebugger:lCodeblock := .F. + endif + s_oDebugger:EndProc() + case nMode == HB_DBG_LOCALNAME + IF( s_lExit ) + RETURN + ENDIF cProcName := IIF(s_oDebugger:lCodeblock, s_oDebugger:aCallStack[1][CSTACK_FUNCTION], ProcName( 1 )) nVarIndex := uParam1 cVarName := IIF(valtype(uParam2)=='C',uParam2,'NIL') @@ -273,6 +291,10 @@ procedure __dbgEntry( nMode, uParam1, uParam2, uParam3 ) // debugger entry poin return // We can not use s_oDebugger yet, so we return endif + IF( s_lExit ) + RETURN + ENDIF + AAdd( s_oDebugger:aCallStack[ 1 ][ CSTACK_STATICS ], { cVarName, nVarIndex, "Static",, nSFrame } ) if s_oDebugger:lShowStatics @@ -284,15 +306,6 @@ procedure __dbgEntry( nMode, uParam1, uParam2, uParam3 ) // debugger entry poin endif endif - case nMode == HB_DBG_ENDPROC // called from hvm.c hb_vmDebuggerEndProc() - if Empty( ProcName( 1 ) ) // ending (_INITSTATICS) - return - endif - if s_oDebugger:lCodeblock - s_oDebugger:lCodeblock := .F. - endif - s_oDebugger:EndProc() - endcase return @@ -324,6 +337,7 @@ CLASS TDebugger DATA lNextRoutine INIT .F. DATA oBrwPnt, oWndPnt DATA lppo INIT .F. //view preprocessed output + DATA lRunAtStartup METHOD New() METHOD Activate() @@ -373,8 +387,10 @@ CLASS TDebugger METHOD PrevWindow() METHOD Private() METHOD Public() + METHOD Quit() INLINE ::Exit(), ::Hide(), s_lExit:=.T., s_oDebugger:=NIL, __QUIT() METHOD RestoreAppStatus() METHOD RestoreSettings() + METHOD RunAtStartup() INLINE ::lRunAtStartup:=!::lRunAtStartup METHOD SaveAppStatus() METHOD SaveSettings() METHOD Show() @@ -435,6 +451,7 @@ CLASS TDebugger METHOD VarGetValue( aVar ) METHOD VarSetValue( aVar, uValue ) + METHOD ResizeWindows( oWindow ) METHOD NotSupported() INLINE Alert( "Not implemented yet!" ) ENDCLASS @@ -456,7 +473,6 @@ METHOD New() CLASS TDebugger ::aTrace := {} ::lTracepoints := .F. ::aCallStack := {} - ::lGo := .T. //Clipper compatible ::aVars := {} ::lCaseSensitive := .f. ::cSearchString := "" @@ -475,12 +491,15 @@ METHOD New() CLASS TDebugger ::lAll := .f. ::lSortVars := .f. ::cSettingsFileName := "init.cld" + ::lRunAtStartup := .t. //Clipper compatible if File( ::cSettingsFileName ) ::LoadSettings() endif + ::lGo := ::lRunAtStartup ::oPullDown := __dbgBuildMenu( Self ) + ::oPulldown:GetItemByIdent( "ALTD" ):Checked := ::lRunAtStartup ::oWndCode := TDbWindow():New( 1, 0, MaxRow() - 6, MaxCol() ) ::oWndCode:Cargo := { ::oWndCode:nTop, ::oWndCode:nLeft } @@ -846,9 +865,7 @@ METHOD CommandWindowProcessKey( nKey ) CLASS TDebugger lDisplay = .f. case Upper( SubStr( LTrim( cCommand ), 1, 4 ) ) == "QUIT" - ::Exit() - ::Hide() - __Quit() + ::Quit() case Upper( SubStr( LTrim( cCommand ), 1, 6 ) ) == "OUTPUT" SetCursor( SC_NONE ) @@ -1044,7 +1061,7 @@ return nil METHOD EndProc() CLASS TDebugger - if Len( ::aCallStack ) > 1 + if Len( ::aCallStack ) > 0 ADel( ::aCallStack, 1 ) ASize( ::aCallStack, Len( ::aCallStack ) - 1 ) if ::oBrwStack != nil .and. ! ::lTrace @@ -1078,9 +1095,7 @@ METHOD HandleEvent() CLASS TDebugger do case case nKey == K_ALT_X - s_oDebugger:Exit() - s_oDebugger:Hide() - __Quit() + s_oDebugger:Quit() case ::oPullDown:IsOpen() ::oPullDown:ProcessKey( nKey ) @@ -1330,30 +1345,16 @@ METHOD ShowCallStack() CLASS TDebugger SetCursor( SC_NONE ) - // Resize code window DispBegin() - ::oWndCode:Hide() - ::oWndCode:nRight -= 16 - ::oWndCode:Show( .f. ) - ::oBrwText:Resize(,,, ::oBrwText:nRight - 16 ) - ::oBrwText:GotoLine( ::oBrwText:nActiveLine ) - Eval( ::oWndCode:bLostFocus ) - + // Resize code window + ::oWndCode:Resize(,,,::oWndCode:nRight-16) // Resize vars window if ::oWndVars != nil - ::oWndVars:Hide() - ::oWndVars:nRight -= 16 - ::oBrwVars:nRight -= 16 - ::oBrwVars:configure() - ::oWndVars:Show( .f. ) + ::oWndVars:Resize(,,, ::oWndVars:nRight - 16 ) endif // Resize watchpoints window if ::oWndPnt != nil - ::oWndPnt:Hide() - ::oWndPnt:nRight -= 16 - ::oBrwPnt:nRight -= 16 - ::oBrwPnt:configure() - ::oWndPnt:Show( .f. ) + ::oWndPnt:Resize(,,, ::oWndPnt:nRight - 16 ) endif DispEnd() @@ -1367,7 +1368,7 @@ METHOD ShowCallStack() CLASS TDebugger ::oWndStack:bLButtonDown := { | nKey | ::CallStackProcessKey( K_LBUTTONDOWN ) } AAdd( ::aWindows, ::oWndStack ) - ::nCurrentWindow = Len( ::aWindows ) +// ::nCurrentWindow = Len( ::aWindows ) if ::oBrwStack == nil ::BuildBrowseStack() @@ -1378,7 +1379,7 @@ METHOD ShowCallStack() CLASS TDebugger ::oBrwStack:RefreshAll(), ::oBrwStack:ForceStable() } ::oWndStack:bGotFocus = { || SetCursor( SC_NONE ) } - ::oWndStack:Show( .t. ) + ::oWndStack:Show( .f. ) endif return nil @@ -1386,9 +1387,10 @@ return nil METHOD LoadSettings() CLASS TDebugger local cInfo := MemoRead( ::cSettingsFileName ) - local n, cLine, nColor + local n, cLine, nColor, nLen - for n := 1 to MLCount( cInfo ) + nLen := MLCount( cInfo ) + for n := 1 to nLen cLine := MemoLine( cInfo, 120, n ) do case case Upper( SubStr( cLine, 1, 14 ) ) == "OPTIONS COLORS" @@ -1414,6 +1416,9 @@ METHOD LoadSettings() CLASS TDebugger cLine = SubStr( cLine, 13, 120 ) ::cPathForFiles = AllTrim( cLine ) + case Upper( SubStr( cLine, 1, 22 ) ) == "OPTIONS NORUNATSTARTUP" + ::lRunAtStartup := .F. + case Upper( SubStr( cLine, 1, 14 ) ) == "MONITOR STATIC" ::lShowStatics = .t. @@ -1525,7 +1530,6 @@ METHOD ShowVars() CLASS TDebugger Local oCol local lRepaint := .f. local nTop - LOCAL lFocused if ::lGo return nil @@ -1546,17 +1550,10 @@ METHOD ShowVars() CLASS TDebugger iif( ::lShowStatics, " Static", "" ) + iif( ::lShowPrivates, " Private", "" ) + ; iif( ::lShowPublics, " Public", "" ) ) - ::oWndCode:nTop := ::oWndVars:nBottom + 1 - ::oBrwText:Resize( ::oWndCode:nTop + 1 ) - ::oBrwText:RefreshAll() - ::oWndCode:SetFocus( .t. ) - - ::oWndVars:Show( .f. ) - AAdd( ::aWindows, ::oWndVars ) ::oWndVars:bLButtonDown := { | nMRow, nMCol | ::WndVarsLButtonDown( nMRow, nMCol ) } ::oWndVars:bLDblClick := { | nMRow, nMCol | ::EditVar( ::oBrwVars:Cargo[ 1 ] ) } - ::oBrwVars := TBrowseNew( nTop+1, 1, ::oWndVars:nBottom - 1, MaxCol() - iif( ::oWndStack != nil,; + ::oBrwVars := TDbgBrowser():New( nTop+1, 1, ::oWndVars:nBottom - 1, MaxCol() - iif( ::oWndStack != nil,; ::oWndStack:nWidth(), 0 ) - 1 ) ::oWndVars:Browser := ::oBrwVars @@ -1564,7 +1561,7 @@ METHOD ShowVars() CLASS TDebugger ::oBrwVars:Cargo :={ 1,{}} // Actual highligthed row ::oBrwVars:ColorSpec := ::aColors[ 2 ] + "," + ::aColors[ 5 ] + "," + ::aColors[ 3 ] ::oBrwVars:GOTOPBLOCK := { || ::oBrwVars:cargo[ 1 ] := Min( 1, Len( ::aVars ) ) } - ::oBrwVars:GoBottomBlock := { || ::oBrwVars:cargo[ 1 ] := Len( ::aVars ) } + ::oBrwVars:GoBottomBlock := { || ::oBrwVars:cargo[ 1 ] := MAX(1,Len( ::aVars )) } ::oBrwVars:SkipBlock = { | nSkip, nOld | nOld := ::oBrwVars:Cargo[ 1 ],; ::oBrwVars:Cargo[ 1 ] += nSkip,; ::oBrwVars:Cargo[ 1 ] := Min( Max( ::oBrwVars:Cargo[ 1 ], 1 ),; @@ -1579,13 +1576,13 @@ METHOD ShowVars() CLASS TDebugger " " ), ; ::oWndVars:nWidth() - 2 ) } ) ::oBrwVars:AddColumn( oCol ) - AAdd(::oBrwVars:Cargo[2],::avars) + AAdd(::oBrwVars:Cargo[2],::aVars) oCol:DefColor:={1,2} if Len( ::aVars ) > 0 ::oBrwVars:ForceStable() endif - ::oWndVars:bPainted := { || if(Len( ::aVars ) > 0, ( ::obrwVars:ForceStable(),RefreshVarsS(::oBrwVars) ),) } + ::oWndVars:bPainted := { || if(Len( ::aVars ) > 0, ( ::obrwVars:refreshAll():ForceStable(),RefreshVarsS(::oBrwVars) ),) } ::oWndVars:bKeyPressed := { | nKey | ( iif( nKey == K_DOWN ; , ::oBrwVars:Down(), nil ), iif( nKey == K_UP, ::oBrwVars:Up(), nil ) ; @@ -1593,7 +1590,12 @@ METHOD ShowVars() CLASS TDebugger , iif( nKey == K_PGUP, ::oBrwVars:PageUp(), nil ) ; , iif( nKey == K_HOME, ::oBrwVars:GoTop(), nil ) ; , iif( nKey == K_END, ::oBrwVars:GoBottom(), nil ) ; - , iif( nKey == K_ENTER, ::EditVar( ::oBrwVars:Cargo[1] ), nil ), ::oBrwVars:ForceStable() ) } + , iif( nKey == K_ENTER, ::EditVar( ::oBrwVars:Cargo[1] ), nil ), IIF(LEN(::aVars)>0,::oBrwVars:ForceStable(),nil) ) } + + AAdd( ::aWindows, ::oWndVars ) + ::oWndVars:Show() + ::ResizeWindows( ::oWndVars ) + else ::oWndVars:cCaption := "Monitor:" + ; iif( ::lShowLocals, " Local", "" ) + ; @@ -1601,44 +1603,26 @@ METHOD ShowVars() CLASS TDebugger iif( ::lShowPrivates, " Private", "" ) + ; iif( ::lShowPublics, " Public", "" ) - lFocused := ::aWindows[ ::nCurrentWindow ] == ::oWndVars DispBegin() + if( ::oBrwVars:cargo[1] <= 0 ) + ::oBrwVars:cargo[1] := 1 + endif + if Len( ::aVars ) == 0 if ::oWndVars:nBottom - ::oWndVars:nTop > 1 - ::oWndVars:Hide() - ::oWndVars:nBottom := ::oWndVars:nTop + 1 + ::oWndVars:Resize( ,, ::oWndVars:nTop + 1 ) lRepaint := .t. endif - endif - if Len( ::aVars ) > ::oWndVars:nBottom - ::oWndVars:nTop - 1 - ::oWndVars:Hide() - ::oWndVars:nBottom := ::oWndVars:nTop + Min( Len( ::aVars ) + 1, 7 ) - ::oBrwVars:nBottom := ::oWndVars:nBottom - 1 - ::oBrwVars:Configure() + elseif Len( ::aVars ) > ::oWndVars:nBottom - ::oWndVars:nTop - 1 + ::oWndVars:Resize( ,, ::oWndVars:nTop + Min( Len( ::aVars ) + 1, 7 ) ) + lRepaint := .t. + elseif Len( ::aVars ) < ::oWndVars:nBottom - ::oWndVars:nTop - 1 + ::oWndVars:Resize( ,, ::oWndVars:nTop + Len( ::aVars ) + 1 ) lRepaint := .t. endif - if Len( ::aVars ) < ::oWndVars:nBottom - ::oWndVars:nTop - 1 - ::oWndVars:Hide() - ::oWndVars:nBottom := ::oWndVars:nTop + Len( ::aVars ) + 1 - ::oBrwVars:nBottom := ::oWndVars:nBottom - 1 - ::oBrwVars:Configure() - lRepaint := .t. + if ! ::oWndVars:lVisible .OR. lRepaint + ::ResizeWindows( ::oWndVars ) endif - if ! ::oWndVars:lVisible - ::oWndCode:nTop := ::oWndVars:nBottom + 1 - ::oBrwText:Resize( ::oWndVars:nBottom + 2 ) - ::oWndCode:Refresh() - ::oWndVars:Show(lFocused) - else - if lRepaint - ::oWndCode:nTop := ::oWndVars:nBottom + 1 - ::oBrwText:Resize( ::oWndCode:nTop + 1 ) - ::oWndCode:Refresh() - ::oWndVars:Show(lFocused) - endif - endif - ::oBrwVars:RefreshAll() - ::oBrwVars:ForceStable() DispEnd() endif @@ -1718,6 +1702,7 @@ LOCAL nPos __DbgColors()[ 3 ] + "," + __DbgColors()[ 6 ] ) ::oWndCode:Browser := ::oBrwText + ::oWndCode:bPainted :={|| ::oBrwText:refreshAll():forceStable() } ::RedisplayBreakpoints() // check for breakpoints in this file and display them ::oWndCode:SetCaption( ::cPrgName ) ::oWndCode:Refresh() // to force the window caption to update @@ -1841,42 +1826,19 @@ METHOD HideCallStack() CLASS TDebugger if ::oWndStack != nil DispBegin() ::oWndStack:Hide() - ::RemoveWindow( ::oWndStack ) - ::oWndStack = nil - ::oWndCode:Hide() - ::oWndCode:nRight += 16 - ::oWndCode:Show( .t. ) - ::oBrwText:Resize( ,,, ::oBrwText:nRight + 16 ) - ::oBrwText:GotoLine( ::oBrwText:nActiveLine ) - if ::oWndVars != nil - IF( ::oWndVars:lVisible ) - ::oWndVars:Hide() - ::oWndVars:nRight += 16 - ::oBrwVars:nRight += 16 - ::oBrwVars:configure() - ::oWndVars:Show( .f. ) - ELSE - ::oWndVars:nRight += 16 - ::oBrwVars:nRight += 16 - ::oBrwVars:configure() - ENDIF - endif - if ::oWndPnt != nil - IF( ::oWndPnt:lVisible ) - ::oWndPnt:Hide() - ::oWndPnt:nRight += 16 - ::oBrwPnt:nRight += 16 - ::oBrwPnt:configure() - ::oWndPnt:Show( .f. ) - ELSE - ::oWndPnt:nRight += 16 - ::oBrwPnt:nRight += 16 - ::oBrwPnt:configure() - ENDIF - endif if ::aWindows[ ::nCurrentWindow ] == ::oWndStack ::NextWindow() ENDIF + ::RemoveWindow( ::oWndStack ) + ::oWndStack = nil + + ::oWndCode:Resize(,,, ::oWndCode:nRight + 16 ) + if ::oWndVars != nil + ::oWndVars:Resize(,,, ::oWndVars:nRight + 16 ) + endif + if ::oWndPnt != nil + ::oWndPnt:Resize(,,, ::oWndPnt:nRight + 16 ) + endif DispEnd() endif @@ -2130,6 +2092,10 @@ METHOD SaveSettings() CLASS TDebugger cInfo += "Options mono " + HB_OsNewLine() endif + if !::lRunAtStartup + cInfo += "Options NoRunAtStartup " + HB_OsNewLine() + endif + if ::nSpeed != 0 cInfo += "Run Speed " + AllTrim( Str( ::nSpeed ) ) + HB_OsNewLine() endif @@ -2592,6 +2558,7 @@ METHOD WatchPointsShow() CLASS TDebugger Local oCol local lRepaint := .f. local nTop + LOCAL lFocused if ::lGo return nil @@ -2609,17 +2576,16 @@ METHOD WatchPointsShow() CLASS TDebugger MaxCol() - iif( ::oWndStack != nil, ::oWndStack:nWidth(), 0 ),; "Watch" ) - ::oWndCode:nTop := ::oWndPnt:nBottom + 1 - ::oBrwText:Resize( ::oWndCode:nTop + 1 ) - ::oBrwText:RefreshAll() - ::oWndCode:SetFocus( .t. ) +// ::oBrwText:Resize( ::oWndPnt:nBottom + 1 ) +// ::oWndCode:nTop := ::oWndPnt:nBottom + 1 +// ::oBrwText:Resize( ::oWndCode:nTop + 1 ) +// ::oBrwText:RefreshAll() +// ::oWndCode:SetFocus( .t. ) - ::oWndPnt:Show( .f. ) - AAdd( ::aWindows, ::oWndPnt ) // ::oWndPnt:bLButtonDown := { | nMRow, nMCol | ::WndVarsLButtonDown( nMRow, nMCol ) } // ::oWndPnt:bLDblClick := { | nMRow, nMCol | ::EditVar( ::oBrwPnt:Cargo[ 1 ] ) } - ::oBrwPnt := TBrowseNew( nTop+1, 1, ::oWndPnt:nBottom - 1, MaxCol() - iif( ::oWndStack != nil,; + ::oBrwPnt := TDbgBrowser():New( nTop+1, 1, ::oWndPnt:nBottom - 1, MaxCol() - iif( ::oWndStack != nil,; ::oWndStack:nWidth(), 0 ) - 1 ) ::oWndPnt:Browser := ::oBrwPnt @@ -2644,11 +2610,8 @@ METHOD WatchPointsShow() CLASS TDebugger ::oBrwPnt:AddColumn( oCol ) AAdd(::oBrwPnt:Cargo[2], ::aWatch) oCol:DefColor:={1,2} - if Len( ::aWatch ) > 0 - ::oBrwPnt:ForceStable() - endif - ::oWndPnt:bPainted := { || if(Len(::aWatch) > 0, ( ::oBrwPnt:ForceStable(),RefreshVarsS(::oBrwPnt) ),) } + ::oWndPnt:bPainted := { || if(Len(::aWatch) > 0, ( ::oBrwPnt:refreshAll():ForceStable(),RefreshVarsS(::oBrwPnt) ),) } ::oWndPnt:bKeyPressed := { | nKey | ( iif( nKey == K_DOWN ; , ::oBrwPnt:Down(), nil ), iif( nKey == K_UP, ::oBrwPnt:Up(), nil ) ; @@ -2659,44 +2622,26 @@ METHOD WatchPointsShow() CLASS TDebugger , iif( nKey == K_DEL, ::WatchpointDel( ::oBrwPnt:Cargo[1] ), nil ) ; , iif( nKey == K_ENTER, ::WatchpointEdit( ::oBrwPnt:Cargo[1] ), nil ), ::oBrwPnt:ForceStable() ) } + AAdd( ::aWindows, ::oWndPnt ) + ::oWndPnt:Show() + ::ResizeWindows( ::oWndPnt ) else if( ::oBrwPnt:cargo[1] <= 0 ) ::oBrwPnt:cargo[1] := 1 endif - if Len( ::aWatch ) == 0 - if ::oWndPnt:nBottom - ::oWndPnt:nTop > 1 - ::oWndPnt:nBottom := ::oWndPnt:nTop + 1 - lRepaint := .t. - endif - endif + DispBegin() if Len( ::aWatch ) > ::oWndPnt:nBottom - ::oWndPnt:nTop - 1 - ::oWndPnt:nBottom := ::oWndPnt:nTop + Min( Len( ::aWatch ) + 1, 4 ) - ::oBrwPnt:nBottom := ::oWndPnt:nBottom - 1 - ::oBrwPnt:Configure() - lRepaint := .t. + //Resize( top, left, bottom, right) + ::oWndPnt:Resize( ,, ::oWndPnt:nTop + Min( Len( ::aWatch ) + 1, 4 ) ) + lRepaint :=.T. + elseif Len( ::aWatch ) < ::oWndPnt:nBottom - ::oWndPnt:nTop - 1 + ::oWndPnt:Resize( ,, ::oWndPnt:nTop + Len( ::aWatch ) + 1 ) + lRepaint :=.T. endif - if Len( ::aWatch ) < ::oWndPnt:nBottom - ::oWndPnt:nTop - 1 - ::oWndPnt:nBottom := ::oWndPnt:nTop + Len( ::aWatch ) + 1 - ::oBrwPnt:nBottom := ::oWndPnt:nBottom - 1 - ::oBrwPnt:Configure() - lRepaint := .t. - endif - if ! ::oWndPnt:lVisible - ::oWndCode:nTop := ::oWndPnt:nBottom + 1 - ::oBrwText:Resize( ::oWndPnt:nBottom + 2 ) - ::oWndPnt:Show() - else - if lRepaint - ::oWndCode:nTop := ::oWndPnt:nBottom + 1 - ::oBrwText:Resize( ::oWndCode:nTop + 1 ) - ::oWndCode:Refresh() - ::oWndPnt:Refresh() - endif - endif - if Len( ::aWatch ) > 0 - ::oBrwPnt:RefreshAll() - ::oBrwPnt:ForceStable() + if ! ::oWndPnt:lVisible .OR. lRepaint + ::ResizeWindows( ::oWndPnt ) endif + DispEnd() endif return nil @@ -2851,6 +2796,50 @@ LOCAL lValid RETURN aWatch[WP_EXPR]+" <"+aWatch[WP_TYPE]+", " +cType+">: " +xVal +METHOD ResizeWindows( oWindow ) CLASS TDebugger +LOCAL oWindow2, nTop, i + + IF( oWindow == ::oWndVars ) + oWindow2 := ::oWndPnt + ELSEIF( oWindow == ::oWndPnt ) + oWindow2 := ::oWndVars + ENDIF + + DispBegin() + IF( oWindow2 == NIL ) + nTop := oWindow:nBottom +1 + ELSE + IF( oWindow2:lVisible ) + IF( oWindow:nTop < oWindow2:nTop ) + nTop := oWindow2:nBottom - oWindow2:nTop + 1 + oWindow2:Resize( oWindow:nBottom+1,, oWindow:nBottom+nTop) + ELSE + nTop := oWindow:nBottom - oWindow:nTop + 1 + oWindow:Resize( oWindow2:nBottom+1,, oWindow2:nBottom+nTop) + ENDIF + nTop := MAX( oWindow:nBottom, oWindow2:nBottom ) + 1 + ELSE + IF( oWindow:nTop > 1 ) + nTop := oWindow:nBottom - oWindow:nTop + 1 + oWindow:Resize( 1, , nTop ) + ENDIF + nTop := oWindow:nBottom + 1 + ENDIF + ENDIF + + oWindow:hide() + IF( oWindow2 != NIL ) + oWindow2:hide() + ENDIF + ::oWndCode:Resize( nTop ) + IF( oWindow2 != NIL ) + oWindow2:show() + ENDIF + oWindow:show() + DispEnd() + +RETURN self + STATIC FUNCTION CreateExpression( cExpr, aWatch ) LOCAL nLen diff --git a/harbour/source/debug/tbrwtext.prg b/harbour/source/debug/tbrwtext.prg index 3771dfe27c..ef63c9ad2b 100644 --- a/harbour/source/debug/tbrwtext.prg +++ b/harbour/source/debug/tbrwtext.prg @@ -87,6 +87,7 @@ CLASS TBrwText FROM HBEditor METHOD PageDown() METHOD RefreshAll() METHOD RefreshCurrent() + METHOD ForceStable() INLINE NIL METHOD GotoLine(n) // Moves active line cursor, that is it hilights last executed line of code diff --git a/harbour/source/rtl/alert.prg b/harbour/source/rtl/alert.prg index fdfdfb4dc8..4a6bb1d46d 100644 --- a/harbour/source/rtl/alert.prg +++ b/harbour/source/rtl/alert.prg @@ -119,36 +119,22 @@ FUNCTION Alert( xMessage, aOptions, cColorNorm, nDelay ) CASE ValType( xMessage ) == "B" ; xMessage := "{||...}" OTHERWISE ; xMessage := "NIL" ENDCASE + cOld:= xMessage + if Len(cOld) > 60 .AND. AT(';',cOld) == 0 //Dont do this if ; exist + cNew := "" + WHILE LEN(cOld) > 60 + cTemp := SubStr( cOld, 1, 60 ) + nPos := Rat(' ',cTemp) - if Len(cOld) >60 - WHILE LEN(cOld) > 0 - - IF AT( ';' , cOld ) > 0 //Dont do this if ; exist - EXIT - ENDIF - - IF LEN( cOld ) < 60 - - xMessage += cOld - EXIT - - ENDIF - - cTemp := SubStr( cOld , 1 , 60 ) - nPos := Rat(' ',cTemp) - - IF nPos > 0 - cNew += SubStr( cTemp , 1 , nPos ) + ';' - - cOld := SubStr( cOld , nPos + 1 ) - ENDIF - - xMessage := cNew - - ENDDO - - endif + IF( nPos = 0 ) + nPos := 60 + ENDIF + cNew += SubStr( cTemp, 1, nPos ) + ';' + cOld := SubStr( cOld, nPos + 1 ) + ENDDO + xMessage := cNew + cOld + endif DO WHILE ( nPos := At( ';', xMessage ) ) != 0 diff --git a/harbour/source/vm/hvm.c b/harbour/source/vm/hvm.c index 6a744f2f3e..6cced4719d 100644 --- a/harbour/source/vm/hvm.c +++ b/harbour/source/vm/hvm.c @@ -3420,9 +3420,9 @@ void hb_vmDo( USHORT uiParams ) } } - hb_stackOldFrame( &sStackState ); if( s_bDebugging ) hb_vmDebuggerEndProc(); + hb_stackOldFrame( &sStackState ); s_bDebugging = bDebugPrevState; s_ulProcLevel--; @@ -3647,12 +3647,10 @@ void hb_vmSend( USHORT uiParams ) } } + if( s_bDebugging ) + hb_vmDebuggerEndProc(); hb_stackOldFrame( &sStackState ); - if( s_bDebugging ) - { - hb_vmDebuggerEndProc(); - } s_bDebugging = bDebugPrevState; s_ulProcLevel--;