mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-11-08 14:29:48 +01:00
implemented searching debugging files in inherited unit paths
git-svn-id: trunk@4177 -
This commit is contained in:
parent
692d003027
commit
00a3d4a023
@ -206,6 +206,7 @@ type
|
||||
function GetNestedCommentsFlagForFile(const Filename: string): boolean;
|
||||
function GetPascalCompilerForDirectory(const Directory: string): TPascalCompiler;
|
||||
function GetCompilerModeForDirectory(const Directory: string): TCompilerMode;
|
||||
function GetCompiledSrcExtForDirectory(const Directory: string): string;
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
@ -687,6 +688,18 @@ begin
|
||||
Result:=cm;
|
||||
end;
|
||||
|
||||
function TCodeToolManager.GetCompiledSrcExtForDirectory(const Directory: string
|
||||
): string;
|
||||
var
|
||||
Evaluator: TExpressionEvaluator;
|
||||
begin
|
||||
Result:='.ppu';
|
||||
Evaluator:=DefineTree.GetDefinesForDirectory(Directory,true);
|
||||
if Evaluator=nil then exit;
|
||||
if Evaluator.IsDefined('WIN32') then
|
||||
Result:='.ppw';
|
||||
end;
|
||||
|
||||
function TCodeToolManager.InitCurCodeTool(Code: TCodeBuffer): boolean;
|
||||
var MainCode: TCodeBuffer;
|
||||
begin
|
||||
|
||||
@ -40,12 +40,12 @@ uses
|
||||
MemCheck,
|
||||
{$ENDIF}
|
||||
Classes, SysUtils, Forms, Controls, Dialogs, Menus, FileCtrl, Laz_XMLCfg,
|
||||
SynEdit,
|
||||
SynEdit, CodeCache, CodeToolManager,
|
||||
CompilerOptions, EditorOptions, EnvironmentOpts, KeyMapping, UnitEditor,
|
||||
Project, IDEProcs, Debugger, RunParamsOpts, ExtToolDialog, IDEOptionDefs,
|
||||
LazarusIDEStrConsts, ProjectDefs, BaseDebugManager, MainBar, DebuggerDlg,
|
||||
Watchesdlg, BreakPointsdlg, LocalsDlg, DBGOutputForm, GDBMIDebugger,
|
||||
CallStackDlg;
|
||||
Project, IDEProcs, InputHistory, Debugger, RunParamsOpts, ExtToolDialog,
|
||||
IDEOptionDefs, LazarusIDEStrConsts, ProjectDefs, BaseDebugManager, MainBar,
|
||||
DebuggerDlg, Watchesdlg, BreakPointsdlg, LocalsDlg, DBGOutputForm,
|
||||
GDBMIDebugger, CallStackDlg;
|
||||
|
||||
|
||||
type
|
||||
@ -288,11 +288,9 @@ procedure TDebugManager.OnDebuggerCurrentLine(Sender: TObject;
|
||||
// -> show the current execution line in editor
|
||||
// if SrcLine = -1 then no source is available
|
||||
var
|
||||
ActiveSrcEdit: TSourceEditor;
|
||||
SearchFile, UnitFile: String;
|
||||
SrcFile: String;
|
||||
OpenDialog: TOpenDialog;
|
||||
UnitInfo: TUnitInfo;
|
||||
n: Integer;
|
||||
NewSource: TCodeBuffer;
|
||||
begin
|
||||
if (Sender<>FDebugger) or (Sender=nil) then exit;
|
||||
|
||||
@ -307,64 +305,48 @@ begin
|
||||
Exit;
|
||||
end;
|
||||
|
||||
UnitFile := MainIDE.FindUnitFile(ALocation.SrcFile);
|
||||
if UnitFile = ''
|
||||
then UnitFile := ALocation.SrcFile;
|
||||
SrcFile := MainIDE.FindSourceFile(ALocation.SrcFile);
|
||||
if SrcFile = '' then SrcFile := ALocation.SrcFile;
|
||||
|
||||
if MainIDE.DoOpenEditorFile(UnitFile,-1,[ofOnlyIfExists, ofQuiet]) <> mrOk
|
||||
then begin
|
||||
// Try to find it ourself in the project files
|
||||
SearchFile := ExtractFilenameOnly(ALocation.SrcFile);
|
||||
UnitFile := '';
|
||||
for n := Project1.UnitCount - 1 downto 0 do
|
||||
begin
|
||||
UnitInfo := Project1.Units[n];
|
||||
if CompareFileNames(SearchFile, ExtractFilenameOnly(UnitInfo.FileName)) = 0
|
||||
then begin
|
||||
UnitFile := UnitInfo.FileName;
|
||||
Break;
|
||||
end;
|
||||
end;
|
||||
|
||||
if (UnitFile = '')
|
||||
or (MainIDE.DoOpenEditorFile(UnitFile,-1,[ofOnlyIfExists, ofQuiet]) <> mrOk)
|
||||
then begin
|
||||
UnitFile := ALocation.SrcFile;
|
||||
repeat
|
||||
if (not FilenameIsAbsolute(SrcFile)) or (not FileExists(SrcFile)) then begin
|
||||
if MessageDlg(lisFileNotFound,
|
||||
Format(lisTheFileWasNotFoundDoYouWantToLocateItYourself, ['"',
|
||||
UnitFile, '"', #13, #13, #13])
|
||||
SrcFile, '"', #13, #13, #13])
|
||||
,mtConfirmation, [mbYes, mbNo], 0) <> mrYes
|
||||
then Exit;
|
||||
|
||||
OpenDialog := TOpenDialog.Create(Application);
|
||||
repeat
|
||||
OpenDialog:=TOpenDialog.Create(Application);
|
||||
try
|
||||
OpenDialog.Title := lisOpenFile;
|
||||
OpenDialog.FileName := ALocation.SrcFile;
|
||||
if not OpenDialog.Execute
|
||||
then Exit;
|
||||
UnitFile := OpenDialog.FileName;
|
||||
InputHistories.ApplyFileDialogSettings(OpenDialog);
|
||||
OpenDialog.Title:=lisOpenFile+' '+SrcFile;
|
||||
OpenDialog.Options:=OpenDialog.Options+[ofFileMustExist];
|
||||
if not OpenDialog.Execute then
|
||||
exit;
|
||||
SrcFile:=CleanAndExpandFilename(OpenDialog.FileName);
|
||||
InputHistories.StoreFileDialogSettings(OpenDialog);
|
||||
finally
|
||||
OpenDialog.Free;
|
||||
end;
|
||||
until MainIDE.DoOpenEditorFile(UnitFile,-1,[ofOnlyIfExists, ofQuiet]) = mrOk;
|
||||
end;
|
||||
until FilenameIsAbsolute(SrcFile) and FileExists(SrcFile);
|
||||
|
||||
end;
|
||||
|
||||
ActiveSrcEdit := SourceNoteBook.GetActiveSE;
|
||||
if ActiveSrcEdit=nil then exit;
|
||||
|
||||
with ActiveSrcEdit.EditorComponent do
|
||||
begin
|
||||
CaretXY:=Point(1, ALocation.SrcLine);
|
||||
BlockBegin:=CaretXY;
|
||||
BlockEnd:=CaretXY;
|
||||
TopLine:=ALocation.SrcLine-(LinesInWindow div 2);
|
||||
NewSource:=CodeToolBoss.LoadFile(SrcFile,true,false);
|
||||
if NewSource=nil then begin
|
||||
exit;
|
||||
end;
|
||||
|
||||
// clear old error and execution lines
|
||||
if SourceNotebook<>nil then begin
|
||||
SourceNotebook.ClearExecutionLines;
|
||||
SourceNotebook.ClearErrorLines;
|
||||
ActiveSrcEdit.ExecutionLine:=ALocation.SrcLine;
|
||||
// ActiveSrcEdit.ErrorLine:=ALocation.SrcLine;
|
||||
end;
|
||||
// jump editor to execution line
|
||||
if MainIDE.DoJumpToCodePos(nil,nil,NewSource,1,ALocation.SrcLine,-1,true)
|
||||
<>mrOk then exit;
|
||||
// mark execution line
|
||||
SourceNotebook.GetActiveSE.ExecutionLine:=ALocation.SrcLine;
|
||||
end;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -912,6 +894,9 @@ end.
|
||||
|
||||
{ =============================================================================
|
||||
$Log$
|
||||
Revision 1.21 2003/05/23 18:50:07 mattias
|
||||
implemented searching debugging files in inherited unit paths
|
||||
|
||||
Revision 1.20 2003/05/23 16:46:13 mattias
|
||||
added message, that debugger is readonly while running
|
||||
|
||||
|
||||
@ -417,6 +417,10 @@ type
|
||||
procedure SaveEnvironment; virtual; abstract;
|
||||
procedure SetRecentSubMenu(ParentMenuItem: TMenuItem; FileList: TStringList;
|
||||
OnClickEvent: TNotifyEvent); virtual;
|
||||
function DoJumpToCodePos(
|
||||
ActiveSrcEdit: TSourceEditor; ActiveUnitInfo: TUnitInfo;
|
||||
NewSource: TCodeBuffer; NewX, NewY, NewTopLine: integer;
|
||||
AddJumpPoint: boolean): TModalResult; virtual; abstract;
|
||||
procedure DoJumpToCodeToolBossError; virtual; abstract;
|
||||
procedure SaveSourceEditorChangesToCodeCache(PageIndex: integer); virtual; abstract;
|
||||
end;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user