implemented view call stack key and jumping to last stack frame with debug info

git-svn-id: trunk@4250 -
This commit is contained in:
mattias 2003-06-09 15:58:05 +00:00
parent 80b3c6bfcf
commit 364b458aec
5 changed files with 70 additions and 18 deletions

View File

@ -42,6 +42,7 @@ function GetPart(const ASkipTo, AnEnd: array of String; var ASource: String): St
function GetPart(const ASkipTo, AnEnd: array of String; var ASource: String; const AnIgnoreCase: Boolean): String; overload;
function GetPart(const ASkipTo, AnEnd: array of String; var ASource: String; const AnIgnoreCase, AnUpdateSource: Boolean): String; overload;
function ConvertToCString(const AText: String): String;
function DeleteBackSlashes(const AText: String): String;
const
{$IFDEF WIN32}
@ -201,9 +202,27 @@ begin
end;
end;
function DeleteBackSlashes(const AText: String): String;
var
i: Integer;
l: Integer;
begin
Result:=AText;
i:=1;
l:=length(Result);
while i<l do begin
if Result[i]='\' then
System.Delete(Result,i,1);
inc(i);
end;
end;
end.
{ =============================================================================
$Log$
Revision 1.5 2003/06/09 15:58:05 mattias
implemented view call stack key and jumping to last stack frame with debug info
Revision 1.4 2003/05/29 17:40:10 marc
MWE: * Fixed string resolving
* Updated exception handling

View File

@ -635,12 +635,6 @@ type
function Modify(const AExpression, AValue: String): Boolean; // Modifies the given expression, returns true if valid
function TargetIsStarted: boolean; virtual;
(*
procedure LoadFromXMLConfig(XMLConfig: TXMLConfig; const Path: string;
const OnLoadFilename: TOnLoadFilenameFromConfig); virtual;
procedure SaveToXMLConfig(XMLConfig: TXMLConfig; const Path: string;
const OnSaveFilename: TOnSaveFilenameToConfig); virtual;
*)
public
property Arguments: String read FArguments write FArguments; // Arguments feed to the program
property BreakPoints: TDBGBreakPoints read FBreakPoints; // list of all breakpoints
@ -2456,6 +2450,9 @@ end;
end.
{ =============================================================================
$Log$
Revision 1.42 2003/06/09 15:58:05 mattias
implemented view call stack key and jumping to last stack frame with debug info
Revision 1.41 2003/06/09 14:30:47 marc
MWE: + Added working dir.

View File

@ -64,7 +64,8 @@ type
function DoStepOverProject: TModalResult; virtual; abstract;
function DoRunToCursor: TModalResult; virtual; abstract;
function DoStopProject: TModalResult; virtual; abstract;
procedure DoToggleCallStack; virtual; abstract;
procedure RunDebugger; virtual; abstract;
procedure EndDebugging; virtual; abstract;
function Evaluate(const AExpression: String; var AResult: String

View File

@ -139,6 +139,7 @@ type
function DoStopProject: TModalResult; override;
function DoBeginChangeDebugger: TModalResult;
function DoEndChangeDebugger: TModalResult;
procedure DoToggleCallStack; override;
procedure RunDebugger; override;
procedure EndDebugging; override;
@ -577,8 +578,12 @@ begin
if Destroying then exit;
if AExceptionText = ''
then msg := Format('Project %s raised exception class ''%s''.', [Project1.Title, AExceptionClass])
else msg := Format('Project %s raised exception class ''%s'' with message ''%s''.', [Project1.Title, AExceptionClass, AExceptionText]);
then
msg := Format('Project %s raised exception class ''%s''.',
[Project1.Title, AExceptionClass])
else
msg := Format('Project %s raised exception class ''%s'' with message:%s%s',
[Project1.Title, AExceptionClass, #13, AExceptionText]);
MessageDlg('Error', msg, mtError,[mbOk],0);
end;
@ -685,22 +690,38 @@ var
SrcFile: String;
NewSource: TCodeBuffer;
Editor: TSourceEditor;
SrcLine: Integer;
i: Integer;
StackEntry: TDBGCallStackEntry;
begin
if (Sender<>FDebugger) or (Sender=nil) then exit;
if Destroying then exit;
SrcFile:=ALocation.SrcFile;
SrcLine:=ALocation.SrcLine;
//TODO: Show assembler window if no source can be found.
if ALocation.SrcLine = -1
if SrcLine = -1
then begin
MessageDlg(lisExecutionPaused,
Format(lisExecutionPausedAdress, [#13#13, ALocation.Address, #13,
ALocation.FuncName, #13, ALocation.SrcFile, #13#13#13, #13]),
mtInformation, [mbOK],0);
Exit;
// jump to the deepest stack frame with debugging info
i:=FDebugger.CallStack.Count-1;
while (i>=0) do begin
StackEntry:=FDebugger.CallStack.Entries[i];
if StackEntry.Line>0 then begin
SrcLine:=StackEntry.Line;
SrcFile:=StackEntry.Source;
break;
end;
end;
if SrcLine<1 then
Exit;
end;
SrcFile:=ALocation.SrcFile;
if DebuggerDlgGetFullFilename(nil,SrcFile,true)<>mrOk then exit;
NewSource:=CodeToolBoss.LoadFile(SrcFile,true,false);
@ -718,8 +739,8 @@ begin
end;
// jump editor to execution line
if MainIDE.DoJumpToCodePos(nil,nil,NewSource,1,ALocation.SrcLine,-1,true)
<>mrOk then exit;
if MainIDE.DoJumpToCodePos(nil,nil,NewSource,1,SrcLine,-1,true)<>mrOk
then exit;
// mark execution line
if SourceNotebook <> nil
@ -727,7 +748,7 @@ begin
else Editor := nil;
if Editor <> nil
then Editor.ExecutionLine:=ALocation.SrcLine;
then Editor.ExecutionLine:=SrcLine;
end;
//-----------------------------------------------------------------------------
@ -1085,6 +1106,7 @@ var
var
LaunchingCmdLine, LaunchingApplication, LaunchingParams: String;
NewWorkingDir: String;
begin
WriteLN('[TDebugManager.DoInitDebugger] A');
@ -1094,7 +1116,7 @@ begin
LaunchingCmdLine:=MainIDE.GetRunCommandLine;
SplitCmdLine(LaunchingCmdLine,LaunchingApplication,LaunchingParams);
if (not FileExists(LaunchingApplication)) then exit;
OldWatches := nil;
BeginUpdateDialogs;
@ -1142,7 +1164,11 @@ begin
FDebugger.FileName := LaunchingApplication;
FDebugger.Arguments := LaunchingParams;
FDebugger.WorkingDir := Project1.RunParameterOptions.WorkingDirectory;
NewWorkingDir:=Project1.RunParameterOptions.WorkingDirectory;
if NewWorkingDir='' then
NewWorkingDir:=Project1.ProjectDirectory;
FDebugger.WorkingDir:=NewWorkingDir;
Project1.RunParameterOptions.AssignEnvironmentTo(FDebugger.Environment);
if FDialogs[ddtOutput] <> nil
@ -1253,6 +1279,11 @@ begin
Result:=mrOk;
end;
procedure TDebugManager.DoToggleCallStack;
begin
ViewDebugDialog(ddtCallStack);
end;
procedure TDebugManager.RunDebugger;
begin
if Destroying then exit;
@ -1389,6 +1420,9 @@ end.
{ =============================================================================
$Log$
Revision 1.50 2003/06/09 15:58:05 mattias
implemented view call stack key and jumping to last stack frame with debug info
Revision 1.49 2003/06/09 14:39:52 mattias
implemented setting working directory for debugger

View File

@ -940,6 +940,7 @@ resourcestring
uemAddBreakpoint = '&Add Breakpoint';
uemAddWatchAtCursor = 'Add &Watch At Cursor';
uemRunToCursor='&Run to Cursor';
uemViewCallStackCursor = 'View Call Stack';
uemMoveEditorLeft='Move Editor Left';
uemMoveEditorRight='Move Editor Right';
uemEditorproperties='Editor properties';