Ignore:
Timestamp:
Feb 19, 2012, 9:44:58 AM (13 years ago)
Author:
chronos
Message:
  • Modified: Redone brakepoint system for system stepping breakpoints. Now system breakpoint are managed using BreakPoints filed in TTarget.
  • Added: Program can be started using Step in, Step over and Run to cursor actions.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Target/UTarget.pas

    r35 r36  
    3232    function SearchByTargetPos(Pos: Integer): TDebugStep;
    3333    procedure AddStep(SourcePos, TargetPos: Integer; Operation: TStepOperation);
     34  end;
     35
     36  TBreakPoint = class
     37    TargetAddress: Integer;
     38    System: Boolean;
     39  end;
     40
     41  { TBreakPointList }
     42
     43  TBreakPointList = class(TListObject)
     44    procedure AddItem(TargetAddress: Integer);
     45    procedure SetSystem(TargetAddress: Integer);
     46    procedure ClearSystem;
     47    function SearchByTargetPos(Pos: Integer): TBreakPoint;
    3448  end;
    3549
     
    5064    function LongFileName(FileName: string): string;
    5165    function GetExecutionPosition: Integer; virtual;
     66    procedure SetState(AValue: TRunState); virtual;
    5267  public
    5368    Name: string;
     
    5974    ProjectFileName: string;
    6075    Capabilities: TTargetCapabilities;
    61     BreakPoints: TListInteger;
     76    BreakPoints: TBreakPointList;
    6277    DebugSteps: TDebugStepList;
    6378    constructor Create; virtual;
     
    7590    procedure LoadFromRegistry(Root: HKEY; Key: string); virtual;
    7691    procedure SaveToRegistry(Root: HKEY; Key: string); virtual;
    77     property State: TRunState read FState;
     92    property State: TRunState read FState write SetState;
    7893    property OnChangeState: TNotifyEvent read FOnChangeState write FOnChangeState;
    7994    property SourceCode: string write SetSourceCode;
     
    98113
    99114implementation
     115
     116{ TBreakPointList }
     117
     118procedure TBreakPointList.AddItem(TargetAddress: Integer);
     119var
     120  NewItem: TBreakPoint;
     121begin
     122  NewItem := TBreakPoint.Create;
     123  NewItem.TargetAddress := TargetAddress;
     124  Add(NewItem);
     125end;
     126
     127procedure TBreakPointList.SetSystem(TargetAddress: Integer);
     128var
     129  NewItem: TBreakPoint;
     130begin
     131  ClearSystem;
     132  NewItem := TBreakPoint.Create;
     133  NewItem.TargetAddress := TargetAddress;
     134  NewItem.System := True;
     135  Add(NewItem);
     136end;
     137
     138procedure TBreakPointList.ClearSystem;
     139var
     140  I: Integer;
     141begin
     142  for I := Count - 1 downto 0 do
     143    if TBreakPoint(Items[I]).System then Delete(I);
     144end;
     145
     146function TBreakPointList.SearchByTargetPos(Pos: Integer): TBreakPoint;
     147var
     148  I: Integer;
     149begin
     150  I := 0;
     151  while (I < Count) and (TBreakPoint(Items[I]).TargetAddress < Pos) do Inc(I);
     152  if I < Count then Result := TBreakPoint(Items[I])
     153    else Result := nil;
     154end;
    100155
    101156{ TDebugStepList }
     
    191246begin
    192247
     248end;
     249
     250procedure TTarget.SetState(AValue: TRunState);
     251begin
     252  if FState = AValue then Exit;
     253  FState := AValue;
    193254end;
    194255
     
    218279  inherited;
    219280  Optimization := coNormal;
    220   BreakPoints := TListInteger.Create;
     281  BreakPoints := TBreakPointList.Create;
    221282  DebugSteps := TDebugStepList.Create;
    222283end;
Note: See TracChangeset for help on using the changeset viewer.