Changeset 136 for trunk/Target/UTargetInterpretter.pas
- Timestamp:
- Mar 5, 2022, 4:14:27 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Target/UTargetInterpretter.pas
r133 r136 16 16 private 17 17 FNewState: TRunState; 18 FMessage: string; 19 procedure DoMessage; 18 20 procedure DoSetState; 19 21 procedure SetStateSafe(State: TRunState); … … 81 83 82 84 resourcestring 83 SProgramLower Limit = 'Program run over lowerlimit';84 SProgramUpper Limit = 'Program run over upperlimit';85 SProgramLowerMemoryLimit = 'Program run over lower memory limit'; 86 SProgramUpperMemoryLimit = 'Program run over upper memory limit'; 85 87 SJumpTableInconsistent = 'Jump table is inconsistent'; 86 88 SJumpTableCollision = 'Jump table collision'; 87 89 SProgramNotRunning = 'Program not running'; 88 90 SUnsupportedCommand = 'Unsupported command'; 91 SBreakPointIndexError = 'Break point index error: %d'; 89 92 90 93 { TTargetInterpretterThread } … … 93 96 var 94 97 BreakPoint: TBreakPoint; 95 begin 98 Index: Integer; 99 begin 100 try 96 101 with Parent do 97 102 repeat … … 100 105 if FProgramBreakpoints[FProgramIndex] then begin 101 106 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; 103 112 SetStateSafe(rsPaused); 104 113 end else begin … … 114 123 if State <> rsStopped then SetStateSafe(rsStopped); 115 124 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; 132 end; 133 134 procedure TTargetInterpretterThread.DoMessage; 135 begin 136 Parent.SendMessage(FMessage); 116 137 end; 117 138 … … 123 144 procedure TTargetInterpretterThread.SetStateSafe(State: TRunState); 124 145 begin 146 if Parent.State = State then Exit; 125 147 FNewState := State; 126 148 Synchronize(DoSetState); … … 212 234 begin 213 235 if Memory[MemoryPosition + FProgram[FProgramIndex].RelIndex] = 0 then 214 FProgramIndex := FProgram[FProgramIndex].Parameter ;236 FProgramIndex := FProgram[FProgramIndex].Parameter - 1; 215 237 end; 216 238 … … 245 267 if MemoryPosition < MemorySize then 246 268 Inc(MemoryPosition, FProgram[FProgramIndex].Parameter) 247 else raise Exception.Create(SProgramUpper Limit);269 else raise Exception.Create(SProgramUpperMemoryLimit); 248 270 end; 249 271 … … 252 274 if MemoryPosition > 0 then 253 275 Dec(MemoryPosition, FProgram[FProgramIndex].Parameter) 254 else raise Exception.Create(SProgramLower Limit);276 else raise Exception.Create(SProgramLowerMemoryLimit); 255 277 end; 256 278 … … 319 341 procedure TTargetInterpretter.CheckMemoryBounds(Address: Integer); 320 342 begin 321 if Address < 0 then raise Exception.Create(SProgramLower Limit);322 if Address >= MemorySize then raise Exception.Create(SProgramUpper Limit);343 if Address < 0 then raise Exception.Create(SProgramLowerMemoryLimit); 344 if Address >= MemorySize then raise Exception.Create(SProgramUpperMemoryLimit); 323 345 end; 324 346 … … 428 450 Nesting := 1; 429 451 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); 432 454 Inc(StepIndex); 433 455 end; 434 456 if StepIndex < DebugSteps.Count then begin 435 Breakpoints.SetSystem( TDebugStep(DebugSteps[StepIndex]).ProgramPosition);457 Breakpoints.SetSystem(DebugSteps[StepIndex].ProgramPosition); 436 458 end; 437 459 Run;
Note:
See TracChangeset
for help on using the changeset viewer.