[Lldb-commits] [lldb] r153496 - in /lldb/trunk/source: Plugins/ObjectFile/ELF/ObjectFileELF.cpp Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Symbol/ObjectFile.cpp
Greg Clayton
gclayton at apple.com
Mon Mar 26 19:40:46 PDT 2012
Author: gclayton
Date: Mon Mar 26 21:40:46 2012
New Revision: 153496
URL: http://llvm.org/viewvc/llvm-project?rev=153496&view=rev
Log:
Fixed a few things in the ELF object file:
1 - sections only get a valid VM size if they have SHF_ALLOC in the section flags
2 - symbol names are marked as mangled if they start with "_Z"
Also fixed the DWARF parser to correctly use the section file size when extracting the DWARF.
Modified:
lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/trunk/source/Symbol/ObjectFile.cpp
Modified: lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp?rev=153496&r1=153495&r2=153496&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp (original)
+++ lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp Mon Mar 26 21:40:46 2012
@@ -615,7 +615,8 @@
const ELFSectionHeader &header = *I;
ConstString name(m_shstr_data.PeekCStr(header.sh_name));
- uint64_t size = header.sh_type == SHT_NOBITS ? 0 : header.sh_size;
+ const uint64_t file_size = header.sh_type == SHT_NOBITS ? 0 : header.sh_size;
+ const uint64_t vm_size = header.sh_flags & SHF_ALLOC ? header.sh_size : 0;
static ConstString g_sect_name_text (".text");
static ConstString g_sect_name_data (".data");
@@ -658,9 +659,9 @@
name, // Section name.
sect_type, // Section type.
header.sh_addr, // VM address.
- header.sh_size, // VM size in bytes of this section.
+ vm_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.
+ file_size, // Size of the section as found in the file.
header.sh_flags)); // Flags for this section.
m_sections_ap->AddSection(section);
@@ -781,11 +782,11 @@
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;
-
+ bool is_mangled = symbol_name ? (symbol_name[0] == '_' && symbol_name[1] == 'Z') : false;
Symbol dc_symbol(
i + start_id, // ID is the original symbol table index.
symbol_name, // Symbol name.
- false, // Is the symbol name mangled?
+ is_mangled, // Is the symbol name mangled?
symbol_type, // Type of this symbol
is_global, // Is this globally visible?
false, // Is this symbol debug info?
@@ -976,11 +977,12 @@
break;
const char *symbol_name = strtab_data.PeekCStr(symbol.st_name);
+ bool is_mangled = symbol_name ? (symbol_name[0] == '_' && symbol_name[1] == 'Z') : false;
Symbol jump_symbol(
i + start_id, // Symbol table index
symbol_name, // symbol name.
- false, // is the symbol name mangled?
+ is_mangled, // is the symbol name mangled?
eSymbolTypeTrampoline, // Type of this symbol
false, // Is this globally visible?
false, // Is this symbol debug info?
Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp?rev=153496&r1=153495&r2=153496&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Mon Mar 26 21:40:46 2012
@@ -439,65 +439,65 @@
section = section_list->FindSectionByType (eSectionTypeDWARFDebugInfo, true).get();
if (section != NULL)
{
- debug_info_file_size = section->GetByteSize();
+ debug_info_file_size = section->GetFileSize();
section = section_list->FindSectionByType (eSectionTypeDWARFDebugAbbrev, true).get();
if (section)
- debug_abbrev_file_size = section->GetByteSize();
+ debug_abbrev_file_size = section->GetFileSize();
else
m_flags.Set (flagsGotDebugAbbrevData);
section = section_list->FindSectionByType (eSectionTypeDWARFDebugAranges, true).get();
if (section)
- debug_aranges_file_size = section->GetByteSize();
+ debug_aranges_file_size = section->GetFileSize();
else
m_flags.Set (flagsGotDebugArangesData);
section = section_list->FindSectionByType (eSectionTypeDWARFDebugFrame, true).get();
if (section)
- debug_frame_file_size = section->GetByteSize();
+ debug_frame_file_size = section->GetFileSize();
else
m_flags.Set (flagsGotDebugFrameData);
section = section_list->FindSectionByType (eSectionTypeDWARFDebugLine, true).get();
if (section)
- debug_line_file_size = section->GetByteSize();
+ debug_line_file_size = section->GetFileSize();
else
m_flags.Set (flagsGotDebugLineData);
section = section_list->FindSectionByType (eSectionTypeDWARFDebugLoc, true).get();
if (section)
- debug_loc_file_size = section->GetByteSize();
+ debug_loc_file_size = section->GetFileSize();
else
m_flags.Set (flagsGotDebugLocData);
section = section_list->FindSectionByType (eSectionTypeDWARFDebugMacInfo, true).get();
if (section)
- debug_macinfo_file_size = section->GetByteSize();
+ debug_macinfo_file_size = section->GetFileSize();
else
m_flags.Set (flagsGotDebugMacInfoData);
section = section_list->FindSectionByType (eSectionTypeDWARFDebugPubNames, true).get();
if (section)
- debug_pubnames_file_size = section->GetByteSize();
+ debug_pubnames_file_size = section->GetFileSize();
else
m_flags.Set (flagsGotDebugPubNamesData);
section = section_list->FindSectionByType (eSectionTypeDWARFDebugPubTypes, true).get();
if (section)
- debug_pubtypes_file_size = section->GetByteSize();
+ debug_pubtypes_file_size = section->GetFileSize();
else
m_flags.Set (flagsGotDebugPubTypesData);
section = section_list->FindSectionByType (eSectionTypeDWARFDebugRanges, true).get();
if (section)
- debug_ranges_file_size = section->GetByteSize();
+ debug_ranges_file_size = section->GetFileSize();
else
m_flags.Set (flagsGotDebugRangesData);
section = section_list->FindSectionByType (eSectionTypeDWARFDebugStr, true).get();
if (section)
- debug_str_file_size = section->GetByteSize();
+ debug_str_file_size = section->GetFileSize();
else
m_flags.Set (flagsGotDebugStrData);
}
@@ -541,7 +541,7 @@
// See if we memory mapped the DWARF segment?
if (m_dwarf_data.GetByteSize())
{
- data.SetData(m_dwarf_data, section_sp->GetOffset (), section_sp->GetByteSize());
+ data.SetData(m_dwarf_data, section_sp->GetOffset (), section_sp->GetFileSize());
}
else
{
Modified: lldb/trunk/source/Symbol/ObjectFile.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ObjectFile.cpp?rev=153496&r1=153495&r2=153496&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/ObjectFile.cpp (original)
+++ lldb/trunk/source/Symbol/ObjectFile.cpp Mon Mar 26 21:40:46 2012
@@ -449,7 +449,7 @@
else
{
// The object file now contains a full mmap'ed copy of the object file data, so just use this
- return GetData(section->GetFileOffset(), section->GetByteSize(), section_data);
+ return GetData(section->GetFileOffset(), section->GetFileSize(), section_data);
}
section_data.Clear();
return 0;
More information about the lldb-commits
mailing list