Ignore:
Timestamp:
Mar 5, 2022, 4:14:27 PM (3 years ago)
Author:
chronos
Message:
  • Modified: Update recent files list in registry immediately.
  • Fixed: Regresion in debugging step in and step out.
  • Fixed: Of by one index in loop start command interpretation.
  • Fixed: Correctly load directory and file name into open and save dialogs.
  • Modified: Faster interval for program output refresh.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Target/UTargetInterpretter.pas

    r133 r136  
    1616  private
    1717    FNewState: TRunState;
     18    FMessage: string;
     19    procedure DoMessage;
    1820    procedure DoSetState;
    1921    procedure SetStateSafe(State: TRunState);
     
    8183
    8284resourcestring
    83   SProgramLowerLimit = 'Program run over lower limit';
    84   SProgramUpperLimit = 'Program run over upper limit';
     85  SProgramLowerMemoryLimit = 'Program run over lower memory limit';
     86  SProgramUpperMemoryLimit = 'Program run over upper memory limit';
    8587  SJumpTableInconsistent = 'Jump table is inconsistent';
    8688  SJumpTableCollision = 'Jump table collision';
    8789  SProgramNotRunning = 'Program not running';
    8890  SUnsupportedCommand = 'Unsupported command';
     91  SBreakPointIndexError = 'Break point index error: %d';
    8992
    9093{ TTargetInterpretterThread }
     
    9396var
    9497  BreakPoint: TBreakPoint;
    95 begin
     98  Index: Integer;
     99begin
     100  try
    96101  with Parent do
    97102  repeat
     
    100105        if FProgramBreakpoints[FProgramIndex] then begin
    101106          BreakPoint := BreakPoints.SearchByTargetPos(FProgramIndex);
    102           if BreakPoint.System then BreakPoints.Delete(BreakPoints.IndexOf(BreakPoint));
     107          if BreakPoint.System then begin
     108            Index := BreakPoints.IndexOf(BreakPoint);
     109            if Index <> -1 then BreakPoints.Delete(Index)
     110            else raise Exception.Create(Format(SBreakPointIndexError, [Index]));
     111          end;
    103112          SetStateSafe(rsPaused);
    104113        end else begin
     
    114123    if State <> rsStopped then SetStateSafe(rsStopped);
    115124  until Terminated or (State = rsStopped);
     125
     126  except
     127    on E: Exception do begin
     128      FMessage := E.Message;
     129      Synchronize(DoMessage);
     130    end;
     131  end;
     132end;
     133
     134procedure TTargetInterpretterThread.DoMessage;
     135begin
     136  Parent.SendMessage(FMessage);
    116137end;
    117138
     
    123144procedure TTargetInterpretterThread.SetStateSafe(State: TRunState);
    124145begin
     146  if Parent.State = State then Exit;
    125147  FNewState := State;
    126148  Synchronize(DoSetState);
     
    212234begin
    213235  if Memory[MemoryPosition + FProgram[FProgramIndex].RelIndex] = 0 then
    214     FProgramIndex := FProgram[FProgramIndex].Parameter;
     236    FProgramIndex := FProgram[FProgramIndex].Parameter - 1;
    215237end;
    216238
     
    245267  if MemoryPosition < MemorySize then
    246268    Inc(MemoryPosition, FProgram[FProgramIndex].Parameter)
    247     else raise Exception.Create(SProgramUpperLimit);
     269    else raise Exception.Create(SProgramUpperMemoryLimit);
    248270end;
    249271
     
    252274  if MemoryPosition > 0 then
    253275    Dec(MemoryPosition, FProgram[FProgramIndex].Parameter)
    254     else raise Exception.Create(SProgramLowerLimit);
     276    else raise Exception.Create(SProgramLowerMemoryLimit);
    255277end;
    256278
     
    319341procedure TTargetInterpretter.CheckMemoryBounds(Address: Integer);
    320342begin
    321   if Address < 0 then raise Exception.Create(SProgramLowerLimit);
    322   if Address >= MemorySize then raise Exception.Create(SProgramUpperLimit);
     343  if Address < 0 then raise Exception.Create(SProgramLowerMemoryLimit);
     344  if Address >= MemorySize then raise Exception.Create(SProgramUpperMemoryLimit);
    323345end;
    324346
     
    428450    Nesting := 1;
    429451    while (StepIndex < DebugSteps.Count) and (Nesting > 0) do begin
    430       if TDebugStep(DebugSteps[StepIndex]).Operation = soStepIn then Inc(Nesting);
    431       if TDebugStep(DebugSteps[StepIndex]).Operation = soStepOut then Dec(Nesting);
     452      if DebugSteps[StepIndex].Operation = soStepIn then Inc(Nesting);
     453      if DebugSteps[StepIndex].Operation = soStepOut then Dec(Nesting);
    432454      Inc(StepIndex);
    433455    end;
    434456    if StepIndex < DebugSteps.Count then begin
    435       Breakpoints.SetSystem(TDebugStep(DebugSteps[StepIndex]).ProgramPosition);
     457      Breakpoints.SetSystem(DebugSteps[StepIndex].ProgramPosition);
    436458    end;
    437459    Run;
Note: See TracChangeset for help on using the changeset viewer.