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

Function matchThread

scripts/thread-stalker.js:164–181  ·  view source on GitHub ↗
(thread)

Source from the content-addressed store, hash-verified

162
163// returns the matched module name to use as default scope, or null if no match
164function matchThread(thread) {
165 const routine =
166 thread.entrypoint && thread.entrypoint.routine ? thread.entrypoint.routine : null;
167 const mo = routine ? routineModuleOffset(routine) : null;
168 const name = thread.name || "";
169
170 for (const t of TARGETS) {
171 if (t.name != null) {
172 if (name.includes(t.name)) return mo ? mo.module : null;
173 continue;
174 }
175 if (!mo) continue;
176 if (!mo.module.includes(t.module)) continue;
177 if (t.offset != null && mo.offset !== t.offset) continue;
178 return mo.module; // matched; module is the default logging scope
179 }
180 return null;
181}
182
183// --- Stalker.exclude: keep instrumentation INSIDE target modules only -------
184// Exclude every loaded module whose name is NOT one of the target modules.

Callers 1

onAddedFunction · 0.85

Calls 1

routineModuleOffsetFunction · 0.85

Tested by

no test coverage detected