MCPcopy Create free account
hub / github.com/GaijinEntertainment/daScript / findModule

Function findModule

src/misc/alloc_tracker_fast_stack.cpp:114–128  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

112}
113
114static __forceinline bool findModule(ULONG64 pc, const CachedModule *&lastModule, ULONG64 &imageBase) {
115 if (lastModule && pc >= imageBase && pc < lastModule->end)
116 return true;
117 lastModule = nullptr;
118 int count = g_moduleCount.load(std::memory_order_acquire);
119 int lo = 0, hi = count - 1;
120 while (lo <= hi) {
121 int mid = (lo + hi) >> 1;
122 const CachedModule &mod = g_modules[mid];
123 if (pc < mod.base) hi = mid - 1;
124 else if (pc >= mod.end) lo = mid + 1;
125 else { lastModule = &mod; imageBase = mod.base; return true; }
126 }
127 return false;
128}
129
130static __forceinline PRUNTIME_FUNCTION findFunctionEntry(const CachedModule *mod, DWORD rva, int &hint) {
131 PRUNTIME_FUNCTION table = mod->pdata;

Callers 2

foreachMethod · 0.85
cachedLookupOnlyFunction · 0.85

Calls 1

loadMethod · 0.45

Tested by

no test coverage detected