MCPcopy Create free account
hub / github.com/beefytech/Beef / FindDbgModuleForAddress

Method FindDbgModuleForAddress

IDEHelper/DebugTarget.cpp:2496–2532  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2494#define ADDR_ROUGH(address) ((address) & ~0x3FFF)
2495
2496DbgModule* DebugTarget::FindDbgModuleForAddress(addr_target address)
2497{
2498 addr_target checkAddr = ADDR_ROUGH(address);
2499 FindDbgModuleCacheEntry* valuePtr = NULL;
2500 if (mFindDbgModuleCache.TryAdd(checkAddr, NULL, &valuePtr))
2501 {
2502 for (auto dwarf : mDbgModules)
2503 {
2504 if ((checkAddr >= ADDR_ROUGH(dwarf->mImageBase)) && (checkAddr <= ADDR_ROUGH(dwarf->mImageBase + dwarf->mImageSize)))
2505 {
2506 if (valuePtr->mFirst == NULL)
2507 {
2508 valuePtr->mFirst = dwarf;
2509 }
2510 else
2511 {
2512 if (valuePtr->mCollisions == NULL)
2513 valuePtr->mCollisions = new Array<DbgModule*>();
2514 valuePtr->mCollisions->Add(dwarf);
2515 }
2516 }
2517 }
2518 }
2519
2520 auto dwarf = valuePtr->mFirst;
2521 if ((dwarf != NULL) && (address >= dwarf->mImageBase) && (address < dwarf->mImageBase + dwarf->mImageSize))
2522 return dwarf;
2523
2524 if (valuePtr->mCollisions != NULL)
2525 {
2526 for (auto dwarf : *valuePtr->mCollisions)
2527 if ((address >= dwarf->mImageBase) && (address < dwarf->mImageBase + dwarf->mImageSize))
2528 return dwarf;
2529 }
2530
2531 return NULL;
2532}
2533
2534DbgModule* DebugTarget::GetMainDbgModule()
2535{

Callers 8

DoUpdateMethod · 0.80
DbgTypedValueToStringMethod · 0.80
GetCallStackDbgModuleMethod · 0.80
GetThreadInfoMethod · 0.80
GetStackFrameInfoMethod · 0.80
DisassembleAtRawMethod · 0.80
ThreadProcMethod · 0.80
HandlePendingEntriesMethod · 0.80

Calls 2

TryAddMethod · 0.45
AddMethod · 0.45

Tested by

no test coverage detected