mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-22 09:19:32 +02:00
FpDebugServer: Added registers command
git-svn-id: trunk@49379 -
This commit is contained in:
parent
09f142aa09
commit
744810b288
@ -235,9 +235,14 @@ begin
|
||||
JSonArrayEntry := TJSONObject.Create;
|
||||
JSonArrayEntry.Add('name', AnEvent.WatchEntryArray[i].Expression);
|
||||
JSonArrayEntry.Add('value', AnEvent.WatchEntryArray[i].TextValue);
|
||||
if AnEvent.EventName='registers' then
|
||||
begin
|
||||
JSonArrayEntry.Add('numvalue', AnEvent.WatchEntryArray[i].NumValue);
|
||||
JSonArrayEntry.Add('size', AnEvent.WatchEntryArray[i].Size);
|
||||
end;
|
||||
JSonArray.Add(JSonArrayEntry);
|
||||
end;
|
||||
JSonEvent.Add('variables', JSonArray);
|
||||
JSonEvent.Add(AnEvent.EventName, JSonArray);
|
||||
end;
|
||||
result := JSonEvent.AsJSON;
|
||||
finally
|
||||
|
@ -51,6 +51,8 @@ type
|
||||
TFpDebugEventWatchEntry = record
|
||||
TextValue: string;
|
||||
Expression: string;
|
||||
NumValue: TDBGPtr;
|
||||
Size: byte;
|
||||
end;
|
||||
|
||||
TFpDebugEventCallStackEntryArray = array of TFpDebugEventCallStackEntry;
|
||||
|
@ -236,12 +236,58 @@ type
|
||||
procedure ComposeSuccessEvent(var AnEvent: TFpDebugEvent); override;
|
||||
end;
|
||||
|
||||
{ TFpDebugRegistersCommand }
|
||||
|
||||
TFpDebugRegistersCommand = class(TFpDebugThreadCommand)
|
||||
private
|
||||
FWatchEntryArray: TFpDebugEventWatchEntryArray;
|
||||
public
|
||||
function Execute(AController: TDbgController; out DoProcessLoop: boolean): boolean; override;
|
||||
class function TextName: string; override;
|
||||
procedure ComposeSuccessEvent(var AnEvent: TFpDebugEvent); override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
FpDbgDisasX86;
|
||||
|
||||
{ TFpDebugRegistersCommand }
|
||||
|
||||
function TFpDebugRegistersCommand.Execute(AController: TDbgController; out DoProcessLoop: boolean): boolean;
|
||||
var
|
||||
ARegisterList: TDbgRegisterValueList;
|
||||
i: Integer;
|
||||
begin
|
||||
result := false;
|
||||
if (AController = nil) or (AController.CurrentProcess = nil) or
|
||||
(AController.CurrentProcess.DbgInfo = nil) then
|
||||
exit;
|
||||
|
||||
ARegisterList := AController.CurrentProcess.MainThread.RegisterValueList;
|
||||
SetLength(FWatchEntryArray, ARegisterList.Count);
|
||||
for i := 0 to ARegisterList.Count-1 do
|
||||
begin
|
||||
FWatchEntryArray[i].Expression := ARegisterList[i].Name;
|
||||
FWatchEntryArray[i].TextValue := ARegisterList[i].StrValue;
|
||||
FWatchEntryArray[i].NumValue := ARegisterList[i].NumValue;
|
||||
FWatchEntryArray[i].Size := ARegisterList[i].Size;
|
||||
end;
|
||||
result := true;
|
||||
DoProcessLoop := false;
|
||||
end;
|
||||
|
||||
class function TFpDebugRegistersCommand.TextName: string;
|
||||
begin
|
||||
result := 'registers';
|
||||
end;
|
||||
|
||||
procedure TFpDebugRegistersCommand.ComposeSuccessEvent(var AnEvent: TFpDebugEvent);
|
||||
begin
|
||||
inherited ComposeSuccessEvent(AnEvent);
|
||||
AnEvent.WatchEntryArray := FWatchEntryArray;
|
||||
end;
|
||||
|
||||
{ TFpDebugLocalsCommand }
|
||||
|
||||
function TFpDebugLocalsCommand.Execute(AController: TDbgController; out DoProcessLoop: boolean): boolean;
|
||||
@ -980,6 +1026,7 @@ initialization
|
||||
TFpDebugThreadCommandList.instance.Add(TFpDebugThreadStackTraceCommand);
|
||||
TFpDebugThreadCommandList.instance.Add(TFpDebugThreadDisassembleCommand);
|
||||
TFpDebugThreadCommandList.instance.Add(TFpDebugLocalsCommand);
|
||||
TFpDebugThreadCommandList.instance.Add(TFpDebugRegistersCommand);
|
||||
finalization
|
||||
GFpDebugThreadCommandList.Free;
|
||||
end.
|
||||
|
Loading…
Reference in New Issue
Block a user