bool SymbolContext::GetAddressRange (uint32_t scope, AddressRange &range) const { if ((scope & eSymbolContextLineEntry) && line_entry.IsValid()) { range = line_entry.range; return true; } else if ((scope & eSymbolContextFunction) && function != NULL) { range = function->GetAddressRange(); return true; } else if ((scope & eSymbolContextSymbol) && symbol != NULL && symbol->GetAddressRangePtr()) { range = *symbol->GetAddressRangePtr(); if (range.GetByteSize() == 0) { if (module_sp) { ObjectFile *objfile = module_sp->GetObjectFile(); if (objfile) { Symtab *symtab = objfile->GetSymtab(); if (symtab) range.SetByteSize(symtab->CalculateSymbolSize (symbol)); } } } return true; } range.Clear(); return false; }
bool Block::GetRangeContainingAddress (const Address& addr, AddressRange &range) { Function *function = CalculateSymbolContextFunction(); if (function) { const AddressRange &func_range = function->GetAddressRange(); if (addr.GetSection() == func_range.GetBaseAddress().GetSection()) { const addr_t addr_offset = addr.GetOffset(); const addr_t func_offset = func_range.GetBaseAddress().GetOffset(); if (addr_offset >= func_offset && addr_offset < func_offset + func_range.GetByteSize()) { addr_t offset = addr_offset - func_offset; const Range *range_ptr = m_ranges.FindEntryThatContains (offset); if (range_ptr) { range.GetBaseAddress() = func_range.GetBaseAddress(); range.GetBaseAddress().SetOffset(func_offset + range_ptr->GetRangeBase()); range.SetByteSize(range_ptr->GetByteSize()); return true; } } } } range.Clear(); return false; }
bool SymbolContext::GetAddressRange (uint32_t scope, uint32_t range_idx, bool use_inline_block_range, AddressRange &range) const { if ((scope & eSymbolContextLineEntry) && line_entry.IsValid()) { range = line_entry.range; return true; } if ((scope & eSymbolContextBlock) && (block != NULL)) { if (use_inline_block_range) { Block *inline_block = block->GetContainingInlinedBlock(); if (inline_block) return inline_block->GetRangeAtIndex (range_idx, range); } else { return block->GetRangeAtIndex (range_idx, range); } } if ((scope & eSymbolContextFunction) && (function != NULL)) { if (range_idx == 0) { range = function->GetAddressRange(); return true; } } if ((scope & eSymbolContextSymbol) && (symbol != NULL)) { if (range_idx == 0) { if (symbol->ValueIsAddress()) { range.GetBaseAddress() = symbol->GetAddress(); range.SetByteSize (symbol->GetByteSize()); return true; } } } range.Clear(); return false; }