void SymbolVendor::Dump(Stream *s) { ModuleSP module_sp(GetModule()); if (module_sp) { lldb_private::Mutex::Locker locker(module_sp->GetMutex()); bool show_context = false; s->Printf("%p: ", static_cast<void*>(this)); s->Indent(); s->PutCString("SymbolVendor"); if (m_sym_file_ap.get()) { ObjectFile *objfile = m_sym_file_ap->GetObjectFile(); if (objfile) { const FileSpec &objfile_file_spec = objfile->GetFileSpec(); if (objfile_file_spec) { s->PutCString(" ("); objfile_file_spec.Dump(s); s->PutChar(')'); } } } s->EOL(); s->IndentMore(); m_type_list.Dump(s, show_context); CompileUnitConstIter cu_pos, cu_end; cu_end = m_compile_units.end(); for (cu_pos = m_compile_units.begin(); cu_pos != cu_end; ++cu_pos) { // We currently only dump the compile units that have been parsed if (cu_pos->get()) (*cu_pos)->Dump(s, show_context); } s->IndentLess(); } }
SBData SBSection::GetSectionData (uint64_t offset, uint64_t size) { SBData sb_data; SectionSP section_sp (GetSP()); if (section_sp) { const uint64_t sect_file_size = section_sp->GetFileSize(); if (sect_file_size > 0) { ModuleSP module_sp (section_sp->GetModule()); if (module_sp) { ObjectFile *objfile = module_sp->GetObjectFile(); if (objfile) { const uint64_t sect_file_offset = objfile->GetOffset() + section_sp->GetFileOffset(); const uint64_t file_offset = sect_file_offset + offset; uint64_t file_size = size; if (file_size == UINT64_MAX) { file_size = section_sp->GetByteSize(); if (file_size > offset) file_size -= offset; else file_size = 0; } DataBufferSP data_buffer_sp (objfile->GetFileSpec().ReadFileContents (file_offset, file_size)); if (data_buffer_sp && data_buffer_sp->GetByteSize() > 0) { DataExtractorSP data_extractor_sp (new DataExtractor (data_buffer_sp, objfile->GetByteOrder(), objfile->GetAddressByteSize())); sb_data.SetOpaque (data_extractor_sp); } } } } } return sb_data; }
bool SymbolContext::GetParentOfInlinedScope (const Address &curr_frame_pc, SymbolContext &next_frame_sc, Address &next_frame_pc) const { next_frame_sc.Clear(false); next_frame_pc.Clear(); if (block) { //const addr_t curr_frame_file_addr = curr_frame_pc.GetFileAddress(); // In order to get the parent of an inlined function we first need to // see if we are in an inlined block as "this->block" could be an // inlined block, or a parent of "block" could be. So lets check if // this block or one of this blocks parents is an inlined function. Block *curr_inlined_block = block->GetContainingInlinedBlock(); if (curr_inlined_block) { // "this->block" is contained in an inline function block, so to // get the scope above the inlined block, we get the parent of the // inlined block itself Block *next_frame_block = curr_inlined_block->GetParent(); // Now calculate the symbol context of the containing block next_frame_block->CalculateSymbolContext (&next_frame_sc); // If we get here we weren't able to find the return line entry using the nesting of the blocks and // the line table. So just use the call site info from our inlined block. AddressRange range; if (curr_inlined_block->GetRangeContainingAddress (curr_frame_pc, range)) { // To see there this new frame block it, we need to look at the // call site information from const InlineFunctionInfo* curr_inlined_block_inlined_info = curr_inlined_block->GetInlinedFunctionInfo(); next_frame_pc = range.GetBaseAddress(); next_frame_sc.line_entry.range.GetBaseAddress() = next_frame_pc; next_frame_sc.line_entry.file = curr_inlined_block_inlined_info->GetCallSite().GetFile(); next_frame_sc.line_entry.line = curr_inlined_block_inlined_info->GetCallSite().GetLine(); next_frame_sc.line_entry.column = curr_inlined_block_inlined_info->GetCallSite().GetColumn(); return true; } else { Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_SYMBOLS)); if (log) { log->Printf ("warning: inlined block 0x%8.8" PRIx64 " doesn't have a range that contains file address 0x%" PRIx64, curr_inlined_block->GetID(), curr_frame_pc.GetFileAddress()); } #ifdef LLDB_CONFIGURATION_DEBUG else { ObjectFile *objfile = NULL; if (module_sp) { SymbolVendor *symbol_vendor = module_sp->GetSymbolVendor(); if (symbol_vendor) { SymbolFile *symbol_file = symbol_vendor->GetSymbolFile(); if (symbol_file) objfile = symbol_file->GetObjectFile(); } } if (objfile) { Host::SystemLog (Host::eSystemLogWarning, "warning: inlined block 0x%8.8" PRIx64 " doesn't have a range that contains file address 0x%" PRIx64 " in %s\n", curr_inlined_block->GetID(), curr_frame_pc.GetFileAddress(), objfile->GetFileSpec().GetPath().c_str()); } else { Host::SystemLog (Host::eSystemLogWarning, "warning: inlined block 0x%8.8" PRIx64 " doesn't have a range that contains file address 0x%" PRIx64 "\n", curr_inlined_block->GetID(), curr_frame_pc.GetFileAddress()); } } #endif } } } return false; }