Browse Source

+ added 16-bit int overloads for TGDBController.GetIntRegister. Useful for
e.g. getting the segment registers on x86.

git-svn-id: trunk@30113 -

nickysn 10 years ago
parent
commit
52d13e6ddb
2 changed files with 40 additions and 0 deletions
  1. 20 0
      ide/gdbmicon.pas
  2. 20 0
      packages/gdbint/src/gdbcon.pp

+ 20 - 0
ide/gdbmicon.pas

@@ -66,6 +66,8 @@ type
     function GetIntRegister(const RegName: string; var Value: Int64): 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: UInt32): Boolean;
     function GetIntRegister(const RegName: string; var Value: Int32): Boolean;
     function GetIntRegister(const RegName: string; var Value: Int32): Boolean;
+    function GetIntRegister(const RegName: string; var Value: UInt16): Boolean;
+    function GetIntRegister(const RegName: string; var Value: Int16): Boolean;
     { set command }
     { set command }
     function SetCommand(Const SetExpr : string) : boolean;
     function SetCommand(Const SetExpr : string) : boolean;
     { print }
     { print }
@@ -294,6 +296,24 @@ begin
   Value := Int32(U32Value);
   Value := Int32(U32Value);
 end;
 end;
 
 
+function TGDBController.GetIntRegister(const RegName: string; var Value: UInt16): Boolean;
+var
+  U64Value: UInt64;
+begin
+  GetIntRegister := GetIntRegister(RegName, U64Value);
+  Value := UInt16(U64Value);
+  if (U64Value shr 16) <> 0 then
+    GetIntRegister := False;
+end;
+
+function TGDBController.GetIntRegister(const RegName: string; var Value: Int16): Boolean;
+var
+  U16Value: UInt16;
+begin
+  GetIntRegister := GetIntRegister(RegName, U16Value);
+  Value := Int16(U16Value);
+end;
+
 
 
 { set command }
 { set command }
 function TGDBController.SetCommand(Const SetExpr : string) : boolean;
 function TGDBController.SetCommand(Const SetExpr : string) : boolean;

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

@@ -62,6 +62,8 @@ type
     function GetIntRegister(const RegName: string; var Value: Int64): 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: UInt32): Boolean;
     function GetIntRegister(const RegName: string; var Value: Int32): Boolean;
     function GetIntRegister(const RegName: string; var Value: Int32): Boolean;
+    function GetIntRegister(const RegName: string; var Value: UInt16): Boolean;
+    function GetIntRegister(const RegName: string; var Value: Int16): Boolean;
     { set command }
     { set command }
     function SetCommand(Const SetExpr : string) : boolean;
     function SetCommand(Const SetExpr : string) : boolean;
     { print }
     { print }
@@ -411,6 +413,24 @@ begin
   Value := Int32(U32Value);
   Value := Int32(U32Value);
 end;
 end;
 
 
+function TGDBController.GetIntRegister(const RegName: string; var Value: UInt16): Boolean;
+var
+  U64Value: UInt64;
+begin
+  GetIntRegister := GetIntRegister(RegName, U64Value);
+  Value := UInt16(U64Value);
+  if (U64Value shr 16) <> 0 then
+    GetIntRegister := False;
+end;
+
+function TGDBController.GetIntRegister(const RegName: string; var Value: Int16): Boolean;
+var
+  U16Value: UInt16;
+begin
+  GetIntRegister := GetIntRegister(RegName, U16Value);
+  Value := Int16(U16Value);
+end;
+
 { set command }
 { set command }
 function TGDBController.SetCommand(Const SetExpr : string) : boolean;
 function TGDBController.SetCommand(Const SetExpr : string) : boolean;
 begin
 begin