13
13
namespace NActors {
14
14
class TChunkSerializer ;
15
15
class IActor ;
16
-
16
+
17
17
class IEventBase
18
18
: TNonCopyable {
19
19
protected:
@@ -122,6 +122,7 @@ namespace NActors {
122
122
FlagUseSubChannel = 1 << 3 ,
123
123
FlagGenerateUnsureUndelivered = 1 << 4 ,
124
124
FlagExtendedFormat = 1 << 5 ,
125
+ FlagDebugTrackReceive = 1 << 6 ,
125
126
};
126
127
using TEventFlags = ui32;
127
128
@@ -194,10 +195,34 @@ namespace NActors {
194
195
return OnNondeliveryHolder.Get () ? OnNondeliveryHolder->Recipient : TActorId ();
195
196
}
196
197
198
+ #ifndef NDEBUG
199
+ static inline thread_local bool TrackNextEvent = false ;
200
+
201
+ /* *
202
+ * Call this function in gdb before
203
+ * sending the event you want to debug
204
+ * and continue execution. __builtin_debugtrap/SIGTRAP
205
+ * will stop gdb at the receiving point.
206
+ * Currently, to get to Handle function you
207
+ * also need to ascend couple frames (up, up) and step to
208
+ * function you are searching for
209
+ */
210
+ static void DoTrackNextEvent ();
211
+
212
+ static TEventFlags ApplyGlobals (TEventFlags flags) {
213
+ bool trackNextEvent = std::exchange (TrackNextEvent, false );
214
+ return flags | (trackNextEvent ? FlagDebugTrackReceive : 0 );
215
+ }
216
+ #else
217
+ Y_FORCE_INLINE static TEventFlags ApplyGlobals (TEventFlags flags) {
218
+ return flags;
219
+ }
220
+ #endif
221
+
197
222
IEventHandle (const TActorId& recipient, const TActorId& sender, IEventBase* ev, TEventFlags flags = 0 , ui64 cookie = 0 ,
198
223
const TActorId* forwardOnNondelivery = nullptr , NWilson::TTraceId traceId = {})
199
224
: Type(ev->Type ())
200
- , Flags(flags)
225
+ , Flags(ApplyGlobals( flags) )
201
226
, Recipient(recipient)
202
227
, Sender(sender)
203
228
, Cookie(cookie)
@@ -222,7 +247,7 @@ namespace NActors {
222
247
const TActorId* forwardOnNondelivery = nullptr ,
223
248
NWilson::TTraceId traceId = {})
224
249
: Type(type)
225
- , Flags(flags)
250
+ , Flags(ApplyGlobals( flags) )
226
251
, Recipient(recipient)
227
252
, Sender(sender)
228
253
, Cookie(cookie)
@@ -249,7 +274,7 @@ namespace NActors {
249
274
TScopeId originScopeId,
250
275
NWilson::TTraceId traceId) noexcept
251
276
: Type(type)
252
- , Flags(flags)
277
+ , Flags(ApplyGlobals( flags) )
253
278
, Recipient(recipient)
254
279
, Sender(sender)
255
280
, Cookie(cookie)
0 commit comments