@@ -62,6 +62,7 @@ TDebuggerDataSetContainer = class(TDataModule)
62
62
FDebugSessionStopped: IDisconnectable;
63
63
FSetupDebugger: IDisconnectable;
64
64
FSetupDebuggerDone: IDisconnectable;
65
+ FDebugAction: IDisconnectable;
65
66
// Debugger events
66
67
FContinuedEvent: IUnsubscribable;
67
68
FExitedEvent: IUnsubscribable;
@@ -103,6 +104,8 @@ TDebuggerDataSetContainer = class(TDataModule)
103
104
procedure AddBreakpoint (const ASourceName: string; const ALine: integer);
104
105
procedure RemoveBreakpoint (const ASourceName: string; const ALine: integer);
105
106
procedure ClearBreakpoints (const ASourceName: string);
107
+ // Clear active source line and indicator values
108
+ procedure ClearSourceLineAndIndicator ();
106
109
end ;
107
110
108
111
var
@@ -153,6 +156,25 @@ procedure TDebuggerDataSetContainer.DataModuleCreate(Sender: TObject);
153
156
begin
154
157
SetupDebuggerDone(AEventNotification.Body.Debugger);
155
158
end );
159
+
160
+ FDebugAction := TGlobalBuilderChain.SubscribeToEvent<TDebugActionEvent>(
161
+ procedure(const AEventNotification: TDebugActionEvent)
162
+ const
163
+ DANGLE_INDICATOR_STATES = [
164
+ TDebugAction.Stop,
165
+ TDebugAction.StepIn,
166
+ TDebugAction.StepOver,
167
+ TDebugAction.StepOut,
168
+ TDebugAction.Continue];
169
+ begin
170
+ if not (AEventNotification.Body.Action in DANGLE_INDICATOR_STATES) then
171
+ Exit;
172
+
173
+ if fdmtActiveSource.IsEmpty then
174
+ Exit;
175
+
176
+ ClearSourceLineAndIndicator();
177
+ end );
156
178
end ;
157
179
158
180
procedure TDebuggerDataSetContainer.DataModuleDestroy (Sender: TObject);
@@ -238,14 +260,7 @@ procedure TDebuggerDataSetContainer.DebugSessionStarted(
238
260
' Thread %d continued.' , [
239
261
AEventNotification.Body.ThreadId]));
240
262
241
- System.Classes.TThread.Synchronize(System.Classes.TThread.Current,
242
- procedure()
243
- begin
244
- fdmtActiveSource.Edit();
245
- fdmtActiveSourceactive_source_line.AsInteger := 0 ;
246
- fdmtActiveSourceactive_source_line_indicator.AsBoolean := false;
247
- fdmtActiveSource.Post();
248
- end );
263
+ ClearSourceLineAndIndicator();
249
264
end );
250
265
251
266
FBreakpointEvent := ABaseProtocolClient.SubscribeToEvent<TBreakpointEvent>(
@@ -827,4 +842,16 @@ procedure TDebuggerDataSetContainer.ClearBreakpoints(const ASourceName: string);
827
842
end );
828
843
end ;
829
844
845
+ procedure TDebuggerDataSetContainer.ClearSourceLineAndIndicator ;
846
+ begin
847
+ System.Classes.TThread.Synchronize(System.Classes.TThread.Current,
848
+ procedure()
849
+ begin
850
+ fdmtActiveSource.Edit();
851
+ fdmtActiveSourceactive_source_line.AsInteger := 0 ;
852
+ fdmtActiveSourceactive_source_line_indicator.AsBoolean := false;
853
+ fdmtActiveSource.Post();
854
+ end );
855
+ end ;
856
+
830
857
end .
0 commit comments