Add TGDBController.SetCommand method and use it

git-svn-id: trunk@30046 -
This commit is contained in:
pierre 2015-03-01 17:00:16 +00:00
parent 5f66d63335
commit caa77e1f8d
4 changed files with 38 additions and 11 deletions

View File

@ -668,12 +668,12 @@ begin
WindowWidth:=-1;
switch_to_user:=true;
GetDir(0,OrigPwd);
Command('set print object off');
SetCommand('print object off');
{$ifdef SUPPORT_REMOTE}
isFirstRemote:=true;
{$ifdef FPC_ARMEL32}
{ GDB needs advice on exact file type }
Command('set gnutarget elf32-littlearm');
SetCommand('gnutarget elf32-littlearm');
{$endif FPC_ARMEL32}
{$endif SUPPORT_REMOTE}
end;
@ -728,7 +728,7 @@ end;
procedure TDebugController.SetWidth(AWidth : longint);
begin
WindowWidth:=AWidth;
Command('set width '+inttostr(WindowWidth));
SetCommand('width '+inttostr(WindowWidth));
end;
procedure TDebugController.SetSourceDirs;
@ -940,9 +940,9 @@ begin
{$ifdef Windows}
{ Run the debugge in another console }
if DebuggeeTTY<>'' then
Command('set new-console on')
SetCommand('new-console on')
else
Command('set new-console off');
SetCommand('new-console off');
NoSwitch:=DebuggeeTTY<>'';
{$endif Windows}
{$ifdef Unix}
@ -3538,7 +3538,7 @@ end;
Clear;
if Debugger^.WindowWidth<>-1 then
Debugger^.Command('set width 0xffffffff');
Debugger^.SetCommand('width 0xffffffff');
Debugger^.Backtrace;
{ generate list }
{ all is in tframeentry }
@ -3580,7 +3580,7 @@ end;
if Assigned(list) and (List^.Count > 0) then
FocusItem(0);
if Debugger^.WindowWidth<>-1 then
Debugger^.Command('set width '+IntToStr(Debugger^.WindowWidth));
Debugger^.SetCommand('width '+IntToStr(Debugger^.WindowWidth));
DeskTop^.Unlock;
{$endif NODEBUG}
end;

View File

@ -2764,8 +2764,8 @@ var
begin
{$ifndef NODEBUG}
If not assigned(Debugger) then Exit;
Debugger^.Command('set print sym on');
Debugger^.Command('set width 0xffffffff');
Debugger^.SetCommand('print sym on');
Debugger^.SetCommand('width 0xffffffff');
Debugger^.Command('disas '+FuncName);
p:=StrNew(Debugger^.GetOutput);
ProcessPChar(p);
@ -2780,8 +2780,8 @@ var
begin
{$ifndef NODEBUG}
If not assigned(Debugger) then Exit;
Debugger^.Command('set print sym on');
Debugger^.Command('set width 0xffffffff');
Debugger^.SetCommand('print sym on');
Debugger^.SetCommand('width 0xffffffff');
Debugger^.Command('disas 0x'+HexStr(Addr,8));
p:=StrNew(Debugger^.GetOutput);
ProcessPChar(p);

View File

@ -64,6 +64,8 @@ type
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;
{ set command }
function SetCommand(Const SetExpr : string) : boolean;
{ print }
function PrintCommand(const expr : string): pchar;
function PrintFormattedCommand(const expr : string; Format : TPrintFormatType): pchar;
@ -286,6 +288,17 @@ begin
end;
{ set command }
function TGDBController.SetCommand(Const SetExpr : string) : boolean;
begin
SetCommand:=false;
Command('-gdb-set '+SetExpr);
if error then
exit;
SetCommand:=true;
end;
{ print }
function TGDBController.PrintCommand(const expr : string): pchar;
begin

View File

@ -58,6 +58,8 @@ type
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;
{ set command }
function SetCommand(Const SetExpr : string) : boolean;
{ print }
function InternalGetValue(Const expr : string) : pchar;
function PrintCommand(const expr : string): pchar;
@ -325,6 +327,8 @@ begin
Command('finish');
end;
{ Register functions }
function TGDBController.GetIntRegister(const RegName: string; var Value: UInt64): Boolean;
var
RegValueStr: string;
@ -402,6 +406,16 @@ begin
Value := Int32(U32Value);
end;
{ set command }
function TGDBController.SetCommand(Const SetExpr : string) : boolean;
begin
SetCommand:=false;
Command('set '+SetExpr);
if error then
exit;
SetCommand:=true;
end;
{ print }
function TGDBController.InternalGetValue(Const expr : string) : pchar;