small fixes for debugger without file

git-svn-id: trunk@4200 -
This commit is contained in:
mattias 2003-05-27 15:04:00 +00:00
parent 0ee08ef013
commit 1cfa75bdb8
5 changed files with 102 additions and 44 deletions

View File

@ -39,7 +39,7 @@ interface
uses
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, LResources, StdCtrls,
Buttons, Extctrls, Menus, ComCtrls, Debugger, DebuggerDlg;
Buttons, Extctrls, Menus, ComCtrls, IDEProcs, Debugger, DebuggerDlg;
type
TBreakPointsDlg = class(TDebuggerDlg)
@ -65,7 +65,8 @@ type
procedure popDisableAllClick(Sender: TObject);
procedure popEnableAllClick(Sender: TObject);
procedure popDeleteAllClick(Sender: TObject);
private
private
FBaseDirectory: string;
FBreakpointsNotification: TDBGBreakPointsNotification;
procedure BreakPointAdd(const ASender: TDBGBreakPoints;
const ABreakpoint: TDBGBreakPoint);
@ -73,14 +74,17 @@ type
const ABreakpoint: TDBGBreakPoint);
procedure BreakPointRemove(const ASender: TDBGBreakPoints;
const ABreakpoint: TDBGBreakPoint);
procedure SetBaseDirectory(const AValue: string);
procedure UpdateItem(const AItem: TListItem;
const ABreakpoint: TDBGBreakPoint);
procedure UpdateAll;
protected
procedure SetDebugger(const ADebugger: TDebugger); override;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
property BaseDirectory: string read FBaseDirectory write SetBaseDirectory;
end;
@ -123,6 +127,13 @@ begin
lvBreakPoints.Items.FindData(ABreakpoint).Free;
end;
procedure TBreakPointsDlg.SetBaseDirectory(const AValue: string);
begin
if FBaseDirectory=AValue then exit;
FBaseDirectory:=AValue;
UpdateAll;
end;
constructor TBreakPointsDlg.Create(AOwner: TComponent);
begin
inherited;
@ -240,20 +251,33 @@ const
var
Action: TDBGBreakPointAction;
S: String;
Filename: String;
begin
// Filename/Address
// Line/Length
// Condition
// Action
// Pass Count
// Group
// Filename/Address
// Line/Length
// Condition
// Action
// Pass Count
// Group
// state
AItem.Caption := DEBUG_STATE[ABreakpoint.Enabled, ABreakpoint.Valid];
AItem.SubItems[0] := ABreakpoint.Source;
// filename
Filename:=ABreakpoint.Source;
if BaseDirectory<>'' then
Filename:=CreateRelativePath(Filename,BaseDirectory);
AItem.SubItems[0] := Filename;
// line
if ABreakpoint.Line > 0
then AItem.SubItems[1] := IntToStr(ABreakpoint.Line)
else AItem.SubItems[1] := '';
// expression
AItem.SubItems[2] := ABreakpoint.Expression;
// actions
S := '';
for Action := Low(Action) to High(Action) do
if Action in ABreakpoint.Actions
@ -262,12 +286,21 @@ begin
S := S + DEBUG_ACTION[Action]
end;
AItem.SubItems[3] := S;
// hitcount
AItem.SubItems[4] := IntToStr(ABreakpoint.HitCount);
// group
if ABreakpoint.Group = nil
then AItem.SubItems[5] := ''
else AItem.SubItems[5] := ABreakpoint.Group.Name;
end;
procedure TBreakPointsDlg.UpdateAll;
begin
end;
initialization
{$I breakpointsdlg.lrs}
@ -276,6 +309,9 @@ end.
{ =============================================================================
$Log$
Revision 1.12 2003/05/27 15:04:00 mattias
small fixes for debugger without file
Revision 1.11 2003/05/23 14:12:51 mattias
implemented restoring breakpoints

View File

@ -400,12 +400,22 @@ begin
then begin
FDialogs[ADialogType] := DEBUGDIALOGCLASS[ADialogType].Create(Self);
CurDialog:=FDialogs[ADialogType];
if (CurDialog is TBreakPointsDlg) then begin
if (Project1<>nil) then
TBreakPointsDlg(CurDialog).BaseDirectory:=Project1.ProjectDirectory;
end;
CurDialog.Name:=NonModalIDEWindowNames[DebugDlgIDEWindow[ADialogType]];
CurDialog.Tag := Integer(ADialogType);
CurDialog.OnDestroy := @DebugDialogDestroy;
DoInitDebugger;
CurDialog.Debugger := FDebugger;
EnvironmentOptions.IDEWindowLayoutList.Apply(CurDialog,CurDialog.Name);
end else begin
CurDialog:=FDialogs[ADialogType];
if (CurDialog is TBreakPointsDlg) then begin
if (Project1<>nil) then
TBreakPointsDlg(CurDialog).BaseDirectory:=Project1.ProjectDirectory;
end;
end;
FDialogs[ADialogType].Show;
FDialogs[ADialogType].BringToFront;
@ -566,6 +576,7 @@ begin
for i:=0 to FBreakpoints.Count-1 do begin
CurBreakPoint:=FBreakpoints[i];
if CompareFileNames(CurBreakPoint.Source,SrcFilename)=0 then begin
if CurBreakPoint.Enabled then begin
if CurBreakPoint.Valid in [vsValid,vsUnknown] then
CurType:=semActiveBreakPoint
@ -573,7 +584,7 @@ begin
CurType:=semInvalidBreakPoint;
end else
CurType:=semInactiveBreakPoint;
ASrcEdit.SetBreakPoint(CurBreakPoint.Line,CurType);
ASrcEdit.SetBreakPointMark(CurBreakPoint.Line,CurType);
end;
end;
end;
@ -656,13 +667,13 @@ begin
LaunchingCmdLine:=MainIDE.GetRunCommandLine;
SplitCmdLine(LaunchingCmdLine,LaunchingApplication,LaunchingParams);
if (not FileExists(LaunchingApplication)) then exit;
OldBreakpoints := nil;
OldBreakPointGroups := nil;
OldWatches := nil;
try
try
case EnvironmentOptions.DebuggerType of
dtGnuDebugger: begin
// check if debugger already created with the right type
@ -927,6 +938,9 @@ end.
{ =============================================================================
$Log$
Revision 1.29 2003/05/27 15:04:00 mattias
small fixes for debugger without file
Revision 1.28 2003/05/27 08:01:31 marc
MWE: + Added exception break
* Reworked adding/removing breakpoints

View File

@ -142,7 +142,7 @@ end;
function TOutputFilter.Execute(TheProcess: TProcess): boolean;
const
BufSize = 1024;
BufSize = 100;
var
i, Count, LineStart : longint;
OutputLine, Buf : String;
@ -156,7 +156,7 @@ begin
SetLength(Buf,BufSize);
OutputLine:='';
ErrorExists:=false;
ErrorExists:=true;
repeat
Application.ProcessMessages;
if StopExecute then exit;
@ -172,7 +172,6 @@ begin
OutputLine:=OutputLine+copy(Buf,LineStart,i-LineStart);
ReadLine(OutputLine,false);
if fLastErrorType in [etFatal, etPanic, etError] then begin
ErrorExists:=true;
Result:=false;
end;
OutputLine:='';
@ -186,8 +185,8 @@ begin
OutputLine:=OutputLine+copy(Buf,LineStart,Count-LineStart+1);
until Count=0;
TheProcess.WaitOnExit;
if TheProcess.ExitStatus<>0 then
ErrorExists:=true;
if TheProcess.ExitStatus=0 then
ErrorExists:=false;
if ErrorExists and (ofoExceptionOnError in Options) then
raise EOutputFilterError.Create('there was an error');
end;
@ -598,7 +597,9 @@ end;
function TOutputFilter.SearchIncludeFile(const ShortIncFilename: string
): string;
// search the include file and make it relative to the current start directory
var SearchedDirectories: TStringList;
var
AlreadySearchedPaths: string;
AlreadySearchedIncPaths: string;
FullDir, RelativeDir, IncludePath: string;
p: integer;
begin
@ -606,26 +607,30 @@ begin
Result:=ShortIncFilename;
exit;
end;
SearchedDirectories:=TStringList.Create;
try
// try every compiled pascal source
for p:=fCompilingHistory.Count-1 downto 0 do begin
RelativeDir:=AppendPathDelim(ExtractFilePath(fCompilingHistory[p]));
FullDir:=RelativeDir;
if not FilenameIsAbsolute(FullDir) then
FullDir:=fCurrentDirectory+FullDir;
FullDir:=TrimFilename(FullDir);
if SearchedDirectories.IndexOf(FullDir)>=0 then continue;
// new directory start a search
Result:=FullDir+ShortIncFilename;
if FileExists(Result) then begin
// file found in search dir
Result:=CleanAndExpandFilename(FullDir+ShortIncFilename);
exit;
end;
if Assigned(OnGetIncludePath) then begin
// search with include path of directory
IncludePath:=OnGetIncludePath(FullDir);
AlreadySearchedPaths:='';
AlreadySearchedIncPaths:='';
// try every compiled pascal source
for p:=fCompilingHistory.Count-1 downto 0 do begin
RelativeDir:=AppendPathDelim(ExtractFilePath(fCompilingHistory[p]));
FullDir:=RelativeDir;
if not FilenameIsAbsolute(FullDir) then
FullDir:=fCurrentDirectory+FullDir;
FullDir:=TrimFilename(FullDir);
if SearchDirectoryInSearchPath(AlreadySearchedPaths,FullDir,1)>0 then
continue;
// new directory start a search
Result:=FullDir+ShortIncFilename;
if FileExists(Result) then begin
// file found in search dir
Result:=CleanAndExpandFilename(FullDir+ShortIncFilename);
exit;
end;
AlreadySearchedPaths:=MergeSearchPaths(AlreadySearchedPaths,FullDir);
// search with include path of directory
if Assigned(OnGetIncludePath) then begin
IncludePath:=TrimSearchPath(OnGetIncludePath(FullDir),FullDir);
IncludePath:=RemoveSearchPaths(IncludePath,AlreadySearchedIncPaths);
if IncludePath<>'' then begin
Result:=SearchFileInPath(ShortIncFilename,FullDir,IncludePath,';',[]);
if Result<>'' then begin
if LeftStr(Result,length(fCurrentDirectory))=fCurrentDirectory then
@ -633,11 +638,10 @@ begin
RightStr(Result,length(Result)-length(fCurrentDirectory)));
exit;
end;
AlreadySearchedIncPaths:=MergeSearchPaths(AlreadySearchedIncPaths,
IncludePath);
end;
SearchedDirectories.Add(FullDir);
end;
finally
SearchedDirectories.Free;
end;
Result:=ShortIncFilename;
end;

View File

@ -117,6 +117,13 @@ LazarusResources.Add('InvalidBreakPoint','XPM',[
+'+###+++.",'#10'".++#+@@#++.",'#10'" .++@@+++. ",'#10'" .+++++. ",'#10'" '
+' ..... "};'#10
]);
LazarusResources.Add('MultiBreakPoint','XPM',[
'/* XPM */'#10'static char * MultiBreakPoint_xpm[] = {'#10'"11 11 3 1",'#10'"'
+' '#9'c None",'#10'".'#9'c #000000",'#10'"+'#9'c #FF0000",'#10'" ... "'
+','#10'" .+++. ",'#10'" .+++... ",'#10'".+++.+++. ",'#10'".++.+++++. '
+'",'#10'".+.+++++++.",'#10'" ..+++++++.",'#10'" .+++++++.",'#10'" .+++++.'
+' ",'#10'" .+++. ",'#10'" ... "};'#10
]);
LazarusResources.Add('UnknownBreakPoint','XPM',[
'/* XPM */'#10'static char * UnknownBreakPoint_xpm[] = {'#10'"11 11 5 1",'#10
+'" '#9'c None",'#10'".'#9'c #000000",'#10'"+'#9'c #FF0000",'#10'"@'#9'c #FFF'

View File

@ -37,9 +37,6 @@
<LCLWidgetType Value="gtk"/>
</SearchPaths>
<Other>
<Verbosity>
<ShoLineNum Value="True"/>
</Verbosity>
<CustomOptions Value="-dGTK2"/>
<CompilerPath Value="$(CompPath)"/>
</Other>