mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-11 20:29:14 +02:00
* first debugger things
This commit is contained in:
parent
54ee5f39ac
commit
b03f9282c6
@ -73,6 +73,8 @@ const
|
||||
cmGotoCursor = 223;
|
||||
cmToggleBreakpoint = 224;
|
||||
cmAddWatch = 225;
|
||||
cmTraceInto = 226;
|
||||
cmStepOver = 227;
|
||||
|
||||
cmNotImplemented = 1000;
|
||||
cmNewFromTemplate = 1001;
|
||||
@ -261,7 +263,10 @@ implementation
|
||||
END.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.6 1999-01-21 11:54:12 peter
|
||||
Revision 1.7 1999-01-22 10:24:02 peter
|
||||
* first debugger things
|
||||
|
||||
Revision 1.6 1999/01/21 11:54:12 peter
|
||||
+ tools menu
|
||||
+ speedsearch in symbolbrowser
|
||||
* working run command
|
||||
|
135
ide/text/fpdebug.pas
Normal file
135
ide/text/fpdebug.pas
Normal file
@ -0,0 +1,135 @@
|
||||
{
|
||||
$Id$
|
||||
This file is part of the Free Pascal Integrated Development Environment
|
||||
Copyright (c) 1998 by Berczi Gabor
|
||||
|
||||
Debugger call routines for the IDE
|
||||
|
||||
See the file COPYING.FPC, included in this distribution,
|
||||
for details about the copyright.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
**********************************************************************}
|
||||
unit FPDebug;
|
||||
interface
|
||||
|
||||
uses
|
||||
GDBCon;
|
||||
|
||||
type
|
||||
PDebugController=^TDebugController;
|
||||
TDebugController=object(TGDBController)
|
||||
constructor Init(const exefn:string);
|
||||
destructor Done;
|
||||
procedure DoSelectSourceline(const fn:string;line:longint);virtual;
|
||||
{ procedure DoStartSession;virtual;
|
||||
procedure DoBreakSession;virtual;
|
||||
procedure DoEndSession(code:longint);virtual; }
|
||||
procedure DoDebuggerScreen;virtual;
|
||||
procedure DoUserScreen;virtual;
|
||||
end;
|
||||
|
||||
var
|
||||
Debugger : PDebugController;
|
||||
|
||||
procedure InitDebugger;
|
||||
procedure DoneDebugger;
|
||||
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Dos,Mouse,Video,
|
||||
App,
|
||||
FPViews,FPVars,FPUtils,FPIntf,
|
||||
FPCompile,FPUsrScr;
|
||||
|
||||
|
||||
{****************************************************************************
|
||||
TDebugController
|
||||
****************************************************************************}
|
||||
|
||||
constructor TDebugController.Init(const exefn:string);
|
||||
begin
|
||||
inherited Init;
|
||||
LoadFile(exefn);
|
||||
end;
|
||||
|
||||
|
||||
destructor TDebugController.Done;
|
||||
begin
|
||||
inherited Done;
|
||||
end;
|
||||
|
||||
|
||||
procedure TDebugController.DoSelectSourceLine(const fn:string;line:longint);
|
||||
var
|
||||
W: PSourceWindow;
|
||||
begin
|
||||
Desktop^.Lock;
|
||||
if Line>0 then
|
||||
dec(Line);
|
||||
W:=TryToOpenFile(nil,fn,0,Line);
|
||||
if assigned(W) then
|
||||
begin
|
||||
W^.Editor^.SetHighlightRow(Line);
|
||||
W^.Select;
|
||||
end;
|
||||
Desktop^.UnLock;
|
||||
end;
|
||||
|
||||
|
||||
procedure TDebugController.DoDebuggerScreen;
|
||||
begin
|
||||
if assigned(UserScreen) then
|
||||
UserScreen^.SwitchBack;
|
||||
end;
|
||||
|
||||
|
||||
procedure TDebugController.DoUserScreen;
|
||||
begin
|
||||
if assigned(UserScreen) then
|
||||
UserScreen^.SwitchTo;
|
||||
end;
|
||||
|
||||
|
||||
{****************************************************************************
|
||||
Initialize
|
||||
****************************************************************************}
|
||||
|
||||
procedure InitDebugger;
|
||||
begin
|
||||
if (not ExistsFile(ExeFile)) or (CompilationPhase<>cpDone) then
|
||||
DoCompile(cRun);
|
||||
if CompilationPhase<>cpDone then
|
||||
Exit;
|
||||
if (EXEFile='') then
|
||||
begin
|
||||
ErrorBox('Oooops, nothing to debug.',nil);
|
||||
Exit;
|
||||
end;
|
||||
{ init debugcontroller }
|
||||
if assigned(Debugger) then
|
||||
dispose(Debugger,Done);
|
||||
new(Debugger,Init(ExeFile));
|
||||
end;
|
||||
|
||||
|
||||
procedure DoneDebugger;
|
||||
begin
|
||||
if assigned(Debugger) then
|
||||
dispose(Debugger,Done);
|
||||
end;
|
||||
|
||||
|
||||
end.
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.1 1999-01-22 10:24:03 peter
|
||||
* first debugger things
|
||||
|
||||
}
|
@ -42,6 +42,8 @@ type
|
||||
procedure Modules;
|
||||
procedure Globals;
|
||||
procedure Parameters;
|
||||
procedure DoStepOver;
|
||||
procedure DoTraceInto;
|
||||
procedure DoRun;
|
||||
procedure Target;
|
||||
procedure PrimaryFile_;
|
||||
@ -52,10 +54,10 @@ type
|
||||
procedure Calculator;
|
||||
procedure ExecuteTool(Idx: integer);
|
||||
procedure SetSwitchesMode;
|
||||
procedure Compiler;
|
||||
procedure DoCompilerSwitch;
|
||||
procedure MemorySizes;
|
||||
procedure Linker;
|
||||
procedure Debugger;
|
||||
procedure DoLinkerSwitch;
|
||||
procedure DoDebuggerSwitch;
|
||||
procedure Directories;
|
||||
procedure Tools;
|
||||
procedure EditorOptions(Editor: PEditor);
|
||||
@ -100,7 +102,7 @@ uses
|
||||
Systems,BrowCol,
|
||||
WHelp,WHlpView,WINI,
|
||||
FPConst,FPVars,FPUtils,FPSwitches,FPIni,FPIntf,FPCompile,FPHelp,
|
||||
FPTemplt,FPCalc,FPUsrScr,FPSymbol,FPTools;
|
||||
FPTemplt,FPCalc,FPUsrScr,FPSymbol,FPTools,FPDebug;
|
||||
|
||||
|
||||
function IDEUseSyntaxHighlight(Editor: PFileEditor): boolean; {$ifndef FPC}far;{$endif}
|
||||
@ -164,8 +166,10 @@ begin
|
||||
nil))))))))))),
|
||||
NewSubMenu('~R~un',hcRunMenu, NewMenu(
|
||||
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('P~a~rameters...','', kbNoKey, cmParameters, hcParameters,
|
||||
nil))),
|
||||
nil))))),
|
||||
NewSubMenu('~C~ompile',hcCompileMenu, NewMenu(
|
||||
NewItem('~C~ompile','Alt+F9', kbAltF9, cmCompile, hcCompile,
|
||||
NewItem('~M~ake','F9', kbF9, cmMake, hcMake,
|
||||
@ -310,6 +314,8 @@ begin
|
||||
cmGlobals : Globals;
|
||||
{ -- Run menu -- }
|
||||
cmParameters : Parameters;
|
||||
cmStepOver : DoStepOver;
|
||||
cmTraceInto : DoTraceInto;
|
||||
cmRun : DoRun;
|
||||
{ -- Compile menu -- }
|
||||
cmCompile : DoCompile(cCompile);
|
||||
@ -323,10 +329,10 @@ begin
|
||||
cmUserScreen : ShowUserScreen;
|
||||
{ -- Options menu -- }
|
||||
cmSwitchesMode : SetSwitchesMode;
|
||||
cmCompiler : Compiler;
|
||||
cmCompiler : DoCompilerSwitch;
|
||||
cmMemorySizes : MemorySizes;
|
||||
cmLinker : Linker;
|
||||
cmDebugger : Debugger;
|
||||
cmLinker : DoLinkerSwitch;
|
||||
cmDebugger : DoDebuggerSwitch;
|
||||
cmDirectories : Directories;
|
||||
cmTools : Tools;
|
||||
cmEditor : EditorOptions(nil);
|
||||
@ -596,7 +602,10 @@ end;
|
||||
END.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.3 1999-01-21 11:54:14 peter
|
||||
Revision 1.4 1999-01-22 10:24:03 peter
|
||||
* first debugger things
|
||||
|
||||
Revision 1.3 1999/01/21 11:54:14 peter
|
||||
+ tools menu
|
||||
+ speedsearch in symbolbrowser
|
||||
* working run command
|
||||
|
@ -57,7 +57,7 @@ begin
|
||||
Dispose(D, Done);
|
||||
end;
|
||||
|
||||
procedure TIDEApp.Compiler;
|
||||
procedure TIDEApp.DoCompilerSwitch;
|
||||
var R,R2,TabR,TabIR: TRect;
|
||||
D: PCenterDialog;
|
||||
CB1,CB2,CB3,CB4: PCheckBoxes;
|
||||
@ -271,7 +271,7 @@ begin
|
||||
Dispose(D, Done);
|
||||
end;
|
||||
|
||||
procedure TIDEApp.Linker;
|
||||
procedure TIDEApp.DoLinkerSwitch;
|
||||
var R,R2: TRect;
|
||||
D: PCenterDialog;
|
||||
RB2: PRadioButtons;
|
||||
@ -324,7 +324,7 @@ begin
|
||||
Dispose(D, Done);
|
||||
end;
|
||||
|
||||
procedure TIDEApp.Debugger;
|
||||
procedure TIDEApp.DoDebuggerSwitch;
|
||||
var R,R2: TRect;
|
||||
D: PCenterDialog;
|
||||
RB1,RB2: PRadioButtons;
|
||||
@ -673,7 +673,10 @@ end;
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.6 1999-01-21 11:54:19 peter
|
||||
Revision 1.7 1999-01-22 10:24:04 peter
|
||||
* first debugger things
|
||||
|
||||
Revision 1.6 1999/01/21 11:54:19 peter
|
||||
+ tools menu
|
||||
+ speedsearch in symbolbrowser
|
||||
* working run command
|
||||
|
@ -14,6 +14,35 @@
|
||||
|
||||
**********************************************************************}
|
||||
|
||||
|
||||
procedure TIDEApp.DoStepOver;
|
||||
begin
|
||||
if not assigned(Debugger) then
|
||||
begin
|
||||
InitDebugger;
|
||||
if not assigned(Debugger) then
|
||||
exit;
|
||||
Debugger^.StartTrace;
|
||||
end
|
||||
else
|
||||
Debugger^.TraceNext;
|
||||
end;
|
||||
|
||||
|
||||
procedure TIDEApp.DoTraceInto;
|
||||
begin
|
||||
if not assigned(Debugger) then
|
||||
begin
|
||||
InitDebugger;
|
||||
if not assigned(Debugger) then
|
||||
exit;
|
||||
Debugger^.StartTrace;
|
||||
end
|
||||
else
|
||||
Debugger^.TraceStep;
|
||||
end;
|
||||
|
||||
|
||||
procedure TIDEApp.DoRun;
|
||||
begin
|
||||
if (not ExistsFile(ExeFile)) or (CompilationPhase<>cpDone) then
|
||||
@ -37,6 +66,7 @@ begin
|
||||
LastExitCode:=DosExitCode;
|
||||
end;
|
||||
|
||||
|
||||
procedure TIDEApp.Parameters;
|
||||
var R,R2: TRect;
|
||||
D: PCenterDialog;
|
||||
@ -65,7 +95,10 @@ end;
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.5 1999-01-21 11:54:20 peter
|
||||
Revision 1.6 1999-01-22 10:24:05 peter
|
||||
* first debugger things
|
||||
|
||||
Revision 1.5 1999/01/21 11:54:20 peter
|
||||
+ tools menu
|
||||
+ speedsearch in symbolbrowser
|
||||
* working run command
|
||||
|
Loading…
Reference in New Issue
Block a user