فهرست منبع

* handle failure in GetFPCBreakErrorParameters and continue execution silently
in a gdb/mi safe way

git-svn-id: trunk@30020 -

nickysn 10 سال پیش
والد
کامیت
c62f3ec271
3فایلهای تغییر یافته به همراه25 افزوده شده و 18 حذف شده
  1. 9 8
      ide/fpdebug.pas
  2. 8 3
      ide/gdbmiint.pas
  3. 8 7
      packages/gdbint/src/gdbint.pp

+ 9 - 8
ide/fpdebug.pas

@@ -70,7 +70,7 @@ type
     procedure SetWidth(AWidth : longint);
     procedure SetSourceDirs;
     destructor  Done;
-    procedure DoSelectSourceline(const fn:string;line,BreakIndex:longint);virtual;
+    function DoSelectSourceline(const fn:string;line,BreakIndex:longint): Boolean;virtual;
 {    procedure DoStartSession;virtual;
     procedure DoBreakSession;virtual;}
     procedure DoEndSession(code:longint);virtual;
@@ -1346,7 +1346,7 @@ begin
 {$endif}
 end;
 
-procedure TDebugController.DoSelectSourceLine(const fn:string;line,BreakIndex:longint);
+function TDebugController.DoSelectSourceLine(const fn:string;line,BreakIndex:longint): Boolean;
 var
   W: PSourceWindow;
   Found : boolean;
@@ -1368,12 +1368,6 @@ begin
     begin
       if GetFPCBreakErrorParameters(ExitCode, ExitAddr, ExitFrame) then
       begin
-        if (ExitCode=0) and (ExitAddr=0) then
-          begin
-            Desktop^.Unlock;
-            Command('continue');
-            exit;
-          end;
         Backtrace;
         for i:=0 to frame_count-1 do
           begin
@@ -1392,6 +1386,12 @@ begin
                   end;
               end;
           end;
+      end
+      else
+      begin
+        Desktop^.Unlock;
+        DoSelectSourceLine := False;
+        exit;
       end;
     end;
   { Update Disassembly position }
@@ -1520,6 +1520,7 @@ begin
                #3+' value = '+GetStr(PB^.CurrentValue),nil);
         end;
     end;
+  DoSelectSourceLine := True;
 end;
 
 procedure TDebugController.DoUserSignal;

+ 8 - 3
ide/gdbmiint.pas

@@ -100,7 +100,7 @@ type
     procedure FlushAll; virtual;
     function Query(question: PChar; args: PChar): LongInt; virtual;
     { Hooks }
-    procedure DoSelectSourceline(const fn: string; line, BreakIndex: longint);virtual;
+    function DoSelectSourceline(const fn: string; line, BreakIndex: longint): Boolean;virtual;
     procedure DoStartSession; virtual;
     procedure DoBreakSession; virtual;
     procedure DoEndSession(code: LongInt); virtual;
@@ -359,7 +359,12 @@ Ignore:
 
         Debuggee_started := True;
         current_pc := Addr;
-        DoSelectSourceLine(FileName, LineNumber, BreakpointNo);
+        if not DoSelectSourceLine(FileName, LineNumber, BreakpointNo) then
+        begin
+          UserScreen;
+          i_gdb_command('-exec-continue');
+          goto Ignore;
+        end;
       end;
     'exited-signalled':
       begin
@@ -476,7 +481,7 @@ begin
   Query := 0;
 end;
 
-procedure TGDBInterface.DoSelectSourceline(const fn: string; line, BreakIndex: LongInt);
+function TGDBInterface.DoSelectSourceline(const fn: string; line, BreakIndex: LongInt): Boolean;
 begin
 end;
 

+ 8 - 7
packages/gdbint/src/gdbint.pp

@@ -933,7 +933,7 @@ type
     procedure clear_frames;
     { Highlevel }
     procedure GetAddrSyminfo(addr:ptrint;var si:tsyminfo);
-    procedure SelectSourceline(fn:pchar;line,BreakIndex:longint);
+    function SelectSourceline(fn:pchar;line,BreakIndex:longint): Boolean;
     procedure StartSession;
     procedure BreakSession;
     procedure EndSession(code:longint);
@@ -942,7 +942,7 @@ type
     procedure FlushAll; virtual;
     function Query(question : pchar; args : pchar) : longint; virtual;
     { Hooks }
-    procedure DoSelectSourceline(const fn:string;line,BreakIndex:longint);virtual;
+    function DoSelectSourceline(const fn:string;line,BreakIndex:longint): Boolean;virtual;
     procedure DoStartSession;virtual;
     procedure DoBreakSession;virtual;
     procedure DoEndSession(code:longint);virtual;
@@ -2153,7 +2153,8 @@ begin
       fname:=sym.symtab^.filename
      else
       fname:=nil;
-     SelectSourceLine(fname,sym.line,stop_breakpoint_number);
+     if not SelectSourceLine(fname,sym.line,stop_breakpoint_number) then
+       gdb_command('continue');
    end;
 end;
 
@@ -3207,12 +3208,12 @@ begin
 end;
 
 
-procedure tgdbinterface.SelectSourceLine(fn:pchar;line,BreakIndex:longint);
+function tgdbinterface.SelectSourceLine(fn:pchar;line,BreakIndex:longint): Boolean;
 begin
   if assigned(fn) then
-   DoSelectSourceLine(StrPas(fn),line,BreakIndex)
+    SelectSourceLine:=DoSelectSourceLine(StrPas(fn),line,BreakIndex)
   else
-   DoSelectSourceLine('',line,BreakIndex);
+    SelectSourceLine:=DoSelectSourceLine('',line,BreakIndex);
 end;
 
 
@@ -3274,7 +3275,7 @@ end;
           Default Hooks
 ---------------------------------------}
 
-procedure tgdbinterface.DoSelectSourceLine(const fn:string;line,BreakIndex:longint);
+function tgdbinterface.DoSelectSourceLine(const fn:string;line,BreakIndex:longint): Boolean;
 {$ifdef Verbose}
 var
   s,bs : string;