mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-18 04:09:27 +02:00
DBG: Fixed jumping to unit of unsaved project
git-svn-id: trunk@32449 -
This commit is contained in:
parent
1176e4faca
commit
dbb87ca09b
@ -430,20 +430,11 @@ end;
|
||||
procedure TCallStackDlg.JumpToSource;
|
||||
var
|
||||
Entry: TCallStackEntry;
|
||||
Filename: String;
|
||||
begin
|
||||
Entry := GetCurrentEntry;
|
||||
if Entry = nil then Exit;
|
||||
|
||||
// avoid any process-messages, so this proc can not be re-entered (avoid opening one files many times)
|
||||
DebugBoss.LockCommandProcessing;
|
||||
try
|
||||
if DebugBoss.GetFullFilename(Entry.UnitInfo, Filename, False) then
|
||||
MainIDE.DoJumpToSourcePosition(Filename, 0, Entry.Line, 0,
|
||||
[jfAddJumpPoint, jfFocusEditor, jfMarkLine, jfMapLineFromDebug]);
|
||||
finally
|
||||
DebugBoss.UnLockCommandProcessing;
|
||||
end;
|
||||
JumpToUnitSource(Entry.UnitInfo, Entry.Line);
|
||||
end;
|
||||
|
||||
procedure TCallStackDlg.CopyToClipBoard;
|
||||
|
@ -37,8 +37,8 @@ unit DebuggerDlg;
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, Forms, Controls, IDEProcs, Debugger, EnvironmentOpts, IDEOptionDefs,
|
||||
EditorOptions, IDECommands;
|
||||
Classes, Forms, Controls, IDEProcs, FileUtil, Debugger, EnvironmentOpts, IDEOptionDefs,
|
||||
MainIntf, EditorOptions, IDECommands, BaseDebugManager;
|
||||
|
||||
type
|
||||
|
||||
@ -83,6 +83,7 @@ type
|
||||
procedure SetWatchesMonitor(const AValue: TWatchesMonitor);
|
||||
procedure SetBreakPoints(const AValue: TIDEBreakPoints);
|
||||
protected
|
||||
procedure JumpToUnitSource(AnUnitInfo: TDebuggerUnitInfo; ALine: Integer);
|
||||
procedure DoWatchesChanged; virtual; // called if the WatchesMonitor object was changed
|
||||
procedure DoBreakPointsChanged; virtual; // called if the BreakPoint(Monitor) object was changed
|
||||
property SnapshotNotification: TSnapshotNotification read GetSnapshotNotification;
|
||||
@ -299,6 +300,33 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TDebuggerDlg.JumpToUnitSource(AnUnitInfo: TDebuggerUnitInfo; ALine: Integer);
|
||||
var
|
||||
Filename: String;
|
||||
ok: Boolean;
|
||||
begin
|
||||
// avoid any process-messages, so this proc can not be re-entered (avoid opening one files many times)
|
||||
DebugBoss.LockCommandProcessing;
|
||||
try
|
||||
(* Maybe trim the filename here and use jfDoNotExpandFilename
|
||||
ExpandFilename works with the current IDE path, and may be wrong
|
||||
*)
|
||||
// TODO: better detcion of unsaved project files
|
||||
if DebugBoss.GetFullFilename(AnUnitInfo, Filename, False) then begin
|
||||
ok := false;
|
||||
if FilenameIsAbsolute(Filename) then
|
||||
ok := MainIDEIntf.DoJumpToSourcePosition(Filename, 0, ALine, 0,
|
||||
[jfAddJumpPoint, jfFocusEditor, jfMarkLine, jfMapLineFromDebug]
|
||||
) = mrOK;
|
||||
if not ok then
|
||||
MainIDEIntf.DoJumpToSourcePosition(Filename, 0, ALine, 0,
|
||||
[jfDoNotExpandFilename, jfAddJumpPoint, jfFocusEditor, jfMarkLine, jfMapLineFromDebug]);
|
||||
end;
|
||||
finally
|
||||
DebugBoss.UnLockCommandProcessing;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TDebuggerDlg.DoWatchesChanged;
|
||||
begin
|
||||
//
|
||||
|
@ -143,7 +143,6 @@ end;
|
||||
procedure TThreadsDlg.JumpToSource;
|
||||
var
|
||||
Entry: TThreadEntry;
|
||||
Filename: String;
|
||||
Item: TListItem;
|
||||
begin
|
||||
Item := lvThreads.Selected;
|
||||
@ -151,15 +150,8 @@ begin
|
||||
Entry := TThreadEntry(Item.Data);
|
||||
if Entry = nil then Exit;
|
||||
|
||||
// avoid any process-messages, so this proc can not be re-entered (avoid opening one files many times)
|
||||
DebugBoss.LockCommandProcessing;
|
||||
try
|
||||
if DebugBoss.GetFullFilename(Entry.UnitInfo, Filename, False) then
|
||||
MainIDE.DoJumpToSourcePosition(Filename, 0, Entry.Line, 0,
|
||||
[jfAddJumpPoint, jfFocusEditor, jfMarkLine, jfMapLineFromDebug]);
|
||||
finally
|
||||
DebugBoss.UnLockCommandProcessing;
|
||||
end;end;
|
||||
JumpToUnitSource(Entry.UnitInfo, Entry.Line);
|
||||
end;
|
||||
|
||||
function TThreadsDlg.GetSelectedSnapshot: TSnapshot;
|
||||
begin
|
||||
|
@ -587,8 +587,14 @@ var
|
||||
begin
|
||||
Result := False;
|
||||
if Destroying then exit;
|
||||
Result := FilenameIsAbsolute(Filename);
|
||||
if Result then exit;
|
||||
(* The below currently does not work for unsaved projects *)
|
||||
//Result := FilenameIsAbsolute(Filename);
|
||||
//if Result then exit;
|
||||
|
||||
// TODO, check for virtual file, and flag it
|
||||
// Project1.IsVirtual
|
||||
// Left(Filename,1, xxx) = LazarusIDE.GetTestBuildDirectory
|
||||
|
||||
|
||||
// some debuggers (e.g. gdb) sometimes returns linux path delims under windows
|
||||
// => fix that
|
||||
|
@ -175,8 +175,10 @@ type
|
||||
procedure FindInFiles(AProject: TProject; const FindText: string); override;
|
||||
end;
|
||||
|
||||
var
|
||||
MainIDE: TMainIDEBase = nil;
|
||||
function GetMainIde: TMainIDEBase;
|
||||
procedure SetMainIde(AValue: TMainIDEBase);
|
||||
|
||||
property MainIDE: TMainIDEBase read GetMainIde write SetMainIde;
|
||||
|
||||
{ Normally the IDE builds itself with packages named in config files.
|
||||
When the IDE should keep the packages installed in the current executable
|
||||
@ -188,6 +190,16 @@ implementation
|
||||
uses
|
||||
IDEImagesIntf;
|
||||
|
||||
function GetMainIde: TMainIDEBase;
|
||||
begin
|
||||
Result := TMainIDEBase(MainIDEIntf)
|
||||
end;
|
||||
|
||||
procedure SetMainIde(AValue: TMainIDEBase);
|
||||
begin
|
||||
MainIDEIntf := AValue;
|
||||
end;
|
||||
|
||||
//{$IFDEF LCLCarbon}
|
||||
//var
|
||||
// mnuApple: TIDEMenuSection = nil;
|
||||
|
@ -216,8 +216,8 @@ type
|
||||
|
||||
var
|
||||
MainIDEInterface: TMainIDEInterface;
|
||||
|
||||
ObjectInspector1: TObjectInspectorDlg = nil;
|
||||
MainIDEIntf: TMainIDEInterface = nil;
|
||||
|
||||
const
|
||||
OpenFlagNames: array[TOpenFlag] of string = (
|
||||
|
Loading…
Reference in New Issue
Block a user