mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-12-06 09:07:31 +01:00
improved debugger: saved log, error handling in initialization, better reinitialize
git-svn-id: trunk@5016 -
This commit is contained in:
parent
b6593d0a09
commit
7df6dc79ca
@ -6596,7 +6596,11 @@ end;
|
||||
{ Called by FMarkList if change }
|
||||
procedure TCustomSynEdit.MarkListChange(Sender: TObject);
|
||||
begin
|
||||
{$IFDEF SYN_LAZARUS}
|
||||
Invalidate; // marks can have special line colors
|
||||
{$ELSE}
|
||||
InvalidateGutter;
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
procedure TCustomSynEdit.SetSelWord;
|
||||
|
||||
@ -54,14 +54,10 @@
|
||||
</Item9>
|
||||
</Files>
|
||||
<Type Value="RunAndDesignTime"/>
|
||||
<RequiredPkgs Count="2">
|
||||
<RequiredPkgs Count="1">
|
||||
<Item1>
|
||||
<PackageName Value="LCL"/>
|
||||
</Item1>
|
||||
<Item2>
|
||||
<PackageName Value="FCL"/>
|
||||
<MinVersion Major="1" Valid="True"/>
|
||||
</Item2>
|
||||
</RequiredPkgs>
|
||||
<UsageOptions>
|
||||
<UnitPath Value="$(PkgOutDir)/"/>
|
||||
|
||||
@ -254,7 +254,7 @@ begin
|
||||
try
|
||||
FTargetProcess.Free;
|
||||
except
|
||||
on E: Exception do WriteLN('Exeption while freeing target: ', E.Message);
|
||||
on E: Exception do WriteLN('Exception while freeing target: ', E.Message);
|
||||
end;
|
||||
FTargetProcess:= nil;
|
||||
end;
|
||||
@ -389,6 +389,9 @@ initialization
|
||||
end.
|
||||
{ =============================================================================
|
||||
$Log$
|
||||
Revision 1.26 2004/01/05 15:22:42 mattias
|
||||
improved debugger: saved log, error handling in initialization, better reinitialize
|
||||
|
||||
Revision 1.25 2003/12/08 14:27:16 mattias
|
||||
fixed WaitForHandles
|
||||
|
||||
|
||||
@ -51,6 +51,8 @@ type
|
||||
public
|
||||
procedure AddText(const AText: String);
|
||||
procedure Clear;
|
||||
procedure SetLogText(Lines: TStrings);
|
||||
procedure GetLogText(Lines: TStrings);
|
||||
end;
|
||||
|
||||
implementation
|
||||
@ -65,6 +67,16 @@ begin
|
||||
txtOutput.Lines.Clear;
|
||||
end;
|
||||
|
||||
procedure TDbgOutputForm.SetLogText(Lines: TStrings);
|
||||
begin
|
||||
txtOutput.Lines.Assign(Lines);
|
||||
end;
|
||||
|
||||
procedure TDbgOutputForm.GetLogText(Lines: TStrings);
|
||||
begin
|
||||
Lines.Assign(txtOutput.Lines);
|
||||
end;
|
||||
|
||||
procedure TDbgOutputForm.FormClose(Sender: TObject; var Action: TCloseAction);
|
||||
begin
|
||||
Action := caFree;
|
||||
@ -94,6 +106,9 @@ initialization
|
||||
end.
|
||||
{ =============================================================================
|
||||
$Log$
|
||||
Revision 1.9 2004/01/05 15:22:42 mattias
|
||||
improved debugger: saved log, error handling in initialization, better reinitialize
|
||||
|
||||
Revision 1.8 2002/05/30 22:45:57 lazarus
|
||||
MWE:
|
||||
- Removed menucreation from loaded since streaming works
|
||||
|
||||
@ -1299,8 +1299,15 @@ begin
|
||||
if (not TargetIsStarted) and (ACommand in dcRunCommands) then
|
||||
InitTargetStart;
|
||||
Result := RequestCommand(ACommand, AParams);
|
||||
if not Result then begin
|
||||
writeln('TDebugger.ReqCmd failed: ',DBGCommandNames[ACommand]);
|
||||
end;
|
||||
end
|
||||
else Result := False;
|
||||
else begin
|
||||
writeln('TDebugger.ReqCmd Command not supported: ',
|
||||
DBGCommandNames[ACommand],' ClassName=',ClassName);
|
||||
Result := False;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TDebugger.Run;
|
||||
@ -1390,17 +1397,20 @@ end;
|
||||
|
||||
procedure TDebugger.StepInto;
|
||||
begin
|
||||
ReqCmd(dcStepInto, []);
|
||||
if ReqCmd(dcStepInto, []) then exit;
|
||||
writeln('TDebugger.StepInto Class=',ClassName,' failed.');
|
||||
end;
|
||||
|
||||
procedure TDebugger.StepOver;
|
||||
begin
|
||||
ReqCmd(dcStepOver, []);
|
||||
if ReqCmd(dcStepOver, []) then exit;
|
||||
writeln('TDebugger.StepOver Class=',ClassName,' failed.');
|
||||
end;
|
||||
|
||||
procedure TDebugger.Stop;
|
||||
begin
|
||||
ReqCmd(dcStop, []);
|
||||
if ReqCmd(dcStop,[]) then exit;
|
||||
writeln('TDebugger.Stop Class=',ClassName,' failed.');
|
||||
end;
|
||||
|
||||
(******************************************************************************)
|
||||
@ -3169,6 +3179,9 @@ finalization
|
||||
end.
|
||||
{ =============================================================================
|
||||
$Log$
|
||||
Revision 1.57 2004/01/05 15:22:42 mattias
|
||||
improved debugger: saved log, error handling in initialization, better reinitialize
|
||||
|
||||
Revision 1.56 2004/01/04 03:53:36 marc
|
||||
* Changed TComponentSelectionList to TPersistentSelectionList
|
||||
+ Added SSHdebugger property
|
||||
|
||||
@ -131,7 +131,7 @@ procedure TDebuggerDlg.DoClose(var Action: TCloseAction);
|
||||
begin
|
||||
Action := caFree; // we default to free
|
||||
inherited DoClose(Action);
|
||||
EnvironmentOptions.IDEWindowLayoutList.ItemByForm(Self).GetCurrentPosition;
|
||||
EnvironmentOptions.IDEWindowLayoutList.ItemByFormID(Name).GetCurrentPosition;
|
||||
end;
|
||||
|
||||
procedure TDebuggerDlg.DoBeginUpdate;
|
||||
@ -146,6 +146,9 @@ end;
|
||||
|
||||
{ =============================================================================
|
||||
$Log$
|
||||
Revision 1.8 2004/01/05 15:22:42 mattias
|
||||
improved debugger: saved log, error handling in initialization, better reinitialize
|
||||
|
||||
Revision 1.7 2003/06/16 00:07:28 marc
|
||||
MWE:
|
||||
+ Implemented DebuggerOptions-ExceptonAdd
|
||||
|
||||
@ -332,14 +332,17 @@ end;
|
||||
function TGDBMIDebugger.ChangeFileName: Boolean;
|
||||
begin
|
||||
FHasSymbols := True; // True until proven otherwise
|
||||
Result := ExecuteCommand('-file-exec-and-symbols %s', [FileName], [])
|
||||
and inherited ChangeFileName;
|
||||
Result:=false;
|
||||
if not ExecuteCommand('-file-exec-and-symbols %s', [FileName], []) then exit;
|
||||
if State=dsError then exit;
|
||||
if not (inherited ChangeFileName) then exit;
|
||||
if State=dsError then exit;
|
||||
|
||||
if Result and FHasSymbols
|
||||
then begin
|
||||
if FHasSymbols then begin
|
||||
// Force setting language
|
||||
// Setting extensions dumps GDB (bug #508)
|
||||
ExecuteCommand('-gdb-set language pascal', []);
|
||||
if not ExecuteCommand('-gdb-set language pascal', []) then exit;
|
||||
if State=dsError then exit;
|
||||
(*
|
||||
ExecuteCommand('-gdb-set extension-language .lpr pascal', False);
|
||||
if not FHasSymbols then Exit; // file-exec-and-symbols not allways result in no symbols
|
||||
@ -350,6 +353,7 @@ begin
|
||||
ExecuteCommand('-gdb-set extension-language .inc pascal', False);
|
||||
*)
|
||||
end;
|
||||
Result:=true;
|
||||
end;
|
||||
|
||||
constructor TGDBMIDebugger.Create(const AExternalDebugger: String);
|
||||
@ -925,6 +929,7 @@ begin
|
||||
else if S = 'error'
|
||||
then begin
|
||||
Result := True;
|
||||
writeln('TGDBMIDebugger.ProcessResult Error: ',S);
|
||||
// todo implement with values
|
||||
if (pos('msg=', AResultValues) > 0)
|
||||
and (pos('not being run', AResultValues) > 0)
|
||||
@ -964,9 +969,11 @@ begin
|
||||
WriteLN('[Debugger] Target output: ', S);
|
||||
end;
|
||||
'&': begin // log-stream-output
|
||||
if S='&"kill\n"' then
|
||||
ANewState:=dsStop;
|
||||
WriteLN('[Debugger] Log output: ', S);
|
||||
if S='&"kill\n"' then
|
||||
ANewState:=dsStop
|
||||
else if LeftStr(S,8)='&"Error ' then
|
||||
ANewState:=dsError;
|
||||
end;
|
||||
'*', '+', '=': begin
|
||||
WriteLN('[WARNING] Debugger: Unexpected async-record: ', S);
|
||||
@ -1316,7 +1323,7 @@ begin
|
||||
|
||||
if FHasSymbols
|
||||
then begin
|
||||
// Maske sure we are talking pascal
|
||||
// Make sure we are talking pascal
|
||||
ExecuteCommand('-gdb-set language pascal', []);
|
||||
if Arguments <>''
|
||||
then ExecuteCommand('-exec-arguments %s', [Arguments], []);
|
||||
@ -1345,35 +1352,38 @@ begin
|
||||
BkptList.Free;
|
||||
end;
|
||||
|
||||
// try to find PID
|
||||
if ExecuteCommand('info program', [], ResultState, S, [cfIgnoreError, cfNoMICommand])
|
||||
then begin
|
||||
TargetPIDPart:=GetPart('child process ', '.', S);
|
||||
if TargetPIDPart='' then
|
||||
TargetPIDPart:=GetPart('child Thread ', ' ', S);
|
||||
FTargetPID := StrToIntDef(TargetPIDPart, 0);
|
||||
|
||||
WriteLN('[Debugger] Target PID: ', FTargetPID);
|
||||
end
|
||||
else begin
|
||||
FTargetPID := 0;
|
||||
end;
|
||||
|
||||
if FTargetPID = 0
|
||||
then begin
|
||||
Result := False;
|
||||
SetState(dsError);
|
||||
Exit;
|
||||
end;
|
||||
|
||||
if ResultState = dsNone
|
||||
then begin
|
||||
if AContinueCommand <> ''
|
||||
then Result := ExecuteCommand(AContinueCommand, [])
|
||||
else SetState(dsPause);
|
||||
end
|
||||
else SetState(ResultState);
|
||||
end else begin
|
||||
writeln('TGDBMIDebugger.StartDebugging Note: Target has no symbols');
|
||||
end;
|
||||
|
||||
// try to find PID
|
||||
if ExecuteCommand('info program', [], ResultState, S, [cfIgnoreError, cfNoMICommand])
|
||||
then begin
|
||||
TargetPIDPart:=GetPart('child process ', '.', S);
|
||||
if TargetPIDPart='' then
|
||||
TargetPIDPart:=GetPart('child Thread ', ' ', S);
|
||||
FTargetPID := StrToIntDef(TargetPIDPart, 0);
|
||||
|
||||
WriteLN('[Debugger] Target PID: ', FTargetPID);
|
||||
end
|
||||
else begin
|
||||
FTargetPID := 0;
|
||||
end;
|
||||
|
||||
if FTargetPID = 0
|
||||
then begin
|
||||
Result := False;
|
||||
SetState(dsError);
|
||||
Exit;
|
||||
end;
|
||||
|
||||
if ResultState = dsNone
|
||||
then begin
|
||||
if AContinueCommand <> ''
|
||||
then Result := ExecuteCommand(AContinueCommand, [])
|
||||
else SetState(dsPause);
|
||||
end
|
||||
else SetState(ResultState);
|
||||
end;
|
||||
Result := True;
|
||||
end;
|
||||
@ -2069,6 +2079,9 @@ initialization
|
||||
end.
|
||||
{ =============================================================================
|
||||
$Log$
|
||||
Revision 1.40 2004/01/05 15:22:42 mattias
|
||||
improved debugger: saved log, error handling in initialization, better reinitialize
|
||||
|
||||
Revision 1.39 2003/12/05 08:39:53 mattias
|
||||
fixed memleak in debugger from Vincent
|
||||
|
||||
|
||||
@ -43,6 +43,15 @@ uses
|
||||
Classes, SysUtils, Forms, Laz_XMLCfg, Project, SourceMarks, Debugger;
|
||||
|
||||
type
|
||||
{ TBaseDebugManager }
|
||||
|
||||
TDebugManagerState = (
|
||||
dmsInitializingDebuggerObject,
|
||||
dmsInitializingDebuggerObjectFailed,
|
||||
dmsDebuggerObjectBroken // the debugger entered the error state
|
||||
);
|
||||
TDebugManagerStates = set of TDebugManagerState;
|
||||
|
||||
TBaseDebugManager = class(TComponent)
|
||||
private
|
||||
function GetDebuggerClass(const AIndex: Integer): TDebuggerClass;
|
||||
@ -52,6 +61,7 @@ type
|
||||
FExceptions: TIDEExceptions;
|
||||
FSignals: TIDESignals;
|
||||
FBreakPoints: TIDEBreakPoints;
|
||||
FManagerStates: TDebugManagerStates;
|
||||
function FindDebuggerClass(const Astring: String): TDebuggerClass;
|
||||
function GetState: TDBGState; virtual; abstract;
|
||||
function GetCommands: TDBGCommands; virtual; abstract;
|
||||
@ -59,7 +69,8 @@ type
|
||||
procedure ConnectMainBarEvents; virtual; abstract;
|
||||
procedure ConnectSourceNotebookEvents; virtual; abstract;
|
||||
procedure SetupMainBarShortCuts; virtual; abstract;
|
||||
|
||||
procedure UpdateButtonsAndMenuItems; virtual; abstract;
|
||||
|
||||
procedure LoadProjectSpecificInfo(XMLConfig: TXMLConfig); virtual; abstract;
|
||||
procedure SaveProjectSpecificInfo(XMLConfig: TXMLConfig); virtual; abstract;
|
||||
procedure DoRestoreDebuggerMarks(AnUnitInfo: TUnitInfo); virtual; abstract;
|
||||
@ -148,6 +159,9 @@ end.
|
||||
|
||||
{ =============================================================================
|
||||
$Log$
|
||||
Revision 1.19 2004/01/05 15:22:41 mattias
|
||||
improved debugger: saved log, error handling in initialization, better reinitialize
|
||||
|
||||
Revision 1.18 2003/08/08 10:24:47 mattias
|
||||
fixed initialenabled, debuggertype, linkscaner open string constant
|
||||
|
||||
|
||||
@ -95,6 +95,9 @@ type
|
||||
// When a source file is not found, the user can choose one
|
||||
// here are all choices stored
|
||||
FUserSourceFiles: TStringList;
|
||||
|
||||
// when the debug output log is not open, store the debug log internally
|
||||
fHiddenDebugOutputLog: TStringList;
|
||||
|
||||
// Breakpoint routines
|
||||
procedure BreakpointAdded(const ASender: TIDEBreakPoints;
|
||||
@ -114,6 +117,7 @@ type
|
||||
procedure InitWatchesDlg;
|
||||
procedure InitLocalsDlg;
|
||||
procedure InitCallStackDlg;
|
||||
|
||||
protected
|
||||
function GetState: TDBGState; override;
|
||||
function GetCommands: TDBGCommands; override;
|
||||
@ -123,12 +127,14 @@ type
|
||||
procedure ConnectMainBarEvents; override;
|
||||
procedure ConnectSourceNotebookEvents; override;
|
||||
procedure SetupMainBarShortCuts; override;
|
||||
|
||||
procedure UpdateButtonsAndMenuItems; override;
|
||||
|
||||
procedure LoadProjectSpecificInfo(XMLConfig: TXMLConfig); override;
|
||||
procedure SaveProjectSpecificInfo(XMLConfig: TXMLConfig); override;
|
||||
procedure DoRestoreDebuggerMarks(AnUnitInfo: TUnitInfo); override;
|
||||
procedure BeginUpdateDialogs;
|
||||
procedure EndUpdateDialogs;
|
||||
procedure ClearDebugOutputLog;
|
||||
|
||||
function DoInitDebugger: TModalResult; override;
|
||||
function DoPauseProject: TModalResult; override;
|
||||
@ -760,8 +766,16 @@ end;
|
||||
procedure TDebugManager.OnDebuggerOutput(Sender: TObject; const AText: String);
|
||||
begin
|
||||
if Destroying then exit;
|
||||
if FDialogs[ddtOutput] <> nil
|
||||
then TDbgOutputForm(FDialogs[ddtOutput]).AddText(AText);
|
||||
if FDialogs[ddtOutput] <> nil then
|
||||
TDbgOutputForm(FDialogs[ddtOutput]).AddText(AText)
|
||||
else begin
|
||||
// store it internally, and copy it to the dialog, when the user opens it
|
||||
if fHiddenDebugOutputLog=nil then
|
||||
fHiddenDebugOutputLog:=TStringList.Create;
|
||||
fHiddenDebugOutputLog.Add(AText);
|
||||
while fHiddenDebugOutputLog.Count>100 do
|
||||
fHiddenDebugOutputLog.Delete(0);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TDebugManager.OnDebuggerChangeState(ADebugger: TDebugger;
|
||||
@ -782,6 +796,12 @@ begin
|
||||
RaiseException('TDebugManager.OnDebuggerChangeState');
|
||||
|
||||
if Destroying or (MainIDE=nil) or (MainIDE.ToolStatus=itExiting) then exit;
|
||||
|
||||
if FDebugger.State=dsError then begin
|
||||
Include(FManagerStates,dmsDebuggerObjectBroken);
|
||||
if dmsInitializingDebuggerObject in FManagerStates then
|
||||
Include(FManagerStates,dmsInitializingDebuggerObjectFailed);
|
||||
end;
|
||||
|
||||
WriteLN('[TDebugManager.OnDebuggerChangeState] state: ', STATENAME[FDebugger.State]);
|
||||
|
||||
@ -790,26 +810,9 @@ begin
|
||||
// dcRun, dcPause, dcStop, dcStepOver, dcStepInto, dcRunTo, dcJumpto, dcBreak, dcWatch
|
||||
// -------------------
|
||||
|
||||
with MainIDE do begin
|
||||
// For 'run' and 'step' bypass 'idle', so we can set the filename later
|
||||
RunSpeedButton.Enabled := (dcRun in FDebugger.Commands) or (FDebugger.State = dsIdle);
|
||||
itmRunMenuRun.Enabled := RunSpeedButton.Enabled;
|
||||
PauseSpeedButton.Enabled := dcPause in FDebugger.Commands;
|
||||
itmRunMenuPause.Enabled := PauseSpeedButton.Enabled;
|
||||
StepIntoSpeedButton.Enabled := (dcStepInto in FDebugger.Commands) or (FDebugger.State = dsIdle);
|
||||
itmRunMenuStepInto.Enabled := StepIntoSpeedButton.Enabled;
|
||||
StepOverSpeedButton.Enabled := (dcStepOver in FDebugger.Commands) or (FDebugger.State = dsIdle);
|
||||
itmRunMenuStepOver.Enabled := StepOverSpeedButton.Enabled;
|
||||
|
||||
itmRunMenuRunToCursor.Enabled := dcRunTo in FDebugger.Commands;
|
||||
itmRunMenuStop.Enabled := dcStop in FDebugger.Commands;;
|
||||
|
||||
// TODO: add other debugger menuitems
|
||||
// TODO: implement by actions
|
||||
|
||||
if ToolStatus in [itNone,itDebugger] then
|
||||
ToolStatus := TOOLSTATEMAP[FDebugger.State];
|
||||
end;
|
||||
UpdateButtonsAndMenuItems;
|
||||
if MainIDE.ToolStatus in [itNone,itDebugger] then
|
||||
MainIDE.ToolStatus := TOOLSTATEMAP[FDebugger.State];
|
||||
|
||||
if (FDebugger.State in [dsRun]) then begin
|
||||
// hide IDE during run
|
||||
@ -927,10 +930,23 @@ end;
|
||||
// Common handler
|
||||
// The tag of the destroyed form contains the form variable pointing to it
|
||||
procedure TDebugManager.DebugDialogDestroy(Sender: TObject);
|
||||
var
|
||||
DlgType: TDebugDialogType;
|
||||
begin
|
||||
if (TForm(Sender).Tag >= Ord(Low(TDebugDialogType)))
|
||||
and (TForm(Sender).Tag <= Ord(High(TDebugDialogType)))
|
||||
then FDialogs[TDebugDialogType(TForm(Sender).Tag)] := nil;
|
||||
for DlgType:=Low(TDebugDialogType) to High(TDebugDialogType) do begin
|
||||
if FDialogs[DlgType]<>Sender then continue;
|
||||
case DlgType of
|
||||
ddtOutput:
|
||||
begin
|
||||
if fHiddenDebugOutputLog=nil then
|
||||
fHiddenDebugOutputLog:=TStringList.Create;
|
||||
TDbgOutputForm(FDialogs[ddtOutput]).GetLogText(fHiddenDebugOutputLog);
|
||||
end;
|
||||
end;
|
||||
FDialogs[DlgType]:=nil;
|
||||
exit;
|
||||
end;
|
||||
RaiseException('Invalid debug window '+Sender.ClassName);
|
||||
end;
|
||||
|
||||
procedure TDebugManager.ViewDebugDialog(const ADialogType: TDebugDialogType);
|
||||
@ -981,7 +997,14 @@ begin
|
||||
end;
|
||||
|
||||
procedure TDebugManager.InitDebugOutputDlg;
|
||||
var
|
||||
TheDialog: TDbgOutputForm;
|
||||
begin
|
||||
TheDialog:=TDbgOutputForm(FDialogs[ddtOutput]);
|
||||
if fHiddenDebugOutputLog<>nil then begin
|
||||
TheDialog.SetLogText(fHiddenDebugOutputLog);
|
||||
FreeThenNil(fHiddenDebugOutputLog);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TDebugManager.InitBreakPointDlg;
|
||||
@ -1066,6 +1089,7 @@ begin
|
||||
FreeAndNil(FSignals);
|
||||
|
||||
FreeAndNil(FUserSourceFiles);
|
||||
FreeAndNil(fHiddenDebugOutputLog);
|
||||
|
||||
inherited Destroy;
|
||||
end;
|
||||
@ -1107,6 +1131,35 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TDebugManager.UpdateButtonsAndMenuItems;
|
||||
var
|
||||
DebuggerInvalid: boolean;
|
||||
begin
|
||||
DebuggerInvalid:=(FDebugger=nil) or (MainIDE.ToolStatus<>itDebugger);
|
||||
with MainIDE do begin
|
||||
// For 'run' and 'step' bypass 'idle', so we can set the filename later
|
||||
RunSpeedButton.Enabled := DebuggerInvalid
|
||||
or (dcRun in FDebugger.Commands) or (FDebugger.State = dsIdle);
|
||||
itmRunMenuRun.Enabled := RunSpeedButton.Enabled;
|
||||
PauseSpeedButton.Enabled := (not DebuggerInvalid)
|
||||
and (dcPause in FDebugger.Commands);
|
||||
itmRunMenuPause.Enabled := PauseSpeedButton.Enabled;
|
||||
StepIntoSpeedButton.Enabled := DebuggerInvalid
|
||||
or (dcStepInto in FDebugger.Commands) or (FDebugger.State = dsIdle);
|
||||
itmRunMenuStepInto.Enabled := StepIntoSpeedButton.Enabled;
|
||||
StepOverSpeedButton.Enabled := DebuggerInvalid or
|
||||
(dcStepOver in FDebugger.Commands) or (FDebugger.State = dsIdle);
|
||||
itmRunMenuStepOver.Enabled := StepOverSpeedButton.Enabled;
|
||||
|
||||
itmRunMenuRunToCursor.Enabled := DebuggerInvalid
|
||||
or (dcRunTo in FDebugger.Commands);
|
||||
itmRunMenuStop.Enabled := (FDebugger<>nil); // always allow to stop
|
||||
|
||||
// TODO: add other debugger menuitems
|
||||
// TODO: implement by actions
|
||||
end;
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
procedure TDebugManager.LoadProjectSpecificInfo(XMLConfig: TXMLConfig);
|
||||
|
||||
@ -1235,6 +1288,14 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TDebugManager.ClearDebugOutputLog;
|
||||
begin
|
||||
if FDialogs[ddtOutput] <> nil then
|
||||
TDbgOutputForm(FDialogs[ddtOutput]).Clear
|
||||
else if fHiddenDebugOutputLog<>nil then
|
||||
fHiddenDebugOutputLog.Clear;
|
||||
end;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Debugger routines
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -1243,17 +1304,6 @@ function TDebugManager.DoInitDebugger: TModalResult;
|
||||
var
|
||||
OldWatches: TDBGWatches;
|
||||
|
||||
procedure ResetDialogs;
|
||||
var
|
||||
DialogType: TDebugDialogType;
|
||||
begin
|
||||
for DialogType := Low(TDebugDialogType) to High(TDebugDialogType) do
|
||||
begin
|
||||
if FDialogs[DialogType] <> nil
|
||||
then FDialogs[DialogType].Debugger := FDebugger;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure SaveDebuggerItems;
|
||||
begin
|
||||
// copy the watches
|
||||
@ -1282,15 +1332,32 @@ var
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure ResetDialogs;
|
||||
var
|
||||
DialogType: TDebugDialogType;
|
||||
begin
|
||||
for DialogType := Low(TDebugDialogType) to High(TDebugDialogType) do
|
||||
begin
|
||||
if FDialogs[DialogType] <> nil
|
||||
then FDialogs[DialogType].Debugger := FDebugger;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure FreeDebugger;
|
||||
begin
|
||||
SaveDebuggerItems;
|
||||
TManagedBreakPoints(FBreakPoints).Master := nil;
|
||||
TManagedSignals(FSignals).Master := nil;
|
||||
TManagedExceptions(FExceptions).Master := nil;;
|
||||
FreeAndNil(FDebugger);
|
||||
Exclude(FManagerStates,dmsDebuggerObjectBroken);
|
||||
ResetDialogs;
|
||||
end;
|
||||
|
||||
procedure SaveAndFreeDebugger;
|
||||
begin
|
||||
SaveDebuggerItems;
|
||||
FreeDebugger;
|
||||
end;
|
||||
|
||||
var
|
||||
LaunchingCmdLine, LaunchingApplication, LaunchingParams: String;
|
||||
@ -1315,18 +1382,21 @@ begin
|
||||
if DebuggerClass = nil
|
||||
then begin
|
||||
if FDebugger <> nil
|
||||
then FreeDebugger;
|
||||
then SaveAndFreeDebugger;
|
||||
Exit;
|
||||
end;
|
||||
|
||||
if (dmsDebuggerObjectBroken in FManagerStates) then
|
||||
SaveAndFreeDebugger;
|
||||
|
||||
// check if debugger is already created with the right type
|
||||
if (FDebugger <> nil)
|
||||
if (FDebugger <> nil)
|
||||
and (not (FDebugger is DebuggerClass)
|
||||
or (FDebugger.ExternalDebugger <> EnvironmentOptions.DebuggerFilename)
|
||||
)
|
||||
then begin
|
||||
// the current debugger is the wrong type -> free it
|
||||
FreeDebugger;
|
||||
SaveAndFreeDebugger;
|
||||
end;
|
||||
|
||||
// create debugger object
|
||||
@ -1349,13 +1419,23 @@ begin
|
||||
if FWatches<>OldWatches then
|
||||
OldWatches.Free;
|
||||
end;
|
||||
|
||||
|
||||
ClearDebugOutputLog;
|
||||
|
||||
FDebugger.OnState := @OnDebuggerChangeState;
|
||||
FDebugger.OnCurrent := @OnDebuggerCurrentLine;
|
||||
FDebugger.OnDbgOutput := @OnDebuggerOutput;
|
||||
FDebugger.OnException := @OnDebuggerException;
|
||||
if FDebugger.State = dsNone
|
||||
then FDebugger.Init;
|
||||
if FDebugger.State = dsNone then begin
|
||||
Include(FManagerStates,dmsInitializingDebuggerObject);
|
||||
Exclude(FManagerStates,dmsInitializingDebuggerObjectFailed);
|
||||
FDebugger.Init;
|
||||
Exclude(FManagerStates,dmsInitializingDebuggerObject);
|
||||
if dmsInitializingDebuggerObjectFailed in FManagerStates then begin
|
||||
Result:=mrCancel;
|
||||
exit;
|
||||
end;
|
||||
end;
|
||||
|
||||
FDebugger.FileName := LaunchingApplication;
|
||||
FDebugger.Arguments := LaunchingParams;
|
||||
@ -1364,15 +1444,18 @@ begin
|
||||
if NewWorkingDir='' then
|
||||
NewWorkingDir:=Project1.ProjectDirectory;
|
||||
FDebugger.WorkingDir:=NewWorkingDir;
|
||||
|
||||
if FDialogs[ddtOutput] <> nil
|
||||
then TDbgOutputForm(FDialogs[ddtOutput]).Clear;
|
||||
|
||||
//TODO: Show/hide debug menuitems based on FDebugger.SupportedCommands
|
||||
finally
|
||||
EndUpdateDialogs;
|
||||
end;
|
||||
|
||||
// check if debugging needs restart
|
||||
if ((FDebugger=nil) or (dmsDebuggerObjectBroken in FManagerStates))
|
||||
and (MainIDE.ToolStatus=itDebugger) then begin
|
||||
MainIDE.ToolStatus:=itNone;
|
||||
Result:=mrCancel;
|
||||
exit;
|
||||
end;
|
||||
|
||||
Result := mrOk;
|
||||
WriteLN('[TDebugManager.DoInitDebugger] END');
|
||||
end;
|
||||
@ -1423,11 +1506,14 @@ function TDebugManager.DoStopProject: TModalResult;
|
||||
begin
|
||||
Result := mrCancel;
|
||||
SourceNotebook.ClearExecutionLines;
|
||||
if (MainIDE.ToolStatus <> itDebugger)
|
||||
or (FDebugger=nil) or Destroying
|
||||
then Exit;
|
||||
|
||||
FDebugger.Stop;
|
||||
if (MainIDE.ToolStatus=itDebugger) and (FDebugger<>nil) and (not Destroying)
|
||||
then begin
|
||||
FDebugger.Stop;
|
||||
end;
|
||||
if (dmsDebuggerObjectBroken in FManagerStates) then begin
|
||||
if (MainIDE.ToolStatus=itDebugger) then
|
||||
MainIDE.ToolStatus:=itNone;
|
||||
end;
|
||||
Result := mrOk;
|
||||
end;
|
||||
|
||||
@ -1443,6 +1529,13 @@ begin
|
||||
if Destroying then exit;
|
||||
if (FDebugger <> nil) then begin
|
||||
writeln('TDebugManager.RunDebugger B ',FDebugger.ClassName);
|
||||
// check if debugging needs restart
|
||||
if (dmsDebuggerObjectBroken in FManagerStates)
|
||||
and (MainIDE.ToolStatus=itDebugger) then begin
|
||||
MainIDE.ToolStatus:=itNone;
|
||||
Result:=mrCancel;
|
||||
exit;
|
||||
end;
|
||||
FDebugger.Run;
|
||||
Result:=mrOk;
|
||||
end;
|
||||
@ -1575,6 +1668,9 @@ end.
|
||||
|
||||
{ =============================================================================
|
||||
$Log$
|
||||
Revision 1.65 2004/01/05 15:22:41 mattias
|
||||
improved debugger: saved log, error handling in initialization, better reinitialize
|
||||
|
||||
Revision 1.64 2003/11/10 22:29:23 mattias
|
||||
fixed searching for default debugger line
|
||||
|
||||
|
||||
@ -167,6 +167,7 @@ type
|
||||
procedure LoadFromXMLConfig(XMLConfig: TXMLConfig; const Path: string);
|
||||
procedure SaveToXMLConfig(XMLConfig: TXMLConfig; const Path: string);
|
||||
function CustomCoordinatesAreValid: boolean;
|
||||
procedure CloseForm;
|
||||
public
|
||||
property FormID: string read GetFormID write SetFormID;
|
||||
property WindowPlacement: TIDEWindowPlacement
|
||||
@ -211,10 +212,12 @@ type
|
||||
function ItemByForm(AForm: TForm): TIDEWindowLayout;
|
||||
function ItemByFormID(const FormID: string): TIDEWindowLayout;
|
||||
function ItemByEnum(ID: TNonModalIDEWindow): TIDEWindowLayout;
|
||||
property Items[Index: Integer]: TIDEWindowLayout
|
||||
read GetItems write SetItems; default;
|
||||
procedure CloseForm(AForm: TForm);
|
||||
procedure LoadFromXMLConfig(XMLConfig: TXMLConfig; const Path: string);
|
||||
procedure SaveToXMLConfig(XMLConfig: TXMLConfig; const Path: string);
|
||||
public
|
||||
property Items[Index: Integer]: TIDEWindowLayout
|
||||
read GetItems write SetItems; default;
|
||||
end;
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
@ -534,10 +537,16 @@ begin
|
||||
Result:=(Width>0) and (Height>0) and (Left>10-Width) and (Top>10-Height);
|
||||
end;
|
||||
|
||||
procedure TIDEWindowLayout.CloseForm;
|
||||
begin
|
||||
Form:=nil;
|
||||
end;
|
||||
|
||||
procedure TIDEWindowLayout.SetForm(const AValue: TForm);
|
||||
begin
|
||||
if fForm=AValue then exit;
|
||||
fForm:=AValue;
|
||||
if (Form<>nil) then fFormID:=FForm.Name;
|
||||
end;
|
||||
|
||||
function TIDEWindowLayout.GetFormID: string;
|
||||
@ -757,6 +766,15 @@ begin
|
||||
Result:=ItemByFormID(NonModalIDEWindowNames[ID]);
|
||||
end;
|
||||
|
||||
procedure TIDEWindowLayoutList.CloseForm(AForm: TForm);
|
||||
var
|
||||
ALayout: TIDEWindowLayout;
|
||||
begin
|
||||
ALayout:=ItemByForm(AForm);
|
||||
if ALayout<>nil then
|
||||
ALayout.CloseForm;
|
||||
end;
|
||||
|
||||
procedure TIDEWindowLayoutList.ApplyAll;
|
||||
var i: integer;
|
||||
begin
|
||||
|
||||
@ -443,6 +443,8 @@ resourcestring
|
||||
+'method. Plz fix the error shown in the message window.';
|
||||
lisUnableToRenameMethodPlzFixTheErrorShownInTheMessag = 'Unable to rename '
|
||||
+'method. Plz fix the error shown in the message window.';
|
||||
lisStopDebugging = 'Stop Debugging?';
|
||||
lisStopTheDebugging = 'Stop the debugging?';
|
||||
|
||||
// resource files
|
||||
lisResourceFileComment =
|
||||
|
||||
11
ide/main.pp
11
ide/main.pp
@ -2240,6 +2240,8 @@ end;
|
||||
procedure TMainIDE.SetToolStatus(const AValue: TIDEToolStatus);
|
||||
begin
|
||||
inherited SetToolStatus(AValue);
|
||||
if DebugBoss<>nil then
|
||||
DebugBoss.UpdateButtonsAndMenuItems;
|
||||
end;
|
||||
|
||||
function TMainIDE.DoResetToolStatus(Interactive: boolean): boolean;
|
||||
@ -2250,8 +2252,8 @@ begin
|
||||
itDebugger:
|
||||
begin
|
||||
if Interactive
|
||||
and (MessageDlg('Stop Debugging?',
|
||||
'Stop the debugging?',mtConfirmation,[mbYes,mbCancel],0)<>mrYes)
|
||||
and (MessageDlg(lisStopDebugging,
|
||||
lisStopTheDebugging, mtConfirmation, [mbYes, mbCancel], 0)<>mrYes)
|
||||
then exit;
|
||||
DebugBoss.DoStopProject;
|
||||
end;
|
||||
@ -5888,7 +5890,6 @@ begin
|
||||
if not (Project1.ProjectType in [ptProgram, ptApplication, ptCustomProgram,
|
||||
ptCGIApplication])
|
||||
or (Project1.MainUnitID < 0)
|
||||
or (ToolStatus <> itNone)
|
||||
then Exit;
|
||||
|
||||
// Build project first
|
||||
@ -9619,6 +9620,7 @@ end;
|
||||
procedure TMainIDE.OnScreenRemoveForm(Sender: TObject; AForm: TCustomForm);
|
||||
begin
|
||||
HiddenWindowsOnRun.Remove(AForm);
|
||||
EnvironmentOptions.IDEWindowLayoutList.CloseForm(AForm);
|
||||
end;
|
||||
|
||||
function TMainIDE.ProjInspectorAddUnitToProject(Sender: TObject;
|
||||
@ -10265,6 +10267,9 @@ end.
|
||||
|
||||
{ =============================================================================
|
||||
$Log$
|
||||
Revision 1.695 2004/01/05 15:22:41 mattias
|
||||
improved debugger: saved log, error handling in initialization, better reinitialize
|
||||
|
||||
Revision 1.694 2004/01/04 11:32:17 mattias
|
||||
OI support for TPersistent, PropMeasuerHeight
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user