diff options
Diffstat (limited to 'lldb/source/Plugins/ObjectFile')
6 files changed, 155 insertions, 137 deletions
diff --git a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp index 09bdff889c8..930415abe47 100644 --- a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp +++ b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp @@ -171,10 +171,11 @@ ObjectFileELF::GetPluginDescriptionStatic() } ObjectFile * -ObjectFileELF::CreateInstance(Module *module, - DataBufferSP &data_sp, - const FileSpec *file, addr_t offset, - addr_t length) +ObjectFileELF::CreateInstance (const lldb::ModuleSP &module_sp, + DataBufferSP &data_sp, + const FileSpec *file, + addr_t offset, + addr_t length) { if (data_sp && data_sp->GetByteSize() > (llvm::ELF::EI_NIDENT + offset)) { @@ -184,8 +185,7 @@ ObjectFileELF::CreateInstance(Module *module, unsigned address_size = ELFHeader::AddressSizeInBytes(magic); if (address_size == 4 || address_size == 8) { - std::auto_ptr<ObjectFileELF> objfile_ap( - new ObjectFileELF(module, data_sp, file, offset, length)); + std::auto_ptr<ObjectFileELF> objfile_ap(new ObjectFileELF(module_sp, data_sp, file, offset, length)); ArchSpec spec; if (objfile_ap->GetArchitecture(spec) && objfile_ap->SetModulesArchitecture(spec)) @@ -198,7 +198,10 @@ ObjectFileELF::CreateInstance(Module *module, ObjectFile* -ObjectFileELF::CreateMemoryInstance(Module* module, DataBufferSP& data_sp, const lldb::ProcessSP &process_sp, lldb::addr_t header_addr) +ObjectFileELF::CreateMemoryInstance (const lldb::ModuleSP &module_sp, + DataBufferSP& data_sp, + const lldb::ProcessSP &process_sp, + lldb::addr_t header_addr) { return NULL; } @@ -228,17 +231,19 @@ ObjectFileELF::GetPluginVersion() // ObjectFile protocol //------------------------------------------------------------------ -ObjectFileELF::ObjectFileELF(Module* module, DataBufferSP& dataSP, - const FileSpec* file, addr_t offset, - addr_t length) - : ObjectFile(module, file, offset, length, dataSP), - m_header(), - m_program_headers(), - m_section_headers(), - m_sections_ap(), - m_symtab_ap(), - m_filespec_ap(), - m_shstr_data() +ObjectFileELF::ObjectFileELF (const lldb::ModuleSP &module_sp, + DataBufferSP& dataSP, + const FileSpec* file, + addr_t offset, + addr_t length) : + ObjectFile(module_sp, file, offset, length, dataSP), + m_header(), + m_program_headers(), + m_section_headers(), + m_sections_ap(), + m_symtab_ap(), + m_filespec_ap(), + m_shstr_data() { if (file) m_file = *file; @@ -346,20 +351,20 @@ ObjectFileELF::GetImageInfoAddress() if (!dynsym_hdr) return Address(); - Section *dynsym = section_list->FindSectionByID(dynsym_id).get(); - if (!dynsym) - return Address(); - - for (size_t i = 0; i < m_dynamic_symbols.size(); ++i) + SectionSP dynsym_section_sp (section_list->FindSectionByID(dynsym_id)); + if (dynsym_section_sp) { - ELFDynamic &symbol = m_dynamic_symbols[i]; - - if (symbol.d_tag == DT_DEBUG) + for (size_t i = 0; i < m_dynamic_symbols.size(); ++i) { - // Compute the offset as the number of previous entries plus the - // size of d_tag. - addr_t offset = i * dynsym_hdr->sh_entsize + GetAddressByteSize(); - return Address(dynsym, offset); + ELFDynamic &symbol = m_dynamic_symbols[i]; + + if (symbol.d_tag == DT_DEBUG) + { + // Compute the offset as the number of previous entries plus the + // size of d_tag. + addr_t offset = i * dynsym_hdr->sh_entsize + GetAddressByteSize(); + return Address(dynsym_section_sp, offset); + } } } @@ -648,7 +653,6 @@ ObjectFileELF::GetSectionList() SectionSP section(new Section( - 0, // Parent section. GetModule(), // Module to which this section belongs. SectionIndex(I), // Section ID. name, // Section name. @@ -697,7 +701,7 @@ ParseSymbols(Symtab *symtab, if (symbol.Parse(symtab_data, &offset) == false) break; - Section *symbol_section = NULL; + SectionSP symbol_section_sp; SymbolType symbol_type = eSymbolTypeInvalid; Elf64_Half symbol_idx = symbol.st_shndx; @@ -710,7 +714,7 @@ ParseSymbols(Symtab *symtab, symbol_type = eSymbolTypeUndefined; break; default: - symbol_section = section_list->GetSectionAtIndex(symbol_idx).get(); + symbol_section_sp = section_list->GetSectionAtIndex(symbol_idx); break; } @@ -749,9 +753,9 @@ ParseSymbols(Symtab *symtab, if (symbol_type == eSymbolTypeInvalid) { - if (symbol_section) + if (symbol_section_sp) { - const ConstString §_name = symbol_section->GetName(); + const ConstString §_name = symbol_section_sp->GetName(); if (sect_name == text_section_name || sect_name == init_section_name || sect_name == fini_section_name || @@ -772,25 +776,25 @@ ParseSymbols(Symtab *symtab, } uint64_t symbol_value = symbol.st_value; - if (symbol_section != NULL) - symbol_value -= symbol_section->GetFileAddress(); + if (symbol_section_sp) + symbol_value -= symbol_section_sp->GetFileAddress(); const char *symbol_name = strtab_data.PeekCStr(symbol.st_name); bool is_global = symbol.getBinding() == STB_GLOBAL; uint32_t flags = symbol.st_other << 8 | symbol.st_info; Symbol dc_symbol( - i + start_id, // ID is the original symbol table index. - symbol_name, // Symbol name. - false, // Is the symbol name mangled? - symbol_type, // Type of this symbol - is_global, // Is this globally visible? - false, // Is this symbol debug info? - false, // Is this symbol a trampoline? - false, // Is this symbol artificial? - symbol_section, // Section in which this symbol is defined or null. - symbol_value, // Offset in section or symbol value. - symbol.st_size, // Size in bytes of this symbol. - flags); // Symbol flags. + i + start_id, // ID is the original symbol table index. + symbol_name, // Symbol name. + false, // Is the symbol name mangled? + symbol_type, // Type of this symbol + is_global, // Is this globally visible? + false, // Is this symbol debug info? + false, // Is this symbol a trampoline? + false, // Is this symbol artificial? + symbol_section_sp, // Section in which this symbol is defined or null. + symbol_value, // Offset in section or symbol value. + symbol.st_size, // Size in bytes of this symbol. + flags); // Symbol flags. symtab->AddSymbol(dc_symbol); } @@ -929,7 +933,7 @@ ParsePLTRelocations(Symtab *symbol_table, const ELFSectionHeader *rel_hdr, const ELFSectionHeader *plt_hdr, const ELFSectionHeader *sym_hdr, - Section *plt_section, + const lldb::SectionSP &plt_section_sp, DataExtractor &rel_data, DataExtractor &symtab_data, DataExtractor &strtab_data) @@ -982,7 +986,7 @@ ParsePLTRelocations(Symtab *symbol_table, false, // Is this symbol debug info? true, // Is this symbol a trampoline? true, // Is this symbol artificial? - plt_section, // Section in which this symbol is defined or null. + plt_section_sp, // Section in which this symbol is defined or null. plt_index, // Offset in section or symbol value. plt_entsize, // Size in bytes of this symbol. 0); // Symbol flags. @@ -1029,8 +1033,8 @@ ObjectFileELF::ParseTrampolineSymbols(Symtab *symbol_table, if (!rel_section) return 0; - Section *plt_section = section_list->FindSectionByID(plt_id).get(); - if (!plt_section) + SectionSP plt_section_sp (section_list->FindSectionByID(plt_id)); + if (!plt_section_sp) return 0; Section *symtab = section_list->FindSectionByID(symtab_id).get(); @@ -1057,10 +1061,17 @@ ObjectFileELF::ParseTrampolineSymbols(Symtab *symbol_table, if (!rel_type) return 0; - return ParsePLTRelocations(symbol_table, start_id, rel_type, - &m_header, rel_hdr, plt_hdr, sym_hdr, - plt_section, - rel_data, symtab_data, strtab_data); + return ParsePLTRelocations (symbol_table, + start_id, + rel_type, + &m_header, + rel_hdr, + plt_hdr, + sym_hdr, + plt_section_sp, + rel_data, + symtab_data, + strtab_data); } Symtab * diff --git a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.h b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.h index f20b0bdb975..9bf6d734e11 100644 --- a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.h +++ b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.h @@ -45,14 +45,14 @@ public: GetPluginDescriptionStatic(); static lldb_private::ObjectFile * - CreateInstance(lldb_private::Module* module, + CreateInstance(const lldb::ModuleSP &module_sp, lldb::DataBufferSP& dataSP, const lldb_private::FileSpec* file, lldb::addr_t offset, lldb::addr_t length); static lldb_private::ObjectFile * - CreateMemoryInstance (lldb_private::Module* module, + CreateMemoryInstance (const lldb::ModuleSP &module_sp, lldb::DataBufferSP& data_sp, const lldb::ProcessSP &process_sp, lldb::addr_t header_addr); @@ -118,7 +118,7 @@ public: CalculateStrata(); private: - ObjectFileELF(lldb_private::Module* module, + ObjectFileELF(const lldb::ModuleSP &module_sp, lldb::DataBufferSP& dataSP, const lldb_private::FileSpec* file, lldb::addr_t offset, diff --git a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp index 3629e766973..68121b0c17a 100644 --- a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp +++ b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp @@ -364,11 +364,11 @@ ObjectFileMachO::GetPluginDescriptionStatic() ObjectFile * -ObjectFileMachO::CreateInstance (Module* module, DataBufferSP& data_sp, const FileSpec* file, addr_t offset, addr_t length) +ObjectFileMachO::CreateInstance (const lldb::ModuleSP &module_sp, DataBufferSP& data_sp, const FileSpec* file, addr_t offset, addr_t length) { if (ObjectFileMachO::MagicBytesMatch(data_sp, offset, length)) { - std::auto_ptr<ObjectFile> objfile_ap(new ObjectFileMachO (module, data_sp, file, offset, length)); + std::auto_ptr<ObjectFile> objfile_ap(new ObjectFileMachO (module_sp, data_sp, file, offset, length)); if (objfile_ap.get() && objfile_ap->ParseHeader()) return objfile_ap.release(); } @@ -376,14 +376,14 @@ ObjectFileMachO::CreateInstance (Module* module, DataBufferSP& data_sp, const Fi } ObjectFile * -ObjectFileMachO::CreateMemoryInstance (Module* module, +ObjectFileMachO::CreateMemoryInstance (const lldb::ModuleSP &module_sp, DataBufferSP& data_sp, const ProcessSP &process_sp, lldb::addr_t header_addr) { if (ObjectFileMachO::MagicBytesMatch(data_sp, 0, data_sp->GetByteSize())) { - std::auto_ptr<ObjectFile> objfile_ap(new ObjectFileMachO (module, data_sp, process_sp, header_addr)); + std::auto_ptr<ObjectFile> objfile_ap(new ObjectFileMachO (module_sp, data_sp, process_sp, header_addr)); if (objfile_ap.get() && objfile_ap->ParseHeader()) return objfile_ap.release(); } @@ -462,8 +462,8 @@ ObjectFileMachO::MagicBytesMatch (DataBufferSP& data_sp, } -ObjectFileMachO::ObjectFileMachO(Module* module, DataBufferSP& data_sp, const FileSpec* file, addr_t offset, addr_t length) : - ObjectFile(module, file, offset, length, data_sp), +ObjectFileMachO::ObjectFileMachO(const lldb::ModuleSP &module_sp, DataBufferSP& data_sp, const FileSpec* file, addr_t offset, addr_t length) : + ObjectFile(module_sp, file, offset, length, data_sp), m_mutex (Mutex::eMutexTypeRecursive), m_sections_ap(), m_symtab_ap(), @@ -477,11 +477,11 @@ ObjectFileMachO::ObjectFileMachO(Module* module, DataBufferSP& data_sp, const Fi ::memset (&m_dysymtab, 0, sizeof(m_dysymtab)); } -ObjectFileMachO::ObjectFileMachO (lldb_private::Module* module, +ObjectFileMachO::ObjectFileMachO (const lldb::ModuleSP &module_sp, lldb::DataBufferSP& header_data_sp, const lldb::ProcessSP &process_sp, lldb::addr_t header_addr) : - ObjectFile(module, process_sp, header_addr, header_data_sp), + ObjectFile(module_sp, process_sp, header_addr, header_data_sp), m_mutex (Mutex::eMutexTypeRecursive), m_sections_ap(), m_symtab_ap(), @@ -609,10 +609,10 @@ ObjectFileMachO::GetAddressClass (lldb::addr_t file_addr) const AddressRange *range_ptr = symbol->GetAddressRangePtr(); if (range_ptr) { - const Section *section = range_ptr->GetBaseAddress().GetSection(); - if (section) + SectionSP section_sp (range_ptr->GetBaseAddress().GetSection()); + if (section_sp) { - const SectionType section_type = section->GetType(); + const SectionType section_type = section_sp->GetType(); switch (section_type) { case eSectionTypeInvalid: return eAddressClassUnknown; @@ -746,6 +746,7 @@ ObjectFileMachO::ParseSections () uint32_t i; const bool is_core = GetType() == eTypeCoreFile; //bool dump_sections = false; + ModuleSP module_sp (GetModule()); for (i=0; i<m_header.ncmds; ++i) { const uint32_t load_cmd_offset = offset; @@ -775,8 +776,7 @@ ObjectFileMachO::ParseSections () SectionSP segment_sp; if (segment_name || is_core) { - segment_sp.reset(new Section (NULL, - GetModule(), // Module to which this section belongs + segment_sp.reset(new Section (module_sp, // Module to which this section belongs ++segID << 8, // Section ID is the 1 based segment index shifted right by 8 bits as not to collide with any of the 256 section IDs that are possible segment_name, // Name of this section eSectionTypeContainer, // This section is a container of other sections. @@ -872,16 +872,16 @@ ObjectFileMachO::ParseSections () else { // Create a fake section for the section's named segment - segment_sp.reset(new Section(segment_sp.get(), // Parent section - GetModule(), // Module to which this section belongs - ++segID << 8, // Section ID is the 1 based segment index shifted right by 8 bits as not to collide with any of the 256 section IDs that are possible - segment_name, // Name of this section - eSectionTypeContainer, // This section is a container of other sections. - sect64.addr, // File VM address == addresses as they are found in the object file - sect64.size, // VM size in bytes of this section - sect64.offset, // Offset to the data for this section in the file - sect64.offset ? sect64.size : 0, // Size in bytes of this section as found in the the file - load_cmd.flags)); // Flags for this section + segment_sp.reset(new Section (segment_sp, // Parent section + module_sp, // Module to which this section belongs + ++segID << 8, // Section ID is the 1 based segment index shifted right by 8 bits as not to collide with any of the 256 section IDs that are possible + segment_name, // Name of this section + eSectionTypeContainer, // This section is a container of other sections. + sect64.addr, // File VM address == addresses as they are found in the object file + sect64.size, // VM size in bytes of this section + sect64.offset, // Offset to the data for this section in the file + sect64.offset ? sect64.size : 0, // Size in bytes of this section as found in the the file + load_cmd.flags)); // Flags for this section segment_sp->SetIsFake(true); m_sections_ap->AddSection(segment_sp); segment_sp->SetIsEncrypted (segment_is_encrypted); @@ -1000,16 +1000,16 @@ ObjectFileMachO::ParseSections () } } - SectionSP section_sp(new Section(segment_sp.get(), - GetModule(), - ++sectID, - section_name, - sect_type, - sect64.addr - segment_sp->GetFileAddress(), - sect64.size, - sect64.offset, - sect64.offset == 0 ? 0 : sect64.size, - sect64.flags)); + SectionSP section_sp(new Section (segment_sp, + module_sp, + ++sectID, + section_name, + sect_type, + sect64.addr - segment_sp->GetFileAddress(), + sect64.size, + sect64.offset, + sect64.offset == 0 ? 0 : sect64.size, + sect64.flags)); // Set the section to be encrypted to match the segment section_sp->SetIsEncrypted (segment_is_encrypted); @@ -1081,21 +1081,21 @@ public: } - Section * + SectionSP GetSection (uint8_t n_sect, addr_t file_addr) { if (n_sect == 0) - return NULL; + return SectionSP(); if (n_sect < m_section_infos.size()) { - if (m_section_infos[n_sect].section == NULL) + if (!m_section_infos[n_sect].section_sp) { - Section *section = m_section_list->FindSectionByID (n_sect).get(); - m_section_infos[n_sect].section = section; - if (section != NULL) + SectionSP section_sp (m_section_list->FindSectionByID (n_sect)); + m_section_infos[n_sect].section_sp = section_sp; + if (section_sp != NULL) { - m_section_infos[n_sect].vm_range.SetBaseAddress (section->GetFileAddress()); - m_section_infos[n_sect].vm_range.SetByteSize (section->GetByteSize()); + m_section_infos[n_sect].vm_range.SetBaseAddress (section_sp->GetFileAddress()); + m_section_infos[n_sect].vm_range.SetByteSize (section_sp->GetByteSize()); } else { @@ -1105,7 +1105,7 @@ public: if (m_section_infos[n_sect].vm_range.Contains(file_addr)) { // Symbol is in section. - return m_section_infos[n_sect].section; + return m_section_infos[n_sect].section_sp; } else if (m_section_infos[n_sect].vm_range.GetByteSize () == 0 && m_section_infos[n_sect].vm_range.GetBaseAddress() == file_addr) @@ -1113,10 +1113,10 @@ public: // Symbol is in section with zero size, but has the same start // address as the section. This can happen with linker symbols // (symbols that start with the letter 'l' or 'L'. - return m_section_infos[n_sect].section; + return m_section_infos[n_sect].section_sp; } } - return m_section_list->FindSectionContainingFileAddress(file_addr).get(); + return m_section_list->FindSectionContainingFileAddress(file_addr); } protected: @@ -1124,12 +1124,12 @@ protected: { SectionInfo () : vm_range(), - section (NULL) + section_sp () { } VMRange vm_range; - Section *section; + SectionSP section_sp; }; SectionList *m_section_list; std::vector<SectionInfo> m_section_infos; @@ -1307,22 +1307,26 @@ ObjectFileMachO::ParseSymtab (bool minimize) const char *symbol_name = strtab_data.PeekCStr(nlist.n_strx); if (symbol_name == NULL) { + ModuleSP module_sp (GetModule()); // No symbol should be NULL, even the symbols with no // string values should have an offset zero which points // to an empty C-string - Host::SystemLog (Host::eSystemLogError, - "error: symbol[%u] has invalid string table offset 0x%x in %s/%s, ignoring symbol\n", - nlist_idx, - nlist.n_strx, - m_module->GetFileSpec().GetDirectory().GetCString(), - m_module->GetFileSpec().GetFilename().GetCString()); + if (module_sp) + { + Host::SystemLog (Host::eSystemLogError, + "error: symbol[%u] has invalid string table offset 0x%x in %s/%s, ignoring symbol\n", + nlist_idx, + nlist.n_strx, + module_sp->GetFileSpec().GetDirectory().GetCString(), + module_sp->GetFileSpec().GetFilename().GetCString()); + } continue; } const char *symbol_name_non_abi_mangled = NULL; if (symbol_name[0] == '\0') symbol_name = NULL; - Section* symbol_section = NULL; + SectionSP symbol_section; bool add_nlist = true; bool is_debug = ((nlist.n_type & NlistMaskStab) != 0); @@ -2239,14 +2243,18 @@ ObjectFileMachO::GetEntryPointAddress () // We couldn't read the UnixThread load command - maybe it wasn't there. As a fallback look for the // "start" symbol in the main executable. - SymbolContextList contexts; - SymbolContext context; - if (!m_module->FindSymbolsWithNameAndType(ConstString ("start"), eSymbolTypeCode, contexts)) - return m_entry_point_address; + ModuleSP module_sp (GetModule()); - contexts.GetContextAtIndex(0, context); - - m_entry_point_address = context.symbol->GetValue(); + if (module_sp) + { + SymbolContextList contexts; + SymbolContext context; + if (module_sp->FindSymbolsWithNameAndType(ConstString ("start"), eSymbolTypeCode, contexts)) + { + if (contexts.GetContextAtIndex(0, context)) + m_entry_point_address = context.symbol->GetValue(); + } + } } return m_entry_point_address; @@ -2263,7 +2271,7 @@ ObjectFileMachO::GetHeaderAddress () SectionSP text_segment_sp (section_list->FindSectionByName (GetSegmentNameTEXT())); if (text_segment_sp) { - header_addr.SetSection (text_segment_sp.get()); + header_addr.SetSection (text_segment_sp); header_addr.SetOffset (0); } } diff --git a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h index 4ffc7df7961..8376cf3406b 100644 --- a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h +++ b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h @@ -42,14 +42,14 @@ public: GetPluginDescriptionStatic(); static lldb_private::ObjectFile * - CreateInstance (lldb_private::Module* module, + CreateInstance (const lldb::ModuleSP &module_sp, lldb::DataBufferSP& dataSP, const lldb_private::FileSpec* file, lldb::addr_t offset, lldb::addr_t length); static lldb_private::ObjectFile * - CreateMemoryInstance (lldb_private::Module* module, + CreateMemoryInstance (const lldb::ModuleSP &module_sp, lldb::DataBufferSP& data_sp, const lldb::ProcessSP &process_sp, lldb::addr_t header_addr); @@ -62,13 +62,13 @@ public: //------------------------------------------------------------------ // Member Functions //------------------------------------------------------------------ - ObjectFileMachO (lldb_private::Module* module, + ObjectFileMachO (const lldb::ModuleSP &module_sp, lldb::DataBufferSP& dataSP, const lldb_private::FileSpec* file, lldb::addr_t offset, lldb::addr_t length); - ObjectFileMachO (lldb_private::Module* module, + ObjectFileMachO (const lldb::ModuleSP &module_sp, lldb::DataBufferSP& dataSP, const lldb::ProcessSP &process_sp, lldb::addr_t header_addr); diff --git a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp index 7d8dc04ae59..692e24ba9cc 100644 --- a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp +++ b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp @@ -145,11 +145,11 @@ ObjectFilePECOFF::GetPluginDescriptionStatic() ObjectFile * -ObjectFilePECOFF::CreateInstance (Module* module, DataBufferSP& dataSP, const FileSpec* file, addr_t offset, addr_t length) +ObjectFilePECOFF::CreateInstance (const lldb::ModuleSP &module_sp, DataBufferSP& dataSP, const FileSpec* file, addr_t offset, addr_t length) { if (ObjectFilePECOFF::MagicBytesMatch(dataSP)) { - std::auto_ptr<ObjectFile> objfile_ap(new ObjectFilePECOFF (module, dataSP, file, offset, length)); + std::auto_ptr<ObjectFile> objfile_ap(new ObjectFilePECOFF (module_sp, dataSP, file, offset, length)); if (objfile_ap.get() && objfile_ap->ParseHeader()) return objfile_ap.release(); } @@ -157,7 +157,7 @@ ObjectFilePECOFF::CreateInstance (Module* module, DataBufferSP& dataSP, const Fi } ObjectFile * -ObjectFilePECOFF::CreateMemoryInstance (lldb_private::Module* module, +ObjectFilePECOFF::CreateMemoryInstance (const lldb::ModuleSP &module_sp, lldb::DataBufferSP& data_sp, const lldb::ProcessSP &process_sp, lldb::addr_t header_addr) @@ -175,12 +175,12 @@ ObjectFilePECOFF::MagicBytesMatch (DataBufferSP& dataSP) } -ObjectFilePECOFF::ObjectFilePECOFF (Module* module, +ObjectFilePECOFF::ObjectFilePECOFF (const lldb::ModuleSP &module_sp, DataBufferSP& dataSP, const FileSpec* file, addr_t offset, addr_t length) : - ObjectFile (module, file, offset, length, dataSP), + ObjectFile (module_sp, file, offset, length, dataSP), m_mutex (Mutex::eMutexTypeRecursive), m_dos_header (), m_coff_header (), @@ -537,7 +537,7 @@ ObjectFilePECOFF::GetSymtab() symbol.type = symtab_data.GetU16 (&offset); symbol.storage = symtab_data.GetU8 (&offset); symbol.naux = symtab_data.GetU8 (&offset); - Address symbol_addr(sect_list->GetSectionAtIndex(symbol.sect-1).get(), symbol.value); + Address symbol_addr(sect_list->GetSectionAtIndex(symbol.sect-1), symbol.value); symbols[i].GetMangled ().SetValue (symbol_name.c_str(), symbol_name[0]=='_' && symbol_name[1] == 'Z'); symbols[i].SetValue(symbol_addr); @@ -559,7 +559,7 @@ ObjectFilePECOFF::GetSectionList() { m_sections_ap.reset(new SectionList()); const uint32_t nsects = m_sect_headers.size(); - Module *module = GetModule(); + ModuleSP module_sp (GetModule()); for (uint32_t idx = 0; idx<nsects; ++idx) { std::string sect_name; @@ -624,8 +624,7 @@ ObjectFilePECOFF::GetSectionList() // Use a segment ID of the segment index shifted left by 8 so they // never conflict with any of the sections. - SectionSP section_sp (new Section (NULL, - module, // Module to which this section belongs + SectionSP section_sp (new Section (module_sp, // Module to which this section belongs idx + 1, // Section ID is the 1 based segment index shifted right by 8 bits as not to collide with any of the 256 section IDs that are possible const_sect_name, // Name of this section section_type, // This section is a container of other sections. diff --git a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h index a0fb7e2444b..b717a06ae85 100644 --- a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h +++ b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h @@ -36,14 +36,14 @@ public: GetPluginDescriptionStatic(); static ObjectFile * - CreateInstance (lldb_private::Module* module, + CreateInstance (const lldb::ModuleSP &module_sp, lldb::DataBufferSP& dataSP, const lldb_private::FileSpec* file, lldb::addr_t offset, lldb::addr_t length); static lldb_private::ObjectFile * - CreateMemoryInstance (lldb_private::Module* module, + CreateMemoryInstance (const lldb::ModuleSP &module_sp, lldb::DataBufferSP& data_sp, const lldb::ProcessSP &process_sp, lldb::addr_t header_addr); @@ -51,7 +51,7 @@ public: MagicBytesMatch (lldb::DataBufferSP& dataSP); - ObjectFilePECOFF (lldb_private::Module* module, + ObjectFilePECOFF (const lldb::ModuleSP &module_sp, lldb::DataBufferSP& dataSP, const lldb_private::FileSpec* file, lldb::addr_t offset, |