mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-10-22 15:11:37 +02:00
* RestDebugger or multiple running of debugged program now works
+ added DoContToCursor(F4) * Breakpoints are now inserted correctly (was mainlyy a problem of directories)
This commit is contained in:
parent
2d6a949149
commit
c99810d589
@ -25,6 +25,7 @@ type
|
||||
InvalidSourceLine : boolean;
|
||||
LastFileName : string;
|
||||
LastSource : PView; {PsourceWindow !! }
|
||||
HiddenStepsCount : longint;
|
||||
constructor Init(const exefn:string);
|
||||
destructor Done;
|
||||
procedure DoSelectSourceline(const fn:string;line:longint);virtual;
|
||||
@ -36,6 +37,9 @@ type
|
||||
procedure RemoveBreakpoints;
|
||||
procedure DoDebuggerScreen;virtual;
|
||||
procedure DoUserScreen;virtual;
|
||||
procedure Reset;virtual;
|
||||
procedure Run;virtual;
|
||||
procedure Continue;virtual;
|
||||
end;
|
||||
|
||||
BreakpointType = (bt_function,bt_file_line,bt_watch,bt_awatch,bt_rwatch,bt_invalid);
|
||||
@ -56,7 +60,7 @@ type
|
||||
GDBIndex : longint;
|
||||
GDBState : BreakpointState;
|
||||
constructor Init_function(Const AFunc : String);
|
||||
constructor Init_file_line(Const AFile : String; ALine : longint);
|
||||
constructor Init_file_line(AFile : String; ALine : longint);
|
||||
constructor Init_type(atyp : BreakpointType;Const AFunc : String);
|
||||
procedure Insert;
|
||||
procedure Remove;
|
||||
@ -68,6 +72,7 @@ type
|
||||
TBreakpointCollection=object(TCollection)
|
||||
function At(Index: Integer): PBreakpoint;
|
||||
function ToggleFileLine(Const FileName: String;LineNr : Longint) : boolean;
|
||||
procedure Update;
|
||||
procedure FreeItem(Item: Pointer); virtual;
|
||||
end;
|
||||
|
||||
@ -83,8 +88,8 @@ implementation
|
||||
uses
|
||||
Dos,Mouse,Video,
|
||||
App,Strings,
|
||||
FPViews,FPVars,FPUtils,FPIntf,
|
||||
FPCompile,FPIde;
|
||||
FPViews,FPVars,FPUtils,FPConst,
|
||||
FPIntf,FPCompile,FPIde;
|
||||
|
||||
|
||||
{****************************************************************************
|
||||
@ -97,6 +102,8 @@ begin
|
||||
inherited Init;
|
||||
f := exefn;
|
||||
LoadFile(f);
|
||||
SetArgs(GetRunParameters);
|
||||
Debugger:=@self;
|
||||
InsertBreakpoints;
|
||||
end;
|
||||
|
||||
@ -128,6 +135,30 @@ begin
|
||||
inherited Done;
|
||||
end;
|
||||
|
||||
procedure TDebugController.Run;
|
||||
begin
|
||||
inherited Run;
|
||||
MyApp.SetCmdState([cmResetDebugger],true);
|
||||
end;
|
||||
|
||||
procedure TDebugController.Continue;
|
||||
begin
|
||||
if not debugger_started then
|
||||
Run;
|
||||
inherited Continue;
|
||||
end;
|
||||
|
||||
procedure TDebugController.Reset;
|
||||
var
|
||||
W : PSourceWindow;
|
||||
begin
|
||||
inherited Reset;
|
||||
MyApp.SetCmdState([cmResetDebugger],false);
|
||||
W:=PSourceWindow(LastSource);
|
||||
if assigned(W) then
|
||||
W^.Editor^.SetHighlightRow(-1);
|
||||
end;
|
||||
|
||||
procedure TDebugController.AnnotateError;
|
||||
var errornb : longint;
|
||||
begin
|
||||
@ -201,8 +232,23 @@ begin
|
||||
end;
|
||||
|
||||
procedure TDebugController.DoEndSession(code:longint);
|
||||
var P :Array[1..2] of longint;
|
||||
W : PSourceWindow;
|
||||
begin
|
||||
InformationBox(#3'Program exited with '#13#3'exitcode = %d',@code);
|
||||
MyApp.SetCmdState([cmResetDebugger],false);
|
||||
W:=PSourceWindow(LastSource);
|
||||
if assigned(W) then
|
||||
W^.Editor^.SetHighlightRow(-1);
|
||||
If HiddenStepsCount=0 then
|
||||
InformationBox(#3'Program exited with '#13#3'exitcode = %d',@code)
|
||||
else
|
||||
begin
|
||||
P[1]:=code;
|
||||
P[2]:=HiddenStepsCount;
|
||||
WarningBox(#3'Program exited with '#13+
|
||||
#3'exitcode = %d'#13+
|
||||
#3'hidden steps = %d',@P);
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
@ -244,11 +290,17 @@ begin
|
||||
Conditions:=nil;
|
||||
end;
|
||||
|
||||
constructor TBreakpoint.Init_file_line(Const AFile : String; ALine : longint);
|
||||
constructor TBreakpoint.Init_file_line(AFile : String; ALine : longint);
|
||||
begin
|
||||
typ:=bt_file_line;
|
||||
state:=bs_enabled;
|
||||
GDBState:=bs_deleted;
|
||||
AFile:=NameAndExtOf(AFile);
|
||||
{ d:test.pas:12 does not work !! }
|
||||
{ I do not know how to solve this if
|
||||
if (Length(AFile)>1) and (AFile[2]=':') then
|
||||
AFile:=Copy(AFile,3,255);
|
||||
Only use base name for now !! PM }
|
||||
Name:=NewStr(AFile);
|
||||
Line:=ALine;
|
||||
IgnoreCount:=0;
|
||||
@ -259,7 +311,7 @@ end;
|
||||
procedure TBreakpoint.Insert;
|
||||
begin
|
||||
If not assigned(Debugger) then Exit;
|
||||
|
||||
Remove;
|
||||
Debugger^.last_breakpoint_number:=0;
|
||||
if (GDBState=bs_deleted) and (state=bs_enabled) then
|
||||
begin
|
||||
@ -324,6 +376,7 @@ end;
|
||||
|
||||
destructor TBreakpoint.Done;
|
||||
begin
|
||||
Remove;
|
||||
if assigned(Name) then
|
||||
DisposeStr(Name);
|
||||
if assigned(Conditions) then
|
||||
@ -344,7 +397,17 @@ end;
|
||||
|
||||
procedure TBreakpointCollection.FreeItem(Item: Pointer);
|
||||
begin
|
||||
if Item<>nil then Dispose(PBreakpoint(Item),Done);
|
||||
if Item<>nil then
|
||||
Dispose(PBreakpoint(Item),Done);
|
||||
end;
|
||||
|
||||
procedure TBreakpointCollection.Update;
|
||||
begin
|
||||
if assigned(Debugger) then
|
||||
begin
|
||||
Debugger^.RemoveBreakpoints;
|
||||
Debugger^.InsertBreakpoints;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TBreakpointCollection.ToggleFileLine(Const FileName: String;LineNr : Longint) : boolean;
|
||||
@ -375,8 +438,10 @@ begin
|
||||
ToggleFileLine:=true;
|
||||
End;
|
||||
end;
|
||||
Update;
|
||||
end;
|
||||
|
||||
|
||||
{****************************************************************************
|
||||
Initialize
|
||||
****************************************************************************}
|
||||
@ -406,9 +471,10 @@ procedure DoneDebugger;
|
||||
begin
|
||||
if assigned(Debugger) then
|
||||
dispose(Debugger,Done);
|
||||
If Use_gdb_file then
|
||||
Close(GDB_file);
|
||||
Use_gdb_file:=false;
|
||||
Debugger:=nil;
|
||||
If Use_gdb_file then
|
||||
Close(GDB_file);
|
||||
Use_gdb_file:=false;
|
||||
end;
|
||||
|
||||
begin
|
||||
@ -417,7 +483,13 @@ end.
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.8 1999-02-05 17:21:52 pierre
|
||||
Revision 1.9 1999-02-08 17:43:43 pierre
|
||||
* RestDebugger or multiple running of debugged program now works
|
||||
+ added DoContToCursor(F4)
|
||||
* Breakpoints are now inserted correctly (was mainlyy a problem
|
||||
of directories)
|
||||
|
||||
Revision 1.8 1999/02/05 17:21:52 pierre
|
||||
Invalid_line renamed InvalidSourceLine
|
||||
|
||||
Revision 1.7 1999/02/05 13:08:41 pierre
|
||||
|
@ -51,6 +51,7 @@ type
|
||||
procedure DoTraceInto;
|
||||
procedure DoRun;
|
||||
procedure DoResetDebugger;
|
||||
procedure DoContToCursor;
|
||||
procedure Target;
|
||||
procedure PrimaryFile_;
|
||||
procedure ClearPrimary;
|
||||
@ -184,9 +185,10 @@ begin
|
||||
NewItem('~R~un','Ctrl+F9', kbCtrlF9, cmRun, hcRun,
|
||||
NewItem('~S~tep over','F8', kbF8, cmStepOver, hcRun,
|
||||
NewItem('~T~race into','F7', kbF7, cmTraceInto, hcRun,
|
||||
NewItem('~G~oto Cursor','F4', kbF4, cmContToCursor, hcContToCursor,
|
||||
NewItem('P~a~rameters...','', kbNoKey, cmParameters, hcParameters,
|
||||
NewItem('~P~rogram reset','Ctrl+F2', kbCtrlF2, cmResetDebugger, hcResetDebugger,
|
||||
nil)))))),
|
||||
nil))))))),
|
||||
NewSubMenu('~C~ompile',hcCompileMenu, NewMenu(
|
||||
NewItem('~C~ompile','Alt+F9', kbAltF9, cmCompile, hcCompile,
|
||||
NewItem('~M~ake','F9', kbF9, cmMake, hcMake,
|
||||
@ -338,7 +340,7 @@ begin
|
||||
cmTraceInto : DoTraceInto;
|
||||
cmRun : DoRun;
|
||||
cmResetDebugger : DoResetDebugger;
|
||||
|
||||
cmContToCursor : DoContToCursor;
|
||||
{ -- Compile menu -- }
|
||||
cmCompile : DoCompile(cCompile);
|
||||
cmBuild : DoCompile(cBuild);
|
||||
@ -451,7 +453,7 @@ begin
|
||||
WriteShellMsg;
|
||||
|
||||
SwapVectors;
|
||||
Exec(GetEnv('COMSPEC'),'/C '+ProgramPath+' '+Params);
|
||||
Dos.Exec(GetEnv('COMSPEC'),'/C '+ProgramPath+' '+Params);
|
||||
SwapVectors;
|
||||
|
||||
ShowIDEScreen;
|
||||
@ -463,6 +465,7 @@ begin
|
||||
SetCmdState([cmSaveAll],IsThereAnyEditor);
|
||||
SetCmdState([cmCloseAll,cmTile,cmCascade,cmWindowList],IsThereAnyWindow);
|
||||
SetCmdState([cmFindProcedure,cmObjects,cmModules,cmGlobals{,cmInformation}],IsSymbolInfoAvailable);
|
||||
SetCmdState([cmResetDebugger],assigned(debugger) and debugger^.debugger_started);
|
||||
UpdatePrimaryFile;
|
||||
UpdateINIFile;
|
||||
Message(MenuBar,evBroadcast,cmUpdate,nil);
|
||||
@ -644,7 +647,13 @@ end;
|
||||
END.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.11 1999-02-08 10:37:44 peter
|
||||
Revision 1.12 1999-02-08 17:43:44 pierre
|
||||
* RestDebugger or multiple running of debugged program now works
|
||||
+ added DoContToCursor(F4)
|
||||
* Breakpoints are now inserted correctly (was mainlyy a problem
|
||||
of directories)
|
||||
|
||||
Revision 1.11 1999/02/08 10:37:44 peter
|
||||
+ html helpviewer
|
||||
|
||||
Revision 1.7 1999/02/04 13:32:03 pierre
|
||||
|
@ -22,14 +22,18 @@ begin
|
||||
InitDebugger;
|
||||
if not assigned(Debugger) then
|
||||
exit;
|
||||
Debugger^.StartTrace;
|
||||
end
|
||||
end;
|
||||
if not debugger^.debugger_started then
|
||||
Debugger^.StartTrace
|
||||
else
|
||||
Debugger^.TraceNext;
|
||||
Debugger^.TraceNext;
|
||||
While (Debugger^.InvalidSourceLine and
|
||||
Debugger^.Debugger_started and
|
||||
not Debugger^.error) do
|
||||
Debugger^.TraceNext;
|
||||
Debugger^.Debugger_started and
|
||||
not Debugger^.error) do
|
||||
begin
|
||||
Inc(Debugger^.HiddenStepsCount);
|
||||
Debugger^.TraceNext;
|
||||
end;
|
||||
Debugger^.AnnotateError;
|
||||
end;
|
||||
|
||||
@ -40,17 +44,21 @@ begin
|
||||
begin
|
||||
InitDebugger;
|
||||
if not assigned(Debugger) then
|
||||
exit;
|
||||
Debugger^.StartTrace;
|
||||
end
|
||||
exit;
|
||||
end;
|
||||
if not debugger^.debugger_started then
|
||||
Debugger^.StartTrace
|
||||
else
|
||||
Debugger^.TraceStep;
|
||||
{ I think we should not try to go deeper !
|
||||
if the source is not found PM }
|
||||
While (Debugger^.InvalidSourceLine and
|
||||
Debugger^.Debugger_started and
|
||||
not Debugger^.error) do
|
||||
Debugger^.TraceStep;
|
||||
Debugger^.Debugger_started and
|
||||
not Debugger^.error) do
|
||||
begin
|
||||
Inc(Debugger^.HiddenStepsCount);
|
||||
Debugger^.TraceNext;
|
||||
end;
|
||||
Debugger^.AnnotateError;
|
||||
end;
|
||||
|
||||
@ -113,6 +121,32 @@ procedure TIDEApp.DoResetDebugger;
|
||||
begin
|
||||
if assigned(Debugger) then
|
||||
DoneDebugger;
|
||||
UpdateScreen(true);
|
||||
end;
|
||||
|
||||
procedure TIDEApp.DoContToCursor;
|
||||
var
|
||||
W : PSourceWindow;
|
||||
FileName : string;
|
||||
LineNr : longint;
|
||||
begin
|
||||
if not assigned(DeskTop^.First) or
|
||||
(TypeOf(DeskTop^.First^)<>TypeOf(TSourceWindow)) then
|
||||
Begin
|
||||
ErrorBox('Impossible to reach current cursor',nil);
|
||||
Exit;
|
||||
End;
|
||||
|
||||
W:=PSourceWindow(DeskTop^.First);
|
||||
If assigned(W) then
|
||||
begin
|
||||
FileName:=W^.Editor^.FileName;
|
||||
LineNr:=W^.Editor^.CurPos.Y+1;
|
||||
If not assigned(Debugger) then
|
||||
InitDebugger;
|
||||
Debugger^.Command('tbreak '+NameAndExtOf(FileName)+':'+IntToStr(LineNr));
|
||||
Debugger^.Continue;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TIDEApp.DoToggleBreak;
|
||||
@ -149,7 +183,13 @@ end;
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.9 1999-02-05 17:21:53 pierre
|
||||
Revision 1.10 1999-02-08 17:43:45 pierre
|
||||
* RestDebugger or multiple running of debugged program now works
|
||||
+ added DoContToCursor(F4)
|
||||
* Breakpoints are now inserted correctly (was mainlyy a problem
|
||||
of directories)
|
||||
|
||||
Revision 1.9 1999/02/05 17:21:53 pierre
|
||||
Invalid_line renamed InvalidSourceLine
|
||||
|
||||
Revision 1.8 1999/02/04 17:56:17 pierre
|
||||
|
Loading…
Reference in New Issue
Block a user