|
@@ -52,6 +52,12 @@ type
|
|
|
procedure TraceNextI;virtual;
|
|
|
procedure Continue;virtual;
|
|
|
procedure UntilReturn;virtual;
|
|
|
+ { registers }
|
|
|
+ function GetIntRegister(const RegName: string; var Value: UInt64): Boolean;
|
|
|
+ function GetIntRegister(const RegName: string; var Value: Int64): Boolean;
|
|
|
+ function GetIntRegister(const RegName: string; var Value: UInt32): Boolean;
|
|
|
+ function GetIntRegister(const RegName: string; var Value: Int32): Boolean;
|
|
|
+ { breakpoints }
|
|
|
function BreakpointInsert(const location: string; BreakpointFlags: TBreakpointFlags): LongInt;
|
|
|
function WatchpointInsert(const location: string; WatchpointType: TWatchpointType): LongInt;
|
|
|
function BreakpointDelete(BkptNo: LongInt): Boolean;
|
|
@@ -314,6 +320,83 @@ begin
|
|
|
Command('finish');
|
|
|
end;
|
|
|
|
|
|
+function TGDBController.GetIntRegister(const RegName: string; var Value: UInt64): Boolean;
|
|
|
+var
|
|
|
+ RegValueStr: string;
|
|
|
+ Code: LongInt;
|
|
|
+ p, po, p1: PChar;
|
|
|
+ buffer: array [0..255] of char;
|
|
|
+begin
|
|
|
+ GetIntRegister := False;
|
|
|
+ Value := 0;
|
|
|
+ Command('info registers ' + RegName);
|
|
|
+ if Error then
|
|
|
+ exit;
|
|
|
+
|
|
|
+ po:=StrNew(GetOutput);
|
|
|
+ p:=po;
|
|
|
+ if not assigned(p) then
|
|
|
+ exit;
|
|
|
+
|
|
|
+ p1:=strscan(p,' ');
|
|
|
+ if not assigned(p1) then
|
|
|
+ begin
|
|
|
+ StrDispose(po);
|
|
|
+ exit;
|
|
|
+ end;
|
|
|
+
|
|
|
+ p1:=strscan(p,'$');
|
|
|
+ { some targets use 0x instead of $ }
|
|
|
+ if p1=nil then
|
|
|
+ p:=strpos(p,'0x')
|
|
|
+ else
|
|
|
+ p:=p1;
|
|
|
+ p1:=strscan(p,#9);
|
|
|
+ if p1=nil then
|
|
|
+ begin
|
|
|
+ StrDispose(po);
|
|
|
+ exit;
|
|
|
+ end;
|
|
|
+ strlcopy(buffer,p,p1-p);
|
|
|
+ RegValueStr:=strpas(buffer);
|
|
|
+ Dispose(po);
|
|
|
+
|
|
|
+ { replace the $? }
|
|
|
+ if copy(RegValueStr,1,2)='0x' then
|
|
|
+ RegValueStr:='$'+copy(RegValueStr,3,length(RegValueStr)-2);
|
|
|
+
|
|
|
+ Val(RegValueStr, Value, Code);
|
|
|
+ if Code <> 0 then
|
|
|
+ exit;
|
|
|
+ GetIntRegister := True;
|
|
|
+end;
|
|
|
+
|
|
|
+function TGDBController.GetIntRegister(const RegName: string; var Value: Int64): Boolean;
|
|
|
+var
|
|
|
+ U64Value: UInt64;
|
|
|
+begin
|
|
|
+ GetIntRegister := GetIntRegister(RegName, U64Value);
|
|
|
+ Value := Int64(U64Value);
|
|
|
+end;
|
|
|
+
|
|
|
+function TGDBController.GetIntRegister(const RegName: string; var Value: UInt32): Boolean;
|
|
|
+var
|
|
|
+ U64Value: UInt64;
|
|
|
+begin
|
|
|
+ GetIntRegister := GetIntRegister(RegName, U64Value);
|
|
|
+ Value := UInt32(U64Value);
|
|
|
+ if (U64Value shr 32) <> 0 then
|
|
|
+ GetIntRegister := False;
|
|
|
+end;
|
|
|
+
|
|
|
+function TGDBController.GetIntRegister(const RegName: string; var Value: Int32): Boolean;
|
|
|
+var
|
|
|
+ U32Value: UInt32;
|
|
|
+begin
|
|
|
+ GetIntRegister := GetIntRegister(RegName, U32Value);
|
|
|
+ Value := Int32(U32Value);
|
|
|
+end;
|
|
|
+
|
|
|
function TGDBController.BreakpointInsert(const location: string; BreakpointFlags: TBreakpointFlags): LongInt;
|
|
|
var
|
|
|
Prefix: string = '';
|