MCPcopy Create free account
hub / github.com/axhlzy/FridaDebugger / drainEvents

Function drainEvents

scripts/thread-stalker.js:302–324  ·  view source on GitHub ↗
(tid, state, events)

Source from the content-addressed store, hash-verified

300}
301
302function drainEvents(tid, state, events) {
303 let parsed;
304 try {
305 parsed = Stalker.parse(events, { annotate: true, stringify: false });
306 } catch (e) { return; }
307
308 const lines = [];
309 for (const ev of parsed) {
310 if (state.count >= CONFIG.maxEventsPerThread) {
311 stopStalk(tid, `event cap ${CONFIG.maxEventsPerThread} reached`);
312 break;
313 }
314 const line = formatEvent(state, ev);
315 if (line == null) continue; // filtered out by scope
316 state.count++;
317 if (lines.length < CONFIG.flushBatch) lines.push(line);
318 else state.dropped++;
319 }
320 if (lines.length) {
321 const tag = `${C.dim}#${tid}${C.reset}`;
322 console.log(lines.map((l) => `${tag} ${l}`).join("\n"));
323 }
324}
325
326function sym(addr) {
327 if (!CONFIG.symbolicate) return addr.toString();

Callers 1

onReceiveFunction · 0.70

Calls 2

stopStalkFunction · 0.85
formatEventFunction · 0.70

Tested by

no test coverage detected