anchor.diff:  var
     LastCommand   : String;
     DbgEvent      : TDbgEvent;
  -  Target        : TDbgMain;
  +  uDebugger     : TDbgMain;
   
     Running       : Boolean = False;
     WaitForNext   : Boolean = False;
     StopOnSysCall : Boolean = False;
  -  
  - // EventHandlers : TFPList;
  -  
  -type
  -  TDebugEnvironment=class(TCommandEnvironment)
  -  public
  -    function Main: TDbgMain; override;
  -    function Process: TDbgProcess; override;
  -    function Thread: TDbgThread; override;
  -  end;
  -
  -function TDebugEnvironment.Main: TDbgMain; 
  -begin
  -  Result:=Target;
  -end;
  -
  -function TDebugEnvironment.Process: TDbgProcess; 
  -begin
  -  Result:=Main.FindProcess( DbgEvent.Process );
  -end;
  -
  -function TDebugEnvironment.Thread: TDbgThread; 
  -begin
  -  Result:=Main.FindThread( DbgEvent.Process, DbgEvent.Thread );
  -end;
  -  
  +
   const
     CmdPrefix = 'fpd> ';
     HexSize   = sizeof(TDbgPtr) * 2;
   
  -type
  -  { TRunCommand }
  -
  -  TRunCommand = class(TCommand)
  -    procedure Execute(CmdParams: TStrings; Env: TCommandEnvironment); override;
  -    function ShortHelp: String; override;
  -  end;
  -  
  -  { TRunToCommand }
  -
  -  TRunToCommand = class(TCommand)
  -    procedure Execute(CmdParams: TStrings; Env: TCommandEnvironment); override;
  -    function ShortHelp: String; override;
  -  end;
  -  
  -  { TStepCommand }
  -
  -  TStepCommand = class(TCommand)
  -    procedure Execute(CmdParams: TStrings; Env: TCommandEnvironment); override;
  -    function ShortHelp: String; override;
  -  end;
  -
  -  { TContinueCommand }
  -
  -  TContinueCommand = class(TCommand)
  -    procedure Execute(CmdParams: TStrings; Env: TCommandEnvironment); override;
  -    function ShortHelp: String; override;
  -  end;
  -
  + // EventHandlers : TFPList;
  +  
  +{ TDebugEnvironment }
  +
  +function TDebugEnvironment.Debugger: TDbgMain;
  +begin
  +  Result := uDebugger;
  +end;
  +
  +function TDebugEnvironment.Process: TDbgProcess; 
  +begin
  +  Result := Debugger.FindProcess(DbgEvent.Process);
  +end;
  +
  +function TDebugEnvironment.Thread: TDbgThread; 
  +begin
  +  Result := Debugger.FindThread(DbgEvent.Process, DbgEvent.Thread);
  +end;
  +  
   { TRunToCommand }
   
   procedure TRunToCommand.Execute(CmdParams: TStrings; Env: TCommandEnvironment);
  
positive.code: 
  function DebugTarget: TDbgMain;
  begin
    Result:=Target;
  end;
  
  function EventProc: TDbgProcess;
  begin
    Result:=Target.FindProcess(DbgEvent.Process);
  end;
  
  function EventThread: TDbgThread;
  begin
    Result:=Target.FindThread(DbgEvent.Process, DbgEvent.Thread);
  end;
  
  // Registering commands
  
negative.code:   dbgTypes, dbgUtils, dbgConsts, dbgMain,
    commands; 
  
  type
  
    TDebugEnvironment = class(TCommandEnvironment)
    public
      function Debugger: TDbgMain; override;
      function Process: TDbgProcess; override;
      function Thread: TDbgThread; override;
    end;
  
  
    TRunCommand = class(TCommand)
      procedure Execute(CmdParams: TStrings; Env: TCommandEnvironment); override;
      function ShortHelp: String; override;
    end;
  
  
    TRunToCommand = class(TCommand)
      procedure Execute(CmdParams: TStrings; Env: TCommandEnvironment); override;
      function ShortHelp: String; override;
    end;
  
  
    TStepCommand = class(TCommand)
      procedure Execute(CmdParams: TStrings; Env: TCommandEnvironment); override;
      function ShortHelp: String; override;
    end;
  
  
    TContinueCommand = class(TCommand)
      procedure Execute(CmdParams: TStrings; Env: TCommandEnvironment); override;
      function ShortHelp: String; override;
    end;
  
  
  procedure RunLoop(ATarget: TDbgMain);
  
  {type
  