فهرست منبع

+ added breakpoint flags parameter to TGDBController.BreakpointInsert. The
supported flags are 'temporary' and 'hardware' breakpoint.

git-svn-id: trunk@29763 -

nickysn 10 سال پیش
والد
کامیت
a445b4730b
3فایلهای تغییر یافته به همراه24 افزوده شده و 10 حذف شده
  1. 4 4
      ide/fpdebug.pas
  2. 10 3
      ide/gdbmicon.pas
  3. 10 3
      packages/gdbint/src/gdbcon.pp

+ 4 - 4
ide/fpdebug.pas

@@ -686,7 +686,7 @@ begin
       { Procedure HandleErrorAddrFrame
          (Errno : longint;addr,frame : longint);
          [public,alias:'FPC_BREAK_ERROR'];}
-      FPCBreakErrorNumber:=BreakpointInsert('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
@@ -1778,11 +1778,11 @@ begin
   if (GDBState=bs_deleted) and (state=bs_enabled) then
     begin
       if (typ=bt_file_line) and assigned(FileName) then
-        bkpt_no := Debugger^.BreakpointInsert(GDBFileName(NameAndExtOf(GetStr(FileName)))+':'+IntToStr(Line))
+        bkpt_no := Debugger^.BreakpointInsert(GDBFileName(NameAndExtOf(GetStr(FileName)))+':'+IntToStr(Line), [])
       else if (typ=bt_function) and assigned(name) then
-        bkpt_no := Debugger^.BreakpointInsert(name^)
+        bkpt_no := Debugger^.BreakpointInsert(name^, [])
       else if (typ=bt_address) and assigned(name) then
-        bkpt_no := Debugger^.BreakpointInsert('*0x'+name^)
+        bkpt_no := Debugger^.BreakpointInsert('*0x'+name^, [])
       else if (typ=bt_watch) and assigned(name) then
         bkpt_no := Debugger^.WatchpointInsert(name^, wtWrite)
       else if (typ=bt_awatch) and assigned(name) then

+ 10 - 3
ide/gdbmicon.pas

@@ -25,6 +25,7 @@ uses
   gdbmiint, gdbmiwrap;
 
 type
+  TBreakpointFlags = set of (bfTemporary, bfHardware);
   TWatchpointType = (wtWrite, wtReadWrite, wtRead);
 
   TGDBController = object(TGDBInterface)
@@ -53,7 +54,7 @@ type
     procedure TraceNextI;
     procedure Continue; virtual;
     procedure UntilReturn; virtual;
-    function BreakpointInsert(const location: string): LongInt;
+    function BreakpointInsert(const location: string; BreakpointFlags: TBreakpointFlags): LongInt;
     function WatchpointInsert(const location: string; WatchpointType: TWatchpointType): LongInt;
     procedure SetTBreak(tbreakstring : string);
     procedure Backtrace;
@@ -169,9 +170,15 @@ begin
   RunExecCommand('-exec-finish');
 end;
 
-function TGDBController.BreakpointInsert(const location: string): LongInt;
+function TGDBController.BreakpointInsert(const location: string; BreakpointFlags: TBreakpointFlags): LongInt;
+var
+  Options: string = '';
 begin
-  Command('-break-insert ' + location);
+  if bfTemporary in BreakpointFlags then
+    Options := Options + '-t ';
+  if bfHardware in BreakpointFlags then
+    Options := Options + '-h ';
+  Command('-break-insert ' + Options + location);
   if GDB.ResultRecord.Success then
     BreakpointInsert := GDB.ResultRecord.Parameters['bkpt'].AsTuple['number'].AsLongInt
   else

+ 10 - 3
packages/gdbint/src/gdbcon.pp

@@ -25,6 +25,7 @@ uses
   GDBInt;
 
 type
+  TBreakpointFlags = set of (bfTemporary, bfHardware);
   TWatchpointType = (wtWrite, wtReadWrite, wtRead);
 
   PGDBController=^TGDBController;
@@ -51,7 +52,7 @@ type
     procedure TraceNextI;virtual;
     procedure Continue;virtual;
     procedure UntilReturn;virtual;
-    function BreakpointInsert(const location: string): LongInt;
+    function BreakpointInsert(const location: string; BreakpointFlags: TBreakpointFlags): LongInt;
     function WatchpointInsert(const location: string; WatchpointType: TWatchpointType): LongInt;
     procedure SetTBreak(tbreakstring : string);
     procedure Backtrace;
@@ -308,10 +309,16 @@ begin
   Command('finish');
 end;
 
-function TGDBController.BreakpointInsert(const location: string): LongInt;
+function TGDBController.BreakpointInsert(const location: string; BreakpointFlags: TBreakpointFlags): LongInt;
+var
+  Prefix: string = '';
 begin
+  if bfTemporary in BreakpointFlags then
+    Prefix:=Prefix+'t';
+  if bfHardware in BreakpointFlags then
+    Prefix:=Prefix+'h';
   Last_breakpoint_number:=0;
-  Command('break '+location);
+  Command(Prefix+'break '+location);
   BreakpointInsert:=Last_breakpoint_number;
 end;