Ver Fonte

+ added method BreakpointInsert to gdbcon, which supports the gdb/mi command for
adding breakpoints.
* use the new method for adding the breakpoint to FPC_BREAK_ERROR

git-svn-id: trunk@29744 -

nickysn há 10 anos atrás
pai
commit
4f8b8da879
3 ficheiros alterados com 19 adições e 4 exclusões
  1. 2 4
      ide/fpdebug.pas
  2. 10 0
      ide/gdbmicon.pas
  3. 7 0
      packages/gdbint/src/gdbcon.pp

+ 2 - 4
ide/fpdebug.pas

@@ -685,10 +685,8 @@ begin
       HasExe:=true;
       { Procedure HandleErrorAddrFrame
          (Errno : longint;addr,frame : longint);
-         [public,alias:'FPC_BREAK_ERROR'];
-      Command('b HANDLEERRORADDRFRAME'); }
-      Command('b FPC_BREAK_ERROR');
-      FPCBreakErrorNumber:=last_breakpoint_number;
+         [public,alias:'FPC_BREAK_ERROR'];}
+      FPCBreakErrorNumber:=BreakpointInsert('FPC_BREAK_ERROR');
 {$ifdef FrameNameKnown}
       { this fails in GDB 5.1 because
         GDB replies that there is an attempt to dereference

+ 10 - 0
ide/gdbmicon.pas

@@ -51,6 +51,7 @@ type
     procedure TraceNextI;
     procedure Continue; virtual;
     procedure UntilReturn; virtual;
+    function BreakpointInsert(const location: string): LongInt;
     procedure SetTBreak(tbreakstring : string);
     procedure Backtrace;
     function LoadFile(var fn: string): Boolean;
@@ -165,6 +166,15 @@ begin
   RunExecCommand('-exec-finish');
 end;
 
+function TGDBController.BreakpointInsert(const location: string): LongInt;
+begin
+  Command('-break-insert ' + location);
+  if GDB.ResultRecord.Success then
+    BreakpointInsert := GDB.ResultRecord.Parameters['bkpt'].AsTuple['number'].AsLongInt
+  else
+    BreakpointInsert := 0;
+end;
+
 procedure TGDBController.SetTBreak(tbreakstring : string);
 begin
   Command('-break-insert -t ' + tbreakstring);

+ 7 - 0
packages/gdbint/src/gdbcon.pp

@@ -49,6 +49,7 @@ type
     procedure TraceNextI;virtual;
     procedure Continue;virtual;
     procedure UntilReturn;virtual;
+    function BreakpointInsert(const location: string): LongInt;
     procedure SetTBreak(tbreakstring : string);
     procedure Backtrace;
     { needed for dos because newlines are only #10 (PM) }
@@ -304,6 +305,12 @@ begin
   Command('finish');
 end;
 
+function TGDBController.BreakpointInsert(const location: string): LongInt;
+begin
+  Command('break '+location);
+  BreakpointInsert:=Last_breakpoint_number;
+end;
+
 procedure TGDBController.SetTBreak(tbreakstring : string);
 begin
   Command('tbreak '+tbreakstring);