|
@@ -51,6 +51,7 @@ type
|
|
|
HasExe : boolean;
|
|
|
RunCount : longint;
|
|
|
WindowWidth : longint;
|
|
|
+ TBreakNumber : longint;
|
|
|
FPCBreakErrorNumber : longint;
|
|
|
{$ifdef SUPPORT_REMOTE}
|
|
|
isRemoteDebugging:boolean;
|
|
@@ -65,6 +66,9 @@ type
|
|
|
procedure DoBreakSession;virtual;}
|
|
|
procedure DoEndSession(code:longint);virtual;
|
|
|
procedure DoUserSignal;virtual;
|
|
|
+ procedure FlushAll; virtual;
|
|
|
+ function Query(question : pchar; args : pchar) : longint; virtual;
|
|
|
+
|
|
|
procedure AnnotateError;
|
|
|
procedure InsertBreakpoints;
|
|
|
procedure RemoveBreakpoints;
|
|
@@ -201,8 +205,6 @@ type
|
|
|
|
|
|
PWatch = ^TWatch;
|
|
|
TWatch = Object(TObject)
|
|
|
- expr : pstring;
|
|
|
- last_value,current_value : pchar;
|
|
|
constructor Init(s : string);
|
|
|
constructor Load(var S: TStream);
|
|
|
procedure Store(var S: TStream);
|
|
@@ -210,6 +212,8 @@ type
|
|
|
procedure Get_new_value;
|
|
|
procedure Force_new_value;
|
|
|
destructor done;virtual;
|
|
|
+ expr : pstring;
|
|
|
+ last_value,current_value : pchar;
|
|
|
private
|
|
|
GDBRunCount : longint;
|
|
|
end;
|
|
@@ -334,8 +338,10 @@ uses
|
|
|
{$ifdef DOS}
|
|
|
fpusrscr,
|
|
|
{$endif DOS}
|
|
|
+
|
|
|
App,Strings,
|
|
|
FVConsts,
|
|
|
+ MsgBox,
|
|
|
{$ifdef Windows}
|
|
|
Windebug,
|
|
|
{$endif Windows}
|
|
@@ -648,7 +654,15 @@ begin
|
|
|
begin
|
|
|
LoadFile(f);
|
|
|
HasExe:=true;
|
|
|
+ { Procedure HandleErrorAddrFrame
|
|
|
+ (Errno : longint;addr,frame : longint);
|
|
|
+ [public,alias:'FPC_BREAK_ERROR']; }
|
|
|
+ {
|
|
|
+ Command('b HANDLEERRORADDRFRAME');
|
|
|
+ this would only work if RTL is compiled with debug information
|
|
|
+ PM 2009/11/03 }
|
|
|
Command('b FPC_BREAK_ERROR');
|
|
|
+ { But this apparently sometimes also fails :( }
|
|
|
FPCBreakErrorNumber:=last_breakpoint_number;
|
|
|
{$ifdef FrameNameKnown}
|
|
|
{ this fails in GDB 5.1 because
|
|
@@ -826,6 +840,8 @@ begin
|
|
|
PopStatus;
|
|
|
exit;
|
|
|
end;
|
|
|
+ s:=IDEApp.GetRemoteExecString;
|
|
|
+ MessageBox(#3'Start in remote'#13#3+s,nil,mfOKbutton);
|
|
|
PopStatus;
|
|
|
end
|
|
|
else
|
|
@@ -941,6 +957,76 @@ begin
|
|
|
GDBWindow^.WriteString(S);
|
|
|
end;
|
|
|
|
|
|
+function TDebugController.Query(question : pchar; args : pchar) : longint;
|
|
|
+var
|
|
|
+ c : char;
|
|
|
+ WasModal : boolean;
|
|
|
+ ModalView : PView;
|
|
|
+ res : longint;
|
|
|
+begin
|
|
|
+ if not assigned(Application) then
|
|
|
+ begin
|
|
|
+ system.Write(question);
|
|
|
+ repeat
|
|
|
+ system.write('(y or n)');
|
|
|
+ system.read(c);
|
|
|
+ system.writeln(c);
|
|
|
+ until (lowercase(c)='y') or (lowercase(c)='n');
|
|
|
+ if lowercase(c)='y' then
|
|
|
+ query:=1
|
|
|
+ else
|
|
|
+ query:=0;
|
|
|
+ exit;
|
|
|
+ end;
|
|
|
+ if assigned(Application^.Current) and
|
|
|
+ ((Application^.Current^.State and sfModal)<>0) then
|
|
|
+ begin
|
|
|
+ WasModal:=true;
|
|
|
+ ModalView:=Application^.Current;
|
|
|
+ ModalView^.SetState(sfModal, false);
|
|
|
+ ModalView^.Hide;
|
|
|
+ end
|
|
|
+ else
|
|
|
+ WasModal:=false;
|
|
|
+ PushStatus(Question);
|
|
|
+ res:=MessageBox(Question,nil,mfyesbutton+mfnobutton);
|
|
|
+ PopStatus;
|
|
|
+ if res=cmYes then
|
|
|
+ Query:=1
|
|
|
+ else
|
|
|
+ Query:=0;
|
|
|
+ if WasModal then
|
|
|
+ begin
|
|
|
+ ModalView^.Show;
|
|
|
+ ModalView^.SetState(sfModal, true);
|
|
|
+ ModalView^.Draw;
|
|
|
+ end;
|
|
|
+end;
|
|
|
+
|
|
|
+procedure TDebugController.FlushAll;
|
|
|
+begin
|
|
|
+ if assigned(GDBWindow) then
|
|
|
+ begin
|
|
|
+ If StrLen(GetError)>0 then
|
|
|
+ begin
|
|
|
+ GDBWindow^.WriteErrorText(GetError);
|
|
|
+ if in_command=0 then
|
|
|
+ gdberrorbuf.reset;
|
|
|
+ end;
|
|
|
+
|
|
|
+ If StrLen(GetOutput)>0 then
|
|
|
+ begin
|
|
|
+ GDBWindow^.WriteOutputText(GetOutput);
|
|
|
+ { Keep output for command results }
|
|
|
+ if in_command=0 then
|
|
|
+ gdboutputbuf.reset;
|
|
|
+ end;
|
|
|
+ end
|
|
|
+ else
|
|
|
+ Inherited FlushAll;
|
|
|
+end;
|
|
|
+
|
|
|
+
|
|
|
procedure TDebugController.CommandEnd(const s:string);
|
|
|
begin
|
|
|
if assigned(GDBWindow) and (in_command<=1) then
|
|
@@ -1269,7 +1355,13 @@ begin
|
|
|
end
|
|
|
else if not assigned(PB) then
|
|
|
begin
|
|
|
- WarningBox(#3'Stopped by breakpoint '+IntToStr(BreakIndex),nil);
|
|
|
+ if (BreakIndex<>start_break_number) and
|
|
|
+ (BreakIndex<>TbreakNumber) then
|
|
|
+ WarningBox(#3'Stopped by breakpoint '+IntToStr(BreakIndex),nil);
|
|
|
+ if BreakIndex=start_break_number then
|
|
|
+ start_break_number:=0;
|
|
|
+ if BreakIndex=TbreakNumber then
|
|
|
+ TbreakNumber:=0;
|
|
|
end
|
|
|
{ For watch we should get old and new value !! }
|
|
|
else if (Not assigned(GDBWindow) or not GDBWindow^.GetState(sfActive)) and
|
|
@@ -3508,15 +3600,17 @@ end;
|
|
|
|
|
|
function GetGDBTargetShortName : string;
|
|
|
begin
|
|
|
+{$ifndef CROSSGDB}
|
|
|
+GetGDBTargetShortName:=source_info.shortname;
|
|
|
+{$else CROSSGDB}
|
|
|
{$ifdef SUPPORT_REMOTE}
|
|
|
{$ifdef PALMOSGDB}
|
|
|
GetGDBTargetShortName:='palmos';
|
|
|
{$else}
|
|
|
GetGDBTargetShortName:='linux';
|
|
|
{$endif PALMOSGDB}
|
|
|
-{$else not SUPPORT_REMOTE}
|
|
|
-GetGDBTargetShortName:=source_info.shortname
|
|
|
{$endif not SUPPORT_REMOTE}
|
|
|
+{$endif CROSSGDB}
|
|
|
end;
|
|
|
|
|
|
procedure InitDebugger;
|