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

Method FindSymbolAt

IDEHelper/DebugTarget.cpp:377–449  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

375}
376
377bool DebugTarget::FindSymbolAt(addr_target addr, String* outSymbol, addr_target* outOffset, DbgModule** outDWARF, bool allowRemote)
378{
379 //TODO: First search for symbol, then determine if the addr is within the defining DbgModule
380
381 DbgModule* insideDWARF = NULL;
382
383 auto dbgModule = FindDbgModuleForAddress(addr);
384 if (dbgModule != NULL)
385 dbgModule->ParseSymbolData();
386
387 auto dwSymbol = mSymbolMap.Get(addr, 16*1024*1024);
388 if (dwSymbol != NULL)
389 {
390 dbgModule = dwSymbol->mDbgModule;
391 }
392
393 if (dbgModule == NULL)
394 return false;
395
396 if (outDWARF != NULL)
397 *outDWARF = dbgModule;
398
399 bool isExecutable = false;
400 bool isInsideSomeSegment = false;
401 for (int i = 0; i < (int)dbgModule->mSections.size(); i++)
402 {
403 auto section = &dbgModule->mSections[i];
404
405 if ((addr >= section->mAddrStart + dbgModule->mImageBase) && (addr < section->mAddrStart + dbgModule->mImageBase + section->mAddrLength))
406 {
407 if (dbgModule->HasPendingDebugInfo())
408 {
409 if (dbgModule->WantsAutoLoadDebugInfo())
410 {
411 DbgPendingDebugInfoLoad* dbgPendingDebugInfoLoad = NULL;
412 mDebugger->mPendingDebugInfoLoad.TryAdd(dbgModule, NULL, &dbgPendingDebugInfoLoad);
413 dbgPendingDebugInfoLoad->mModule = dbgModule;
414 dbgPendingDebugInfoLoad->mAllowRemote |= allowRemote;
415 }
416 }
417
418 isInsideSomeSegment = true;
419 if (section->mIsExecutable)
420 isExecutable = true;
421 }
422 }
423
424 if (!isInsideSomeSegment)
425 return false;
426
427 if (dwSymbol == NULL)
428 return false;
429
430 if (isExecutable)
431 {
432 addr_target thunkAddr = mDebugger->mCPU->DecodeThunk(addr, dwSymbol->mDbgModule->mOrigImageData);
433 if (thunkAddr != 0)
434 {

Callers 15

ReadTypedValueMethod · 0.80
MatchMethodMethod · 0.80
AddSubProgramMethod · 0.80
CheckNonDebuggerBreakMethod · 0.80
DbgTypedValueToStringMethod · 0.80
EvaluateMethod · 0.80
GetThreadInfoMethod · 0.80
UpdateCallStackMethodMethod · 0.80
GetStackFrameInfoMethod · 0.80
GetAddressSymbolNameMethod · 0.80
DisassembleAtRawMethod · 0.80

Calls 7

ParseSymbolDataMethod · 0.45
GetMethod · 0.45
sizeMethod · 0.45
HasPendingDebugInfoMethod · 0.45
TryAddMethod · 0.45
DecodeThunkMethod · 0.45

Tested by

no test coverage detected