summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/ObjectFile
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2010-07-21 22:54:26 +0000
committerGreg Clayton <gclayton@apple.com>2010-07-21 22:54:26 +0000
commit4ceb9980c867fb3650e0dccd53fe1fe3adbec41d (patch)
tree877ab3d2d40e0acc02ba096d56e229d5d0ff1b72 /lldb/source/Plugins/ObjectFile
parent222f4be834ed7faa2c89ee2d985be282594b1ed1 (diff)
downloadbcm5719-llvm-4ceb9980c867fb3650e0dccd53fe1fe3adbec41d.tar.gz
bcm5719-llvm-4ceb9980c867fb3650e0dccd53fe1fe3adbec41d.zip
Modified both the ObjectFileMachO and ObjectFileELF to correctly set the
SectionType for Section objects for DWARF. Modified the DWARF plug-in to get the DWARF sections by SectionType so we can safely abstract the LLDB core from section names for the various object file formats. Modified the SectionType definitions for .debug_pubnames and .debug_pubtypes to use the correct case. llvm-svn: 109054
Diffstat (limited to 'lldb/source/Plugins/ObjectFile')
-rw-r--r--lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp55
-rw-r--r--lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp51
2 files changed, 87 insertions, 19 deletions
diff --git a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
index c4772202b7a..032fb75c06d 100644
--- a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
+++ b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
@@ -421,17 +421,52 @@ ObjectFileELF::GetSectionList()
ConstString name(m_shstr_data.PeekCStr(header.sh_name));
uint64_t size = header.sh_type == SHT_NOBITS ? 0 : header.sh_size;
+ static ConstString g_sect_name_text (".text");
+ static ConstString g_sect_name_data (".data");
+ static ConstString g_sect_name_bss (".bss");
+ static ConstString g_sect_name_dwarf_debug_abbrev (".debug_abbrev");
+ static ConstString g_sect_name_dwarf_debug_aranges (".debug_aranges");
+ static ConstString g_sect_name_dwarf_debug_frame (".debug_frame");
+ static ConstString g_sect_name_dwarf_debug_info (".debug_info");
+ static ConstString g_sect_name_dwarf_debug_line (".debug_line");
+ static ConstString g_sect_name_dwarf_debug_loc (".debug_loc");
+ static ConstString g_sect_name_dwarf_debug_macinfo (".debug_macinfo");
+ static ConstString g_sect_name_dwarf_debug_pubnames (".debug_pubnames");
+ static ConstString g_sect_name_dwarf_debug_pubtypes (".debug_pubtypes");
+ static ConstString g_sect_name_dwarf_debug_ranges (".debug_ranges");
+ static ConstString g_sect_name_dwarf_debug_str (".debug_str");
+ static ConstString g_sect_name_eh_frame (".eh_frame");
+
+ SectionType sect_type = eSectionTypeOther;
+
+ if (name == g_sect_name_text) sect_type = eSectionTypeCode;
+ else if (name == g_sect_name_data) sect_type = eSectionTypeData;
+ else if (name == g_sect_name_bss) sect_type = eSectionTypeZeroFill;
+ else if (name == g_sect_name_dwarf_debug_abbrev) sect_type = eSectionTypeDWARFDebugAbbrev;
+ else if (name == g_sect_name_dwarf_debug_aranges) sect_type = eSectionTypeDWARFDebugAranges;
+ else if (name == g_sect_name_dwarf_debug_frame) sect_type = eSectionTypeDWARFDebugFrame;
+ else if (name == g_sect_name_dwarf_debug_info) sect_type = eSectionTypeDWARFDebugInfo;
+ else if (name == g_sect_name_dwarf_debug_line) sect_type = eSectionTypeDWARFDebugLine;
+ else if (name == g_sect_name_dwarf_debug_loc) sect_type = eSectionTypeDWARFDebugLoc;
+ else if (name == g_sect_name_dwarf_debug_macinfo) sect_type = eSectionTypeDWARFDebugMacInfo;
+ else if (name == g_sect_name_dwarf_debug_pubnames) sect_type = eSectionTypeDWARFDebugPubNames;
+ else if (name == g_sect_name_dwarf_debug_pubtypes) sect_type = eSectionTypeDWARFDebugPubTypes;
+ else if (name == g_sect_name_dwarf_debug_ranges) sect_type = eSectionTypeDWARFDebugRanges;
+ else if (name == g_sect_name_dwarf_debug_str) sect_type = eSectionTypeDWARFDebugStr;
+ else if (name == g_sect_name_eh_frame) sect_type = eSectionTypeEHFrame;
+
+
SectionSP section(new Section(
- 0, // Parent section.
- GetModule(), // Module to which this section belongs.
- SectionIndex(I), // Section ID.
- name, // Section name.
- eSectionTypeOther, // FIXME: Fill in as appropriate.
- header.sh_addr, // VM address.
- header.sh_size, // VM size in bytes of this section.
- header.sh_offset, // Offset of this section in the file.
- size, // Size of the section as found in the file.
- header.sh_flags)); // Flags for this section.
+ 0, // Parent section.
+ GetModule(), // Module to which this section belongs.
+ SectionIndex(I), // Section ID.
+ name, // Section name.
+ sect_type, // Section type.
+ header.sh_addr, // VM address.
+ header.sh_size, // VM size in bytes of this section.
+ header.sh_offset, // Offset of this section in the file.
+ size, // Size of the section as found in the file.
+ header.sh_flags)); // Flags for this section.
m_sections_ap->AddSection(section);
}
diff --git a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
index de5c73c84b4..c0d7eecef23 100644
--- a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
+++ b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
@@ -373,16 +373,53 @@ ObjectFileMachO::ParseSections ()
static ConstString g_sect_name_objc_const ("__objc_const");
static ConstString g_sect_name_objc_classlist ("__objc_classlist");
static ConstString g_sect_name_cfstring ("__cfstring");
+
+ static ConstString g_sect_name_dwarf_debug_abbrev ("__debug_abbrev");
+ static ConstString g_sect_name_dwarf_debug_aranges ("__debug_aranges");
+ static ConstString g_sect_name_dwarf_debug_frame ("__debug_frame");
+ static ConstString g_sect_name_dwarf_debug_info ("__debug_info");
+ static ConstString g_sect_name_dwarf_debug_line ("__debug_line");
+ static ConstString g_sect_name_dwarf_debug_loc ("__debug_loc");
+ static ConstString g_sect_name_dwarf_debug_macinfo ("__debug_macinfo");
+ static ConstString g_sect_name_dwarf_debug_pubnames ("__debug_pubnames");
+ static ConstString g_sect_name_dwarf_debug_pubtypes ("__debug_pubtypes");
+ static ConstString g_sect_name_dwarf_debug_ranges ("__debug_ranges");
+ static ConstString g_sect_name_dwarf_debug_str ("__debug_str");
+ static ConstString g_sect_name_eh_frame ("__eh_frame");
+
SectionType sect_type = eSectionTypeOther;
- if (section_name == g_sect_name_objc_selrefs)
- {
+
+ if (section_name == g_sect_name_dwarf_debug_abbrev)
+ sect_type = eSectionTypeDWARFDebugAbbrev;
+ else if (section_name == g_sect_name_dwarf_debug_aranges)
+ sect_type = eSectionTypeDWARFDebugAranges;
+ else if (section_name == g_sect_name_dwarf_debug_frame)
+ sect_type = eSectionTypeDWARFDebugFrame;
+ else if (section_name == g_sect_name_dwarf_debug_info)
+ sect_type = eSectionTypeDWARFDebugInfo;
+ else if (section_name == g_sect_name_dwarf_debug_line)
+ sect_type = eSectionTypeDWARFDebugLine;
+ else if (section_name == g_sect_name_dwarf_debug_loc)
+ sect_type = eSectionTypeDWARFDebugLoc;
+ else if (section_name == g_sect_name_dwarf_debug_macinfo)
+ sect_type = eSectionTypeDWARFDebugMacInfo;
+ else if (section_name == g_sect_name_dwarf_debug_pubnames)
+ sect_type = eSectionTypeDWARFDebugPubNames;
+ else if (section_name == g_sect_name_dwarf_debug_pubtypes)
+ sect_type = eSectionTypeDWARFDebugPubTypes;
+ else if (section_name == g_sect_name_dwarf_debug_ranges)
+ sect_type = eSectionTypeDWARFDebugRanges;
+ else if (section_name == g_sect_name_dwarf_debug_str)
+ sect_type = eSectionTypeDWARFDebugStr;
+ else if (section_name == g_sect_name_objc_selrefs)
sect_type = eSectionTypeDataCStringPointers;
- }
else if (section_name == g_sect_name_objc_msgrefs)
- {
sect_type = eSectionTypeDataObjCMessageRefs;
- }
+ else if (section_name == g_sect_name_eh_frame)
+ sect_type = eSectionTypeEHFrame;
+ else if (section_name == g_sect_name_cfstring)
+ sect_type = eSectionTypeDataObjCCFStrings;
else if (section_name == g_sect_name_objc_data ||
section_name == g_sect_name_objc_classrefs ||
section_name == g_sect_name_objc_superrefs ||
@@ -391,10 +428,6 @@ ObjectFileMachO::ParseSections ()
{
sect_type = eSectionTypeDataPointers;
}
- else if (section_name == g_sect_name_cfstring)
- {
- sect_type = eSectionTypeDataObjCCFStrings;
- }
if (sect_type == eSectionTypeOther)
{
OpenPOWER on IntegriCloud