From 1c5be35315639d6214103fb59c7dc9c7984ac4ce Mon Sep 17 00:00:00 2001 From: pierre Date: Tue, 3 Mar 2015 21:44:07 +0000 Subject: [PATCH] fpdebug.pas: + Add code to handle GDBRawBuf if GDB_RAW_OUTPUT macro is defined. + Use SelectFrameCommand method instead of Command('f '+... + Remove /x modifer from getValue for FreamNameKnown code inside TWatch.Get_new_value; fpviews.pas: + Also use correct address size in AddDisassemblyLine * Replace 'set sym on' by 'set symbol on' to avoid mi error * Use /m modifier for disassembly to get also source code lines + Recognize '=> ' current pc indicator inside TDisassemblyWindow.ProcessPChar git-svn-id: trunk@30089 - --- ide/fpdebug.pas | 24 ++++++++++++++++++------ ide/fpviews.pas | 18 ++++++++++++------ 2 files changed, 30 insertions(+), 12 deletions(-) diff --git a/ide/fpdebug.pas b/ide/fpdebug.pas index b7d7b47307..2321fe4629 100644 --- a/ide/fpdebug.pas +++ b/ide/fpdebug.pas @@ -1106,6 +1106,14 @@ begin gdberrorbuf.reset; end; +{$ifdef GDB_RAW_OUTPUT} + If StrLen(GetRaw)>0 then + begin + GDBWindow^.WriteOutputText(GetRaw); + if in_command=0 then + gdbrawbuf.reset; + end; +{$endif GDB_RAW_OUTPUT} If StrLen(GetOutput)>0 then begin GDBWindow^.WriteOutputText(GetOutput); @@ -1126,6 +1134,10 @@ begin { We should do something special for errors !! } If StrLen(GetError)>0 then GDBWindow^.WriteErrorText(GetError); +{$ifdef GDB_RAW_OUTPUT} + If StrLen(GetRaw)>0 then + GDBWindow^.WriteOutputText(GetRaw); +{$endif GDB_RAW_OUTPUT} GDBWindow^.WriteOutputText(GetOutput); GDBWindow^.Editor^.TextEnd; end; @@ -1343,8 +1355,8 @@ begin begin if ExitAddr=address then begin - Command('f '+IntToStr(i)); - if assigned(file_name) then + if SelectFrameCommand(i) and + assigned(file_name) then begin s:=strpas(file_name); line:=line_number; @@ -2925,9 +2937,9 @@ procedure TWatch.Get_new_value; if not Debugger^.set_current_frame(curframe) then loop_higher:=false; {$ifdef FrameNameKnown} - s2:='/x '+FrameName; + s2:=FrameName; {$else not FrameNameKnown} - s2:='/x $ebp'; + s2:='$ebp'; {$endif FrameNameKnown} if not getValue(s2) then loop_higher:=false; @@ -3565,7 +3577,7 @@ end; { select frame for watches } If not assigned(Debugger) then exit; - Debugger^.Command('f '+IntToStr(Focused)); + Debugger^.SelectFrameCommand(Focused); { for local vars } Debugger^.RereadWatches; {$endif NODEBUG} @@ -3579,7 +3591,7 @@ end; { select frame for watches } If not assigned(Debugger) then exit; - Debugger^.Command('f '+IntToStr(Focused)); + Debugger^.SelectFrameCommand(Focused); { for local vars } Debugger^.RereadWatches; {$endif} diff --git a/ide/fpviews.pas b/ide/fpviews.pas index 30cc647d00..6445d26b37 100644 --- a/ide/fpviews.pas +++ b/ide/fpviews.pas @@ -2696,7 +2696,7 @@ var LI : PEditorLineInfo; begin if AAddress<>0 then - inherited AddLine('$'+hexstr(AAddress,sizeof(PtrUInt)*2)+S) + inherited AddLine('$'+hexstr(AAddress,sizeof(CORE_ADDR)*2)+S) else inherited AddLine(S); PL:=DisasLines^.At(DisasLines^.count-1); @@ -2765,9 +2765,9 @@ var begin {$ifndef NODEBUG} If not assigned(Debugger) then Exit; - Debugger^.SetCommand('print sym on'); + Debugger^.SetCommand('print symbol on'); Debugger^.SetCommand('width 0xffffffff'); - Debugger^.Command('disas '+FuncName); + Debugger^.Command('disas /m '+FuncName); p:=StrNew(Debugger^.GetOutput); ProcessPChar(p); if (Debugger^.IsRunning) and (FuncName='') then @@ -2781,9 +2781,9 @@ var begin {$ifndef NODEBUG} If not assigned(Debugger) then Exit; - Debugger^.SetCommand('print sym on'); + Debugger^.SetCommand('print symbol on'); Debugger^.SetCommand('width 0xffffffff'); - Debugger^.Command('disas 0x'+HexStr(Addr,8)); + Debugger^.Command('disas /m 0x'+HexStr(Addr,sizeof(Addr)*2)); p:=StrNew(Debugger^.GetOutput); ProcessPChar(p); if Debugger^.IsRunning and @@ -2820,7 +2820,7 @@ begin pline:=strscan(p,#10); if assigned(pline) then pline^:=#0; - line:=strpas(p); + line:=trim(strpas(p)); CurAddr:=0; if assigned(pline) then begin @@ -2830,6 +2830,12 @@ begin else p:=nil; { now process the line } + { Remove current position marker } + if copy(line,1,3)='=> ' then + begin + system.delete(line,1,3); + end; + { line is hexaddr assembly } pos1:=pos('<',line); if pos1>0 then