DBG: Fixed jumping to unit of unsaved project

git-svn-id: trunk@32449 -
This commit is contained in:
martin 2011-09-21 12:13:24 +00:00
parent 1176e4faca
commit dbb87ca09b
6 changed files with 56 additions and 27 deletions

View File

@ -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;

View File

@ -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
//

View File

@ -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

View File

@ -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

View File

@ -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;

View File

@ -216,8 +216,8 @@ type
var
MainIDEInterface: TMainIDEInterface;
ObjectInspector1: TObjectInspectorDlg = nil;
MainIDEIntf: TMainIDEInterface = nil;
const
OpenFlagNames: array[TOpenFlag] of string = (