mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-14 08:59:13 +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;
|
procedure TCallStackDlg.JumpToSource;
|
||||||
var
|
var
|
||||||
Entry: TCallStackEntry;
|
Entry: TCallStackEntry;
|
||||||
Filename: String;
|
|
||||||
begin
|
begin
|
||||||
Entry := GetCurrentEntry;
|
Entry := GetCurrentEntry;
|
||||||
if Entry = nil then Exit;
|
if Entry = nil then Exit;
|
||||||
|
|
||||||
// avoid any process-messages, so this proc can not be re-entered (avoid opening one files many times)
|
JumpToUnitSource(Entry.UnitInfo, Entry.Line);
|
||||||
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;
|
end;
|
||||||
|
|
||||||
procedure TCallStackDlg.CopyToClipBoard;
|
procedure TCallStackDlg.CopyToClipBoard;
|
||||||
|
@ -37,8 +37,8 @@ unit DebuggerDlg;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, Forms, Controls, IDEProcs, Debugger, EnvironmentOpts, IDEOptionDefs,
|
Classes, Forms, Controls, IDEProcs, FileUtil, Debugger, EnvironmentOpts, IDEOptionDefs,
|
||||||
EditorOptions, IDECommands;
|
MainIntf, EditorOptions, IDECommands, BaseDebugManager;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
@ -83,6 +83,7 @@ type
|
|||||||
procedure SetWatchesMonitor(const AValue: TWatchesMonitor);
|
procedure SetWatchesMonitor(const AValue: TWatchesMonitor);
|
||||||
procedure SetBreakPoints(const AValue: TIDEBreakPoints);
|
procedure SetBreakPoints(const AValue: TIDEBreakPoints);
|
||||||
protected
|
protected
|
||||||
|
procedure JumpToUnitSource(AnUnitInfo: TDebuggerUnitInfo; ALine: Integer);
|
||||||
procedure DoWatchesChanged; virtual; // called if the WatchesMonitor object was changed
|
procedure DoWatchesChanged; virtual; // called if the WatchesMonitor object was changed
|
||||||
procedure DoBreakPointsChanged; virtual; // called if the BreakPoint(Monitor) object was changed
|
procedure DoBreakPointsChanged; virtual; // called if the BreakPoint(Monitor) object was changed
|
||||||
property SnapshotNotification: TSnapshotNotification read GetSnapshotNotification;
|
property SnapshotNotification: TSnapshotNotification read GetSnapshotNotification;
|
||||||
@ -299,6 +300,33 @@ begin
|
|||||||
end;
|
end;
|
||||||
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;
|
procedure TDebuggerDlg.DoWatchesChanged;
|
||||||
begin
|
begin
|
||||||
//
|
//
|
||||||
|
@ -143,7 +143,6 @@ end;
|
|||||||
procedure TThreadsDlg.JumpToSource;
|
procedure TThreadsDlg.JumpToSource;
|
||||||
var
|
var
|
||||||
Entry: TThreadEntry;
|
Entry: TThreadEntry;
|
||||||
Filename: String;
|
|
||||||
Item: TListItem;
|
Item: TListItem;
|
||||||
begin
|
begin
|
||||||
Item := lvThreads.Selected;
|
Item := lvThreads.Selected;
|
||||||
@ -151,15 +150,8 @@ begin
|
|||||||
Entry := TThreadEntry(Item.Data);
|
Entry := TThreadEntry(Item.Data);
|
||||||
if Entry = nil then Exit;
|
if Entry = nil then Exit;
|
||||||
|
|
||||||
// avoid any process-messages, so this proc can not be re-entered (avoid opening one files many times)
|
JumpToUnitSource(Entry.UnitInfo, Entry.Line);
|
||||||
DebugBoss.LockCommandProcessing;
|
end;
|
||||||
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;
|
|
||||||
|
|
||||||
function TThreadsDlg.GetSelectedSnapshot: TSnapshot;
|
function TThreadsDlg.GetSelectedSnapshot: TSnapshot;
|
||||||
begin
|
begin
|
||||||
|
@ -587,8 +587,14 @@ var
|
|||||||
begin
|
begin
|
||||||
Result := False;
|
Result := False;
|
||||||
if Destroying then exit;
|
if Destroying then exit;
|
||||||
Result := FilenameIsAbsolute(Filename);
|
(* The below currently does not work for unsaved projects *)
|
||||||
if Result then exit;
|
//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
|
// some debuggers (e.g. gdb) sometimes returns linux path delims under windows
|
||||||
// => fix that
|
// => fix that
|
||||||
|
@ -175,8 +175,10 @@ type
|
|||||||
procedure FindInFiles(AProject: TProject; const FindText: string); override;
|
procedure FindInFiles(AProject: TProject; const FindText: string); override;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
var
|
function GetMainIde: TMainIDEBase;
|
||||||
MainIDE: TMainIDEBase = nil;
|
procedure SetMainIde(AValue: TMainIDEBase);
|
||||||
|
|
||||||
|
property MainIDE: TMainIDEBase read GetMainIde write SetMainIde;
|
||||||
|
|
||||||
{ Normally the IDE builds itself with packages named in config files.
|
{ Normally the IDE builds itself with packages named in config files.
|
||||||
When the IDE should keep the packages installed in the current executable
|
When the IDE should keep the packages installed in the current executable
|
||||||
@ -188,6 +190,16 @@ implementation
|
|||||||
uses
|
uses
|
||||||
IDEImagesIntf;
|
IDEImagesIntf;
|
||||||
|
|
||||||
|
function GetMainIde: TMainIDEBase;
|
||||||
|
begin
|
||||||
|
Result := TMainIDEBase(MainIDEIntf)
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure SetMainIde(AValue: TMainIDEBase);
|
||||||
|
begin
|
||||||
|
MainIDEIntf := AValue;
|
||||||
|
end;
|
||||||
|
|
||||||
//{$IFDEF LCLCarbon}
|
//{$IFDEF LCLCarbon}
|
||||||
//var
|
//var
|
||||||
// mnuApple: TIDEMenuSection = nil;
|
// mnuApple: TIDEMenuSection = nil;
|
||||||
|
@ -216,8 +216,8 @@ type
|
|||||||
|
|
||||||
var
|
var
|
||||||
MainIDEInterface: TMainIDEInterface;
|
MainIDEInterface: TMainIDEInterface;
|
||||||
|
|
||||||
ObjectInspector1: TObjectInspectorDlg = nil;
|
ObjectInspector1: TObjectInspectorDlg = nil;
|
||||||
|
MainIDEIntf: TMainIDEInterface = nil;
|
||||||
|
|
||||||
const
|
const
|
||||||
OpenFlagNames: array[TOpenFlag] of string = (
|
OpenFlagNames: array[TOpenFlag] of string = (
|
||||||
|
Loading…
Reference in New Issue
Block a user