MCPcopy Create free account
hub / github.com/Vector35/debugger / GetModuleForAddress

Method GetModuleForAddress

core/debuggerstate.cpp:352–376  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

350
351
352DebugModule DebuggerModules::GetModuleForAddress(uint64_t remoteAddress)
353{
354 if (IsDirty())
355 Update();
356
357 // lldb does not properly return the size of a module, so we have to find the nearest module base that is smaller
358 // than the remoteAddress
359 uint64_t closestAddress = 0;
360 DebugModule result {};
361
362 for (const DebugModule& module : m_modules)
363 {
364 // This is slighlty different from the Python implementation, which finds the largest module start that is
365 // smaller than the remoteAddress.
366 // if ((module.m_address <= remoteAddress) && (remoteAddress < module.m_address + module.m_size))
367 // return module;
368 if ((module.m_address <= remoteAddress) && (module.m_address > closestAddress))
369 {
370 closestAddress = module.m_address;
371 result = module;
372 }
373 }
374
375 return result;
376}
377
378
379ModuleNameAndOffset DebuggerModules::AbsoluteAddressToRelative(uint64_t absoluteAddress)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected