summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/ObjectFile
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/Plugins/ObjectFile')
-rw-r--r--lldb/source/Plugins/ObjectFile/ELF/ELFHeader.cpp7
-rw-r--r--lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp341
-rw-r--r--lldb/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp13
-rw-r--r--lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp673
-rw-r--r--lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp12
5 files changed, 459 insertions, 587 deletions
diff --git a/lldb/source/Plugins/ObjectFile/ELF/ELFHeader.cpp b/lldb/source/Plugins/ObjectFile/ELF/ELFHeader.cpp
index 39ea4920870..16cbb6e5753 100644
--- a/lldb/source/Plugins/ObjectFile/ELF/ELFHeader.cpp
+++ b/lldb/source/Plugins/ObjectFile/ELF/ELFHeader.cpp
@@ -140,13 +140,12 @@ bool ELFHeader::Parse(lldb_private::DataExtractor &data,
if (data.GetU32(offset, &e_flags, 1) == NULL)
return false;
- // Read e_ehsize, e_phentsize, e_phnum, e_shentsize, e_shnum and
- // e_shstrndx.
+ // Read e_ehsize, e_phentsize, e_phnum, e_shentsize, e_shnum and e_shstrndx.
if (data.GetU16(offset, &e_ehsize, 6) == NULL)
return false;
- // Initialize e_phnum, e_shnum, and e_shstrndx with the values
- // read from the header.
+ // Initialize e_phnum, e_shnum, and e_shstrndx with the values read from the
+ // header.
e_phnum = e_phnum_hdr;
e_shnum = e_shnum_hdr;
e_shstrndx = e_shstrndx_hdr;
diff --git a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
index 61186aebfc6..923a74935a7 100644
--- a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
+++ b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
@@ -240,11 +240,10 @@ bool ELFNote::Parse(const DataExtractor &data, lldb::offset_t *offset) {
if (data.GetU32(offset, &n_namesz, 3) == NULL)
return false;
- // The name field is required to be nul-terminated, and n_namesz
- // includes the terminating nul in observed implementations (contrary
- // to the ELF-64 spec). A special case is needed for cores generated
- // by some older Linux versions, which write a note named "CORE"
- // without a nul terminator and n_namesz = 4.
+ // The name field is required to be nul-terminated, and n_namesz includes the
+ // terminating nul in observed implementations (contrary to the ELF-64 spec).
+ // A special case is needed for cores generated by some older Linux versions,
+ // which write a note named "CORE" without a nul terminator and n_namesz = 4.
if (n_namesz == 4) {
char buf[4];
if (data.ExtractBytes(*offset, 4, data.GetByteOrder(), buf) != 4)
@@ -295,7 +294,8 @@ static uint32_t mipsVariantFromElfFlags (const elf::ELFHeader &header) {
uint32_t arch_variant = ArchSpec::eMIPSSubType_unknown;
uint32_t fileclass = header.e_ident[EI_CLASS];
- // If there aren't any elf flags available (e.g core elf file) then return default
+ // If there aren't any elf flags available (e.g core elf file) then return
+ // default
// 32 or 64 bit arch (without any architecture revision) based on object file's class.
if (header.e_type == ET_CORE) {
switch (fileclass) {
@@ -549,8 +549,8 @@ uint32_t ObjectFileELF::CalculateELFNotesSegmentsCRC32(
DataExtractor segment_data;
if (segment_data.SetData(object_data, ph_offset, ph_size) != ph_size) {
- // The ELF program header contained incorrect data,
- // probably corefile is incomplete or corrupted.
+ // The ELF program header contained incorrect data, probably corefile
+ // is incomplete or corrupted.
break;
}
@@ -595,8 +595,8 @@ static const char *OSABIAsCString(unsigned char osabi_byte) {
//
// WARNING : This function is being deprecated
-// It's functionality has moved to ArchSpec::SetArchitecture
-// This function is only being kept to validate the move.
+// It's functionality has moved to ArchSpec::SetArchitecture This function is
+// only being kept to validate the move.
//
// TODO : Remove this function
static bool GetOsFromOSABI(unsigned char osabi_byte,
@@ -677,10 +677,10 @@ size_t ObjectFileELF::GetModuleSpecifications(
data_sp = MapFileData(file, -1, file_offset);
if (data_sp)
data.SetData(data_sp);
- // In case there is header extension in the section #0, the header
- // we parsed above could have sentinel values for e_phnum, e_shnum,
- // and e_shstrndx. In this case we need to reparse the header
- // with a bigger data source to get the actual values.
+ // In case there is header extension in the section #0, the header we
+ // parsed above could have sentinel values for e_phnum, e_shnum, and
+ // e_shstrndx. In this case we need to reparse the header with a
+ // bigger data source to get the actual values.
if (header.HasHeaderExtension()) {
lldb::offset_t header_offset = data_offset;
header.Parse(data, &header_offset);
@@ -736,8 +736,8 @@ size_t ObjectFileELF::GetModuleSpecifications(
uuid.SetBytes(uuidt, sizeof(uuidt));
} else if (core_notes_crc) {
// Use 8 bytes - first 4 bytes for *magic* prefix, mainly to make
- // it look different form
- // .gnu_debuglink crc followed by 4 bytes of note segments crc.
+ // it look different form .gnu_debuglink crc followed by 4 bytes
+ // of note segments crc.
uint32_t uuidt[4] = {g_core_uuid_magic, core_notes_crc, 0, 0};
uuid.SetBytes(uuidt, sizeof(uuidt));
}
@@ -823,21 +823,19 @@ bool ObjectFileELF::SetLoadAddress(Target &target, lldb::addr_t value,
size_t sect_idx = 0;
for (sect_idx = 0; sect_idx < num_sections; ++sect_idx) {
- // Iterate through the object file sections to find all
- // of the sections that have SHF_ALLOC in their flag bits.
+ // Iterate through the object file sections to find all of the sections
+ // that have SHF_ALLOC in their flag bits.
SectionSP section_sp(section_list->GetSectionAtIndex(sect_idx));
if (section_sp && section_sp->Test(SHF_ALLOC)) {
lldb::addr_t load_addr = section_sp->GetFileAddress();
// We don't want to update the load address of a section with type
// eSectionTypeAbsoluteAddress as they already have the absolute load
- // address
- // already specified
+ // address already specified
if (section_sp->GetType() != eSectionTypeAbsoluteAddress)
load_addr += value;
// On 32-bit systems the load address have to fit into 4 bytes. The
- // rest of
- // the bytes are the overflow from the addition.
+ // rest of the bytes are the overflow from the addition.
if (GetAddressByteSize() == 4)
load_addr &= 0xFFFFFFFF;
@@ -869,9 +867,8 @@ AddressClass ObjectFileELF::GetAddressClass(addr_t file_addr) {
if (!symtab)
return eAddressClassUnknown;
- // The address class is determined based on the symtab. Ask it from the object
- // file what
- // contains the symtab information.
+ // The address class is determined based on the symtab. Ask it from the
+ // object file what contains the symtab information.
ObjectFile *symtab_objfile = symtab->GetObjectFile();
if (symtab_objfile != nullptr && symtab_objfile != this)
return symtab_objfile->GetAddressClass(file_addr);
@@ -882,8 +879,8 @@ AddressClass ObjectFileELF::GetAddressClass(addr_t file_addr) {
auto ub = m_address_class_map.upper_bound(file_addr);
if (ub == m_address_class_map.begin()) {
- // No entry in the address class map before the address. Return
- // default address class for an address in a code section.
+ // No entry in the address class map before the address. Return default
+ // address class for an address in a code section.
return eAddressClassCode;
}
@@ -925,8 +922,8 @@ bool ObjectFileELF::GetUUID(lldb_private::UUID *uuid) {
core_notes_crc = CalculateELFNotesSegmentsCRC32(m_program_headers, m_data);
if (core_notes_crc) {
- // Use 8 bytes - first 4 bytes for *magic* prefix, mainly to make it
- // look different form .gnu_debuglink crc - followed by 4 bytes of note
+ // Use 8 bytes - first 4 bytes for *magic* prefix, mainly to make it look
+ // different form .gnu_debuglink crc - followed by 4 bytes of note
// segments crc.
uint32_t uuidt[4] = {g_core_uuid_magic, core_notes_crc, 0, 0};
m_uuid.SetBytes(uuidt, sizeof(uuidt));
@@ -996,8 +993,8 @@ Address ObjectFileELF::GetImageInfoAddress(Target *target) {
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.
+ // 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);
}
@@ -1330,8 +1327,8 @@ ObjectFileELF::RefineModuleDetailsFromNote(lldb_private::DataExtractor &data,
arch_spec.GetTriple().setVendor(llvm::Triple::VendorType::CSR);
// TODO At some point the description string could be processed.
- // It could provide a steer towards the kalimba variant which
- // this ELF targets.
+ // It could provide a steer towards the kalimba variant which this ELF
+ // targets.
if (note.n_descsz) {
const char *cstr =
data.GetCStr(&offset, llvm::alignTo(note.n_descsz, 4));
@@ -1346,36 +1343,28 @@ ObjectFileELF::RefineModuleDetailsFromNote(lldb_private::DataExtractor &data,
// register info
arch_spec.GetTriple().setOS(llvm::Triple::OSType::Linux);
} else if (note.n_name == LLDB_NT_OWNER_CORE) {
- // Parse the NT_FILE to look for stuff in paths to shared libraries
- // As the contents look like this in a 64 bit ELF core file:
- // count = 0x000000000000000a (10)
- // page_size = 0x0000000000001000 (4096)
- // Index start end file_ofs path
- // ===== ------------------ ------------------ ------------------
- // -------------------------------------
- // [ 0] 0x0000000000400000 0x0000000000401000 0x0000000000000000
- // /tmp/a.out
- // [ 1] 0x0000000000600000 0x0000000000601000 0x0000000000000000
- // /tmp/a.out
- // [ 2] 0x0000000000601000 0x0000000000602000 0x0000000000000001
- // /tmp/a.out
+ // Parse the NT_FILE to look for stuff in paths to shared libraries As
+ // the contents look like this in a 64 bit ELF core file: count =
+ // 0x000000000000000a (10) page_size = 0x0000000000001000 (4096) Index
+ // start end file_ofs path =====
+ // ------------------ ------------------ ------------------
+ // ------------------------------------- [ 0] 0x0000000000400000
+ // 0x0000000000401000 0x0000000000000000 /tmp/a.out [ 1]
+ // 0x0000000000600000 0x0000000000601000 0x0000000000000000 /tmp/a.out [
+ // 2] 0x0000000000601000 0x0000000000602000 0x0000000000000001 /tmp/a.out
// [ 3] 0x00007fa79c9ed000 0x00007fa79cba8000 0x0000000000000000
- // /lib/x86_64-linux-gnu/libc-2.19.so
- // [ 4] 0x00007fa79cba8000 0x00007fa79cda7000 0x00000000000001bb
- // /lib/x86_64-linux-gnu/libc-2.19.so
- // [ 5] 0x00007fa79cda7000 0x00007fa79cdab000 0x00000000000001ba
- // /lib/x86_64-linux-gnu/libc-2.19.so
- // [ 6] 0x00007fa79cdab000 0x00007fa79cdad000 0x00000000000001be
- // /lib/x86_64-linux-gnu/libc-2.19.so
- // [ 7] 0x00007fa79cdb2000 0x00007fa79cdd5000 0x0000000000000000
- // /lib/x86_64-linux-gnu/ld-2.19.so
- // [ 8] 0x00007fa79cfd4000 0x00007fa79cfd5000 0x0000000000000022
- // /lib/x86_64-linux-gnu/ld-2.19.so
- // [ 9] 0x00007fa79cfd5000 0x00007fa79cfd6000 0x0000000000000023
- // /lib/x86_64-linux-gnu/ld-2.19.so
- // In the 32 bit ELFs the count, page_size, start, end, file_ofs are
- // uint32_t
- // For reference: see readelf source code (in binutils).
+ // /lib/x86_64-linux-gnu/libc-2.19.so [ 4] 0x00007fa79cba8000
+ // 0x00007fa79cda7000 0x00000000000001bb /lib/x86_64-linux-
+ // gnu/libc-2.19.so [ 5] 0x00007fa79cda7000 0x00007fa79cdab000
+ // 0x00000000000001ba /lib/x86_64-linux-gnu/libc-2.19.so [ 6]
+ // 0x00007fa79cdab000 0x00007fa79cdad000 0x00000000000001be /lib/x86_64
+ // -linux-gnu/libc-2.19.so [ 7] 0x00007fa79cdb2000 0x00007fa79cdd5000
+ // 0x0000000000000000 /lib/x86_64-linux-gnu/ld-2.19.so [ 8]
+ // 0x00007fa79cfd4000 0x00007fa79cfd5000 0x0000000000000022 /lib/x86_64
+ // -linux-gnu/ld-2.19.so [ 9] 0x00007fa79cfd5000 0x00007fa79cfd6000
+ // 0x0000000000000023 /lib/x86_64-linux-gnu/ld-2.19.so In the 32 bit ELFs
+ // the count, page_size, start, end, file_ofs are uint32_t For reference:
+ // see readelf source code (in binutils).
if (note.n_type == NT_FILE) {
uint64_t count = data.GetAddress(&offset);
const char *cstr;
@@ -1399,15 +1388,14 @@ ObjectFileELF::RefineModuleDetailsFromNote(lldb_private::DataExtractor &data,
}
if (arch_spec.IsMIPS() &&
arch_spec.GetTriple().getOS() == llvm::Triple::OSType::UnknownOS)
- // In case of MIPSR6, the LLDB_NT_OWNER_GNU note is missing
- // for some cases (e.g. compile with -nostdlib)
- // Hence set OS to Linux
+ // In case of MIPSR6, the LLDB_NT_OWNER_GNU note is missing for some
+ // cases (e.g. compile with -nostdlib) Hence set OS to Linux
arch_spec.GetTriple().setOS(llvm::Triple::OSType::Linux);
}
}
- // Calculate the offset of the next note just in case "offset" has been used
- // to poke at the contents of the note data
+ // Calculate the offset of the next note just in case "offset" has been
+ // used to poke at the contents of the note data
offset = note_offset + note.GetByteSize();
}
@@ -1507,13 +1495,12 @@ size_t ObjectFileELF::GetSectionHeaderInfo(SectionHeaderColl &section_headers,
arch_spec.SetArchitecture(eArchTypeELF, header.e_machine, sub_type,
header.e_ident[EI_OSABI]);
- // Validate if it is ok to remove GetOsFromOSABI.
- // Note, that now the OS is determined based on EI_OSABI flag and
- // the info extracted from ELF notes (see RefineModuleDetailsFromNote).
- // However in some cases that still might be not enough: for example
- // a shared library might not have any notes at all
- // and have EI_OSABI flag set to System V,
- // as result the OS will be set to UnknownOS.
+ // Validate if it is ok to remove GetOsFromOSABI. Note, that now the OS is
+ // determined based on EI_OSABI flag and the info extracted from ELF notes
+ // (see RefineModuleDetailsFromNote). However in some cases that still
+ // might be not enough: for example a shared library might not have any
+ // notes at all and have EI_OSABI flag set to System V, as result the OS
+ // will be set to UnknownOS.
GetOsFromOSABI(header.e_ident[EI_OSABI], ostype);
spec_ostype = arch_spec.GetTriple().getOS();
assert(spec_ostype == ostype);
@@ -1844,23 +1831,19 @@ void ObjectFileELF::CreateSections(SectionList &unified_section_list) {
}
// .debug_abbrev – Abbreviations used in the .debug_info section
// .debug_aranges – Lookup table for mapping addresses to compilation
- // units
- // .debug_frame – Call frame information
- // .debug_info – The core DWARF information section
- // .debug_line – Line number information
+ // units .debug_frame – Call frame information .debug_info – The core
+ // DWARF information section .debug_line – Line number information
// .debug_loc – Location lists used in DW_AT_location attributes
- // .debug_macinfo – Macro information
- // .debug_pubnames – Lookup table for mapping object and function names to
- // compilation units
+ // .debug_macinfo – Macro information .debug_pubnames – Lookup table
+ // for mapping object and function names to compilation units
// .debug_pubtypes – Lookup table for mapping type names to compilation
- // units
- // .debug_ranges – Address ranges used in DW_AT_ranges attributes
- // .debug_str – String table used in .debug_info
- // MISSING? .gnu_debugdata - "mini debuginfo / MiniDebugInfo" section,
- // http://sourceware.org/gdb/onlinedocs/gdb/MiniDebugInfo.html
- // MISSING? .debug-index -
- // http://src.chromium.org/viewvc/chrome/trunk/src/build/gdb-add-index?pathrev=144644
- // MISSING? .debug_types - Type descriptions from DWARF 4? See
+ // units .debug_ranges – Address ranges used in DW_AT_ranges attributes
+ // .debug_str – String table used in .debug_info MISSING?
+ // .gnu_debugdata - "mini debuginfo / MiniDebugInfo" section,
+ // http://sourceware.org/gdb/onlinedocs/gdb/MiniDebugInfo.html MISSING?
+ // .debug-index - http://src.chromium.org/viewvc/chrome/trunk/src/build
+ // /gdb-add-index?pathrev=144644 MISSING? .debug_types - Type
+ // descriptions from DWARF 4? See
// http://gcc.gnu.org/wiki/DwarfSeparateTypeInfo
else if (name == g_sect_name_dwarf_debug_abbrev)
sect_type = eSectionTypeDWARFDebugAbbrev;
@@ -1943,10 +1926,8 @@ void ObjectFileELF::CreateSections(SectionList &unified_section_list) {
if (eSectionTypeOther == sect_type) {
// the kalimba toolchain assumes that ELF section names are free-form.
- // It does
- // support linkscripts which (can) give rise to various arbitrarily
- // named
- // sections being "Code" or "Data".
+ // It does support linkscripts which (can) give rise to various
+ // arbitrarily named sections being "Code" or "Data".
sect_type = kalimbaSectionType(m_header, header);
}
@@ -2006,11 +1987,9 @@ void ObjectFileELF::CreateSections(SectionList &unified_section_list) {
}
// Find the arm/aarch64 mapping symbol character in the given symbol name.
-// Mapping symbols have the
-// form of "$<char>[.<any>]*". Additionally we recognize cases when the mapping
-// symbol prefixed by
-// an arbitrary string because if a symbol prefix added to each symbol in the
-// object file with
+// Mapping symbols have the form of "$<char>[.<any>]*". Additionally we
+// recognize cases when the mapping symbol prefixed by an arbitrary string
+// because if a symbol prefix added to each symbol in the object file with
// objcopy then the mapping symbols are also prefixed.
static char FindArmAarch64MappingSymbol(const char *symbol_name) {
if (!symbol_name)
@@ -2052,19 +2031,15 @@ unsigned ObjectFileELF::ParseSymbols(Symtab *symtab, user_id_t start_id,
static ConstString opd_section_name(".opd"); // For ppc64
// On Android the oatdata and the oatexec symbols in the oat and odex files
- // covers the full
- // .text section what causes issues with displaying unusable symbol name to
- // the user and very
- // slow unwinding speed because the instruction emulation based unwind plans
- // try to emulate all
- // instructions in these symbols. Don't add these symbols to the symbol list
- // as they have no
- // use for the debugger and they are causing a lot of trouble.
- // Filtering can't be restricted to Android because this special object file
- // don't contain the
- // note section specifying the environment to Android but the custom extension
- // and file name
- // makes it highly unlikely that this will collide with anything else.
+ // covers the full .text section what causes issues with displaying unusable
+ // symbol name to the user and very slow unwinding speed because the
+ // instruction emulation based unwind plans try to emulate all instructions
+ // in these symbols. Don't add these symbols to the symbol list as they have
+ // no use for the debugger and they are causing a lot of trouble. Filtering
+ // can't be restricted to Android because this special object file don't
+ // contain the note section specifying the environment to Android but the
+ // custom extension and file name makes it highly unlikely that this will
+ // collide with anything else.
ConstString file_extension = m_file.GetFileNameExtension();
bool skip_oatdata_oatexec = file_extension == ConstString("oat") ||
file_extension == ConstString("odex");
@@ -2076,8 +2051,8 @@ unsigned ObjectFileELF::ParseSymbols(Symtab *symtab, user_id_t start_id,
module_sp ? module_sp->GetSectionList() : nullptr;
// Local cache to avoid doing a FindSectionByName for each symbol. The "const
- // char*" key must
- // came from a ConstString object so they can be compared by pointer
+ // char*" key must came from a ConstString object so they can be compared by
+ // pointer
std::unordered_map<const char *, lldb::SectionSP> section_name_to_section;
unsigned i;
@@ -2095,8 +2070,7 @@ unsigned ObjectFileELF::ParseSymbols(Symtab *symtab, user_id_t start_id,
continue;
// Skipping oatdata and oatexec sections if it is requested. See details
- // above the
- // definition of skip_oatdata_oatexec for the reasons.
+ // above the definition of skip_oatdata_oatexec for the reasons.
if (skip_oatdata_oatexec && (::strcmp(symbol_name, "oatdata") == 0 ||
::strcmp(symbol_name, "oatexec") == 0))
continue;
@@ -2127,8 +2101,8 @@ unsigned ObjectFileELF::ParseSymbols(Symtab *symtab, user_id_t start_id,
break;
case STT_OBJECT:
- // The symbol is associated with a data object, such as a variable,
- // an array, etc.
+ // The symbol is associated with a data object, such as a variable, an
+ // array, etc.
symbol_type = eSymbolTypeData;
break;
@@ -2139,13 +2113,13 @@ unsigned ObjectFileELF::ParseSymbols(Symtab *symtab, user_id_t start_id,
case STT_SECTION:
// The symbol is associated with a section. Symbol table entries of
- // this type exist primarily for relocation and normally have
- // STB_LOCAL binding.
+ // this type exist primarily for relocation and normally have STB_LOCAL
+ // binding.
break;
case STT_FILE:
- // Conventionally, the symbol's name gives the name of the source
- // file associated with the object file. A file symbol has STB_LOCAL
+ // Conventionally, the symbol's name gives the name of the source file
+ // associated with the object file. A file symbol has STB_LOCAL
// binding, its section index is SHN_ABS, and it precedes the other
// STB_LOCAL symbols for the file, if it is present.
symbol_type = eSymbolTypeSourceFile;
@@ -2228,12 +2202,11 @@ unsigned ObjectFileELF::ParseSymbols(Symtab *symtab, user_id_t start_id,
if (arch.GetMachine() == llvm::Triple::arm) {
if (symbol_type == eSymbolTypeCode) {
if (symbol.st_value & 1) {
- // Subtracting 1 from the address effectively unsets
- // the low order bit, which results in the address
- // actually pointing to the beginning of the symbol.
- // This delta will be used below in conjunction with
- // symbol.st_value to produce the final symbol_value
- // that we store in the symtab.
+ // Subtracting 1 from the address effectively unsets the low order
+ // bit, which results in the address actually pointing to the
+ // beginning of the symbol. This delta will be used below in
+ // conjunction with symbol.st_value to produce the final
+ // symbol_value that we store in the symtab.
symbol_value_offset = -1;
m_address_class_map[symbol.st_value ^ 1] =
eAddressClassCodeAlternateISA;
@@ -2280,20 +2253,16 @@ unsigned ObjectFileELF::ParseSymbols(Symtab *symtab, user_id_t start_id,
}
// symbol_value_offset may contain 0 for ARM symbols or -1 for THUMB
- // symbols. See above for
- // more details.
+ // symbols. See above for more details.
uint64_t symbol_value = symbol.st_value + symbol_value_offset;
if (symbol_section_sp == nullptr && section_idx == SHN_ABS &&
symbol.st_size != 0) {
// We don't have a section for a symbol with non-zero size. Create a new
- // section for it
- // so the address range covered by the symbol is also covered by the
- // module (represented
- // through the section list). It is needed so module lookup for the
- // addresses covered
- // by this symbol will be successfull. This case happens for absolute
- // symbols.
+ // section for it so the address range covered by the symbol is also
+ // covered by the module (represented through the section list). It is
+ // needed so module lookup for the addresses covered by this symbol will
+ // be successfull. This case happens for absolute symbols.
ConstString fake_section_name(std::string(".absolute.") + symbol_name);
symbol_section_sp =
std::make_shared<Section>(module_sp, this, SHN_ABS, fake_section_name,
@@ -2336,8 +2305,7 @@ unsigned ObjectFileELF::ParseSymbols(Symtab *symtab, user_id_t start_id,
Mangled mangled(ConstString(symbol_bare), is_mangled);
// Now append the suffix back to mangled and unmangled names. Only do it if
- // the
- // demangling was successful (string is not empty).
+ // the demangling was successful (string is not empty).
if (has_suffix) {
llvm::StringRef suffix = symbol_ref.substr(version_pos);
@@ -2353,12 +2321,10 @@ unsigned ObjectFileELF::ParseSymbols(Symtab *symtab, user_id_t start_id,
}
// In ELF all symbol should have a valid size but it is not true for some
- // function symbols
- // coming from hand written assembly. As none of the function symbol should
- // have 0 size we
- // try to calculate the size for these symbols in the symtab with saying
- // that their original
- // size is not valid.
+ // function symbols coming from hand written assembly. As none of the
+ // function symbol should have 0 size we try to calculate the size for
+ // these symbols in the symtab with saying that their original size is not
+ // valid.
bool symbol_size_valid =
symbol.st_size != 0 || symbol.getType() != STT_FUNC;
@@ -2387,8 +2353,7 @@ unsigned ObjectFileELF::ParseSymbolTable(Symtab *symbol_table,
lldb_private::Section *symtab) {
if (symtab->GetObjectFile() != this) {
// If the symbol table section is owned by a different object file, have it
- // do the
- // parsing.
+ // do the parsing.
ObjectFileELF *obj_file_elf =
static_cast<ObjectFileELF *>(symtab->GetObjectFile());
return obj_file_elf->ParseSymbolTable(symbol_table, start_id, symtab);
@@ -2404,8 +2369,8 @@ unsigned ObjectFileELF::ParseSymbolTable(Symtab *symbol_table,
assert(symtab_hdr->sh_type == SHT_SYMTAB ||
symtab_hdr->sh_type == SHT_DYNSYM);
- // sh_link: section header index of associated string table.
- // Section ID's are ones based.
+ // sh_link: section header index of associated string table. Section ID's are
+ // ones based.
user_id_t strtab_id = symtab_hdr->sh_link + 1;
Section *strtab = section_list->FindSectionByID(strtab_id).get();
@@ -2490,19 +2455,17 @@ unsigned ObjectFileELF::PLTRelocationType() {
return 0;
}
-// Returns the size of the normal plt entries and the offset of the first normal
-// plt entry. The
-// 0th entry in the plt table is usually a resolution entry which have different
-// size in some
-// architectures then the rest of the plt entries.
+// Returns the size of the normal plt entries and the offset of the first
+// normal plt entry. The 0th entry in the plt table is usually a resolution
+// entry which have different size in some architectures then the rest of the
+// plt entries.
static std::pair<uint64_t, uint64_t>
GetPltEntrySizeAndOffset(const ELFSectionHeader *rel_hdr,
const ELFSectionHeader *plt_hdr) {
const elf_xword num_relocations = rel_hdr->sh_size / rel_hdr->sh_entsize;
- // Clang 3.3 sets entsize to 4 for 32-bit binaries, but the plt entries are 16
- // bytes.
- // So round the entsize up by the alignment if addralign is set.
+ // Clang 3.3 sets entsize to 4 for 32-bit binaries, but the plt entries are
+ // 16 bytes. So round the entsize up by the alignment if addralign is set.
elf_xword plt_entsize =
plt_hdr->sh_addralign
? llvm::alignTo(plt_hdr->sh_entsize, plt_hdr->sh_addralign)
@@ -2514,12 +2477,10 @@ GetPltEntrySizeAndOffset(const ELFSectionHeader *rel_hdr,
// just in case.
if (plt_entsize <= 4) {
// The linker haven't set the plt_hdr->sh_entsize field. Try to guess the
- // size of the plt
- // entries based on the number of entries and the size of the plt section
- // with the
- // assumption that the size of the 0th entry is at least as big as the size
- // of the normal
- // entries and it isn't much bigger then that.
+ // size of the plt entries based on the number of entries and the size of
+ // the plt section with the assumption that the size of the 0th entry is at
+ // least as big as the size of the normal entries and it isn't much bigger
+ // then that.
if (plt_hdr->sh_addralign)
plt_entsize = plt_hdr->sh_size / plt_hdr->sh_addralign /
(num_relocations + 1) * plt_hdr->sh_addralign;
@@ -2812,8 +2773,7 @@ Symtab *ObjectFileELF::GetSymtab() {
return NULL;
// We always want to use the main object file so we (hopefully) only have one
- // cached copy
- // of our symtab, dynamic sections, etc.
+ // cached copy of our symtab, dynamic sections, etc.
ObjectFile *module_obj_file = module_sp->GetObjectFile();
if (module_obj_file && module_obj_file != this)
return module_obj_file->GetSymtab();
@@ -2828,18 +2788,15 @@ Symtab *ObjectFileELF::GetSymtab() {
// Sharable objects and dynamic executables usually have 2 distinct symbol
// tables, one named ".symtab", and the other ".dynsym". The dynsym is a
- // smaller
- // version of the symtab that only contains global symbols. The information
- // found
- // in the dynsym is therefore also found in the symtab, while the reverse is
- // not
- // necessarily true.
+ // smaller version of the symtab that only contains global symbols. The
+ // information found in the dynsym is therefore also found in the symtab,
+ // while the reverse is not necessarily true.
Section *symtab =
section_list->FindSectionByType(eSectionTypeELFSymbolTable, true).get();
if (!symtab) {
// The symtab section is non-allocable and can be stripped, so if it
- // doesn't exist
- // then use the dynsym section which should always be there.
+ // doesn't exist then use the dynsym section which should always be
+ // there.
symtab =
section_list->FindSectionByType(eSectionTypeELFDynamicSymbols, true)
.get();
@@ -2886,8 +2843,7 @@ Symtab *ObjectFileELF::GetSymtab() {
}
// If we still don't have any symtab then create an empty instance to avoid
- // do the section
- // lookup next time.
+ // do the section lookup next time.
if (m_symtab_ap == nullptr)
m_symtab_ap.reset(new Symtab(this));
@@ -2901,8 +2857,8 @@ void ObjectFileELF::RelocateSection(lldb_private::Section *section)
{
static const char *debug_prefix = ".debug";
- // Set relocated bit so we stop getting called, regardless of
- // whether we actually relocate.
+ // Set relocated bit so we stop getting called, regardless of whether we
+ // actually relocate.
section->SetIsRelocated(true);
// We only relocate in ELF relocatable files
@@ -2945,12 +2901,10 @@ void ObjectFileELF::ParseUnwindSymbols(Symtab *symbol_table,
return;
// First we save the new symbols into a separate list and add them to the
- // symbol table after
- // we colleced all symbols we want to add. This is neccessary because adding a
- // new symbol
- // invalidates the internal index of the symtab what causing the next lookup
- // to be slow because
- // it have to recalculate the index first.
+ // symbol table after we colleced all symbols we want to add. This is
+ // neccessary because adding a new symbol invalidates the internal index of
+ // the symtab what causing the next lookup to be slow because it have to
+ // recalculate the index first.
std::vector<Symbol> new_symbols;
eh_frame->ForEachFDEEntries([this, symbol_table, section_list, &new_symbols](
@@ -3144,8 +3098,8 @@ void ObjectFileELF::DumpELFProgramHeader(Stream *s,
//----------------------------------------------------------------------
// DumpELFProgramHeader_p_type
//
-// Dump an token value for the ELF program header member p_type which
-// describes the type of the program header
+// Dump an token value for the ELF program header member p_type which describes
+// the type of the program header
// ----------------------------------------------------------------------
void ObjectFileELF::DumpELFProgramHeader_p_type(Stream *s, elf_word p_type) {
const int kStrWidth = 15;
@@ -3316,8 +3270,7 @@ bool ObjectFileELF::GetArchitecture(ArchSpec &arch) {
if (CalculateType() == eTypeCoreFile &&
m_arch_spec.TripleOSIsUnspecifiedUnknown()) {
// Core files don't have section headers yet they have PT_NOTE program
- // headers
- // that might shed more light on the architecture
+ // headers that might shed more light on the architecture
if (ParseProgramHeaders()) {
for (size_t i = 1, count = GetProgramHeaderCount(); i <= count; ++i) {
const elf::ELFProgramHeader *header = GetProgramHeaderByIndex(i);
@@ -3378,22 +3331,22 @@ ObjectFile::Strata ObjectFileELF::CalculateStrata() {
case llvm::ELF::ET_EXEC:
// 2 - Executable file
// TODO: is there any way to detect that an executable is a kernel
- // related executable by inspecting the program headers, section
- // headers, symbols, or any other flag bits???
+ // related executable by inspecting the program headers, section headers,
+ // symbols, or any other flag bits???
return eStrataUser;
case llvm::ELF::ET_DYN:
// 3 - Shared object file
// TODO: is there any way to detect that an shared library is a kernel
- // related executable by inspecting the program headers, section
- // headers, symbols, or any other flag bits???
+ // related executable by inspecting the program headers, section headers,
+ // symbols, or any other flag bits???
return eStrataUnknown;
case ET_CORE:
// 4 - Core file
// TODO: is there any way to detect that an core file is a kernel
- // related executable by inspecting the program headers, section
- // headers, symbols, or any other flag bits???
+ // related executable by inspecting the program headers, section headers,
+ // symbols, or any other flag bits???
return eStrataUnknown;
default:
@@ -3468,8 +3421,8 @@ bool ObjectFileELF::AnySegmentHasPhysicalAddress() {
std::vector<ObjectFile::LoadableData>
ObjectFileELF::GetLoadableData(Target &target) {
- // Create a list of loadable data from loadable segments,
- // using physical addresses if they aren't all null
+ // Create a list of loadable data from loadable segments, using physical
+ // addresses if they aren't all null
std::vector<LoadableData> loadables;
size_t header_count = ParseProgramHeaders();
bool should_use_paddr = AnySegmentHasPhysicalAddress();
diff --git a/lldb/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp b/lldb/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp
index a9ab366fbf5..af040322ec5 100644
--- a/lldb/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp
+++ b/lldb/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp
@@ -65,8 +65,8 @@ ObjectFile *ObjectFileJIT::CreateInstance(const lldb::ModuleSP &module_sp,
const FileSpec *file,
lldb::offset_t file_offset,
lldb::offset_t length) {
- // JIT'ed object file is backed by the ObjectFileJITDelegate, never
- // read from a file
+ // JIT'ed object file is backed by the ObjectFileJITDelegate, never read from
+ // a file
return NULL;
}
@@ -74,8 +74,8 @@ ObjectFile *ObjectFileJIT::CreateMemoryInstance(const lldb::ModuleSP &module_sp,
DataBufferSP &data_sp,
const ProcessSP &process_sp,
lldb::addr_t header_addr) {
- // JIT'ed object file is backed by the ObjectFileJITDelegate, never
- // read from memory
+ // JIT'ed object file is backed by the ObjectFileJITDelegate, never read from
+ // memory
return NULL;
}
@@ -214,9 +214,8 @@ bool ObjectFileJIT::SetLoadAddress(Target &target, lldb::addr_t value,
const size_t num_sections = section_list->GetSize();
// "value" is an offset to apply to each top level segment
for (size_t sect_idx = 0; sect_idx < num_sections; ++sect_idx) {
- // Iterate through the object file sections to find all
- // of the sections that size on disk (to avoid __PAGEZERO)
- // and load them
+ // Iterate through the object file sections to find all of the sections
+ // that size on disk (to avoid __PAGEZERO) and load them
SectionSP section_sp(section_list->GetSectionAtIndex(sect_idx));
if (section_sp && section_sp->GetFileSize() > 0 &&
section_sp->IsThreadSpecific() == false) {
diff --git a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
index b2fa02591ab..6f8ad16b012 100644
--- a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
+++ b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
@@ -161,8 +161,7 @@ public:
case 7:
case 8:
case 9:
- // fancy flavors that encapsulate of the above
- // flavors...
+ // fancy flavors that encapsulate of the above flavors...
break;
default:
@@ -393,8 +392,7 @@ public:
case 7:
case 8:
case 9:
- // fancy flavors that encapsulate of the above
- // flavors...
+ // fancy flavors that encapsulate of the above flavors...
break;
default:
@@ -517,8 +515,7 @@ public:
}
// Note that gpr.cpsr is also copied by the above loop; this loop
- // technically extends
- // one element past the end of the gpr.r[] array.
+ // technically extends one element past the end of the gpr.r[] array.
SetError(GPRRegSet, Read, 0);
offset = next_thread_state;
@@ -1168,8 +1165,8 @@ AddressClass ObjectFileMachO::GetAddressClass(lldb::addr_t file_addr) {
case eSectionTypeCode:
if (m_header.cputype == llvm::MachO::CPU_TYPE_ARM) {
- // For ARM we have a bit in the n_desc field of the symbol
- // that tells us ARM/Thumb which is bit 0x0008.
+ // For ARM we have a bit in the n_desc field of the symbol that
+ // tells us ARM/Thumb which is bit 0x0008.
if (symbol->GetFlags() & MACHO_NLIST_ARM_SYMBOL_IS_THUMB)
return eAddressClassCodeAlternateISA;
}
@@ -1243,8 +1240,8 @@ AddressClass ObjectFileMachO::GetAddressClass(lldb::addr_t file_addr) {
case eSymbolTypeTrampoline:
case eSymbolTypeResolver:
if (m_header.cputype == llvm::MachO::CPU_TYPE_ARM) {
- // For ARM we have a bit in the n_desc field of the symbol
- // that tells us ARM/Thumb which is bit 0x0008.
+ // For ARM we have a bit in the n_desc field of the symbol that tells
+ // us ARM/Thumb which is bit 0x0008.
if (symbol->GetFlags() & MACHO_NLIST_ARM_SYMBOL_IS_THUMB)
return eAddressClassCodeAlternateISA;
}
@@ -1360,8 +1357,8 @@ ObjectFileMachO::EncryptedFileRanges ObjectFileMachO::GetEncryptedFileRanges() {
if (m_data.GetU32(&offset, &encryption_cmd, 2) == NULL)
break;
- // LC_ENCRYPTION_INFO and LC_ENCRYPTION_INFO_64 have the same sizes for
- // the 3 fields we care about, so treat them the same.
+ // LC_ENCRYPTION_INFO and LC_ENCRYPTION_INFO_64 have the same sizes for the
+ // 3 fields we care about, so treat them the same.
if (encryption_cmd.cmd == LC_ENCRYPTION_INFO ||
encryption_cmd.cmd == LC_ENCRYPTION_INFO_64) {
if (m_data.GetU32(&offset, &encryption_cmd.cryptoff, 3)) {
@@ -1605,12 +1602,12 @@ void ObjectFileMachO::ProcessSegmentCommand(const load_command &load_cmd_,
context.UnifiedList.FindSectionByName(const_segname));
if (is_dsym && unified_section_sp) {
if (const_segname == GetSegmentNameLINKEDIT()) {
- // We need to keep the __LINKEDIT segment private to this object
- // file only
+ // We need to keep the __LINKEDIT segment private to this object file
+ // only
add_to_unified = false;
} else {
- // This is the dSYM file and this section has already been created
- // by the object file, no need to create it.
+ // This is the dSYM file and this section has already been created by the
+ // object file, no need to create it.
add_section = false;
}
}
@@ -1627,12 +1624,12 @@ void ObjectFileMachO::ProcessSegmentCommand(const load_command &load_cmd_,
const bool segment_is_encrypted =
(load_cmd.flags & SG_PROTECTED_VERSION_1) != 0;
- // Keep a list of mach segments around in case we need to
- // get at data that isn't stored in the abstracted Sections.
+ // Keep a list of mach segments around in case we need to get at data that
+ // isn't stored in the abstracted Sections.
m_mach_segments.push_back(load_cmd);
- // Use a segment ID of the segment index shifted left by 8 so they
- // never conflict with any of the sections.
+ // Use a segment ID of the segment index shifted left by 8 so they never
+ // conflict with any of the sections.
SectionSP segment_sp;
if (add_section && (const_segname || is_core)) {
segment_sp.reset(new Section(
@@ -1640,9 +1637,8 @@ void ObjectFileMachO::ProcessSegmentCommand(const load_command &load_cmd_,
this, // Object file to which this sections belongs
++context.NextSegmentIdx
<< 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
+ // shifted right by 8 bits as not to collide with any of the 256
+ // section IDs that are possible
const_segname, // Name of this section
eSectionTypeContainer, // This section is a container of other
// sections.
@@ -1665,27 +1661,24 @@ void ObjectFileMachO::ProcessSegmentCommand(const load_command &load_cmd_,
if (is_dsym && unified_section_sp->GetFileAddress() != load_cmd.vmaddr) {
// Check to see if the module was read from memory?
if (module_sp->GetObjectFile()->GetHeaderAddress().IsValid()) {
- // We have a module that is in memory and needs to have its
- // file address adjusted. We need to do this because when we
- // load a file from memory, its addresses will be slid already,
- // yet the addresses in the new symbol file will still be
- // unslid. Since everything is stored as section offset, this
- // shouldn't cause any problems.
-
- // Make sure we've parsed the symbol table from the
- // ObjectFile before we go around changing its Sections.
+ // We have a module that is in memory and needs to have its file
+ // address adjusted. We need to do this because when we load a file
+ // from memory, its addresses will be slid already, yet the addresses
+ // in the new symbol file will still be unslid. Since everything is
+ // stored as section offset, this shouldn't cause any problems.
+
+ // Make sure we've parsed the symbol table from the ObjectFile before
+ // we go around changing its Sections.
module_sp->GetObjectFile()->GetSymtab();
- // eh_frame would present the same problems but we parse that
- // on a per-function basis as-needed so it's more difficult to
- // remove its use of the Sections. Realistically, the
- // environments where this code path will be taken will not
- // have eh_frame sections.
+ // eh_frame would present the same problems but we parse that on a per-
+ // function basis as-needed so it's more difficult to remove its use of
+ // the Sections. Realistically, the environments where this code path
+ // will be taken will not have eh_frame sections.
unified_section_sp->SetFileAddress(load_cmd.vmaddr);
- // Notify the module that the section addresses have been
- // changed once we're done so any file-address caches can be
- // updated.
+ // Notify the module that the section addresses have been changed once
+ // we're done so any file-address caches can be updated.
context.FileAddressesChanged = true;
}
}
@@ -1694,8 +1687,8 @@ void ObjectFileMachO::ProcessSegmentCommand(const load_command &load_cmd_,
struct section_64 sect64;
::memset(&sect64, 0, sizeof(sect64));
- // Push a section into our mach sections for the section at
- // index zero (NO_SECT) if we don't have any mach sections yet...
+ // Push a section into our mach sections for the section at index zero
+ // (NO_SECT) if we don't have any mach sections yet...
if (m_mach_sections.empty())
m_mach_sections.push_back(sect64);
uint32_t segment_sect_idx;
@@ -1716,8 +1709,8 @@ void ObjectFileMachO::ProcessSegmentCommand(const load_command &load_cmd_,
if (m_data.GetU32(&offset, &sect64.offset, num_u32s) == NULL)
break;
- // Keep a list of mach sections around in case we need to
- // get at data that isn't stored in the abstracted Sections.
+ // Keep a list of mach sections around in case we need to get at data that
+ // isn't stored in the abstracted Sections.
m_mach_sections.push_back(sect64);
if (add_section) {
@@ -1725,12 +1718,12 @@ void ObjectFileMachO::ProcessSegmentCommand(const load_command &load_cmd_,
sect64.sectname,
std::min<size_t>(strlen(sect64.sectname), sizeof(sect64.sectname)));
if (!const_segname) {
- // We have a segment with no name so we need to conjure up
- // segments that correspond to the section's segname if there
- // isn't already such a section. If there is such a section, we
- // resize the section so that it spans all sections. We also
- // mark these sections as fake so address matches don't hit if
- // they land in the gaps between the child sections.
+ // We have a segment with no name so we need to conjure up segments
+ // that correspond to the section's segname if there isn't already such
+ // a section. If there is such a section, we resize the section so that
+ // it spans all sections. We also mark these sections as fake so
+ // address matches don't hit if they land in the gaps between the child
+ // sections.
const_segname.SetTrimmedCStringWithLength(sect64.segname,
sizeof(sect64.segname));
segment_sp = context.UnifiedList.FindSectionByName(const_segname);
@@ -1750,9 +1743,8 @@ void ObjectFileMachO::ProcessSegmentCommand(const load_command &load_cmd_,
if (new_seg_byte_size > curr_seg_byte_size)
segment->SetByteSize(new_seg_byte_size);
} else {
- // We need to change the base address of the segment and
- // adjust the child section offsets for all existing
- // children.
+ // We need to change the base address of the segment and adjust the
+ // child section offsets for all existing children.
const lldb::addr_t slide_amount =
sect64_min_addr - curr_seg_min_addr;
segment->Slide(slide_amount, false);
@@ -1905,9 +1897,9 @@ class MachSymtabSectionInfo {
public:
MachSymtabSectionInfo(SectionList *section_list)
: m_section_list(section_list), m_section_infos() {
- // Get the number of sections down to a depth of 1 to include
- // all segments and their sections, but no other sections that
- // may be added for debug map or
+ // Get the number of sections down to a depth of 1 to include all segments
+ // and their sections, but no other sections that may be added for debug
+ // map or
m_section_infos.resize(section_list->GetNumSections(1));
}
@@ -1935,9 +1927,9 @@ public:
} else if (m_section_infos[n_sect].vm_range.GetByteSize() == 0 &&
m_section_infos[n_sect].vm_range.GetBaseAddress() ==
file_addr) {
- // 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'.
+ // 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_sp;
}
}
@@ -2251,10 +2243,9 @@ size_t ObjectFileMachO::ParseSymtab() {
linkedit_section_sp->GetLoadBaseAddress(&target);
if (linkedit_load_addr == LLDB_INVALID_ADDRESS) {
// We might be trying to access the symbol table before the
- // __LINKEDIT's load
- // address has been set in the target. We can't fail to read the
- // symbol table,
- // so calculate the right address manually
+ // __LINKEDIT's load address has been set in the target. We can't
+ // fail to read the symbol table, so calculate the right address
+ // manually
linkedit_load_addr = CalculateSectionLoadAddressForMemoryImage(
m_memory_addr, GetMachHeaderSection(), linkedit_section_sp.get());
}
@@ -2275,8 +2266,8 @@ size_t ObjectFileMachO::ParseSymtab() {
process->GetAddressByteSize() == sizeof(void *)) {
// This mach-o memory file is in the dyld shared cache. If this
// program is not remote and this is iOS, then this process will
- // share the same shared cache as the process we are debugging and
- // we can read the entire __LINKEDIT from the address space in this
+ // share the same shared cache as the process we are debugging and we
+ // can read the entire __LINKEDIT from the address space in this
// process. This is a needed optimization that is used for local iOS
// debugging only since all shared libraries in the shared cache do
// not have corresponding files that exist in the file system of the
@@ -2285,10 +2276,9 @@ size_t ObjectFileMachO::ParseSymtab() {
// string tables from all of the __LINKEDIT sections from the shared
// libraries in the shared cache have been merged into a single large
// symbol and string table. Reading all of this symbol and string
- // table
- // data across can slow down debug launch times, so we optimize this
- // by
- // reading the memory for the __LINKEDIT section from this process.
+ // table data across can slow down debug launch times, so we optimize
+ // this by reading the memory for the __LINKEDIT section from this
+ // process.
UUID lldb_shared_cache(GetLLDBSharedCacheUUID());
UUID process_shared_cache(GetProcessSharedCacheUUID(process));
@@ -2324,10 +2314,9 @@ size_t ObjectFileMachO::ParseSymtab() {
if (!data_was_read) {
// Always load dyld - the dynamic linker - from memory if we didn't
- // find a binary anywhere else.
- // lldb will not register dylib/framework/bundle loads/unloads if we
- // don't have the dyld symbols,
- // we force dyld to load from memory despite the user's
+ // find a binary anywhere else. lldb will not register
+ // dylib/framework/bundle loads/unloads if we don't have the dyld
+ // symbols, we force dyld to load from memory despite the user's
// target.memory-module-load-level setting.
if (memory_module_load_level == eMemoryModuleLoadLevelComplete ||
m_header.filetype == llvm::MachO::MH_DYLINKER) {
@@ -2337,10 +2326,9 @@ size_t ObjectFileMachO::ParseSymtab() {
nlist_data.SetData(nlist_data_sp, 0,
nlist_data_sp->GetByteSize());
// Load strings individually from memory when loading from memory
- // since shared cache
- // string tables contain strings for all symbols from all shared
- // cached libraries
- // DataBufferSP strtab_data_sp (ReadMemory (process_sp, strtab_addr,
+ // since shared cache string tables contain strings for all symbols
+ // from all shared cached libraries DataBufferSP strtab_data_sp
+ // (ReadMemory (process_sp, strtab_addr,
// strtab_data_byte_size));
// if (strtab_data_sp)
// strtab_data.SetData (strtab_data_sp, 0,
@@ -2444,11 +2432,9 @@ size_t ObjectFileMachO::ParseSymtab() {
const bool is_arm = (m_header.cputype == llvm::MachO::CPU_TYPE_ARM);
// lldb works best if it knows the start address of all functions in a
- // module.
- // Linker symbols or debug info are normally the best source of information
- // for start addr / size but
- // they may be stripped in a released binary.
- // Two additional sources of information exist in Mach-O binaries:
+ // module. Linker symbols or debug info are normally the best source of
+ // information for start addr / size but they may be stripped in a released
+ // binary. Two additional sources of information exist in Mach-O binaries:
// LC_FUNCTION_STARTS - a list of ULEB128 encoded offsets of each
// function's start address in the
// binary, relative to the text section.
@@ -2473,12 +2459,10 @@ size_t ObjectFileMachO::ParseSymtab() {
}
} else {
// If m_type is eTypeDebugInfo, then this is a dSYM - it will have the
- // load command claiming an eh_frame
- // but it doesn't actually have the eh_frame content. And if we have a
- // dSYM, we don't need to do any
- // of this fill-in-the-missing-symbols works anyway - the debug info
- // should give us all the functions in
- // the module.
+ // load command claiming an eh_frame but it doesn't actually have the
+ // eh_frame content. And if we have a dSYM, we don't need to do any of
+ // this fill-in-the-missing-symbols works anyway - the debug info should
+ // give us all the functions in the module.
if (text_section_sp.get() && eh_frame_section_sp.get() &&
m_type != eTypeDebugInfo) {
DWARFCallFrameInfo eh_frame(*this, eh_frame_section_sp,
@@ -2502,18 +2486,14 @@ size_t ObjectFileMachO::ParseSymtab() {
const size_t function_starts_count = function_starts.GetSize();
// For user process binaries (executables, dylibs, frameworks, bundles), if
- // we don't have
- // LC_FUNCTION_STARTS/eh_frame section in this binary, we're going to assume
- // the binary
- // has been stripped. Don't allow assembly language instruction emulation
- // because we don't
- // know proper function start boundaries.
+ // we don't have LC_FUNCTION_STARTS/eh_frame section in this binary, we're
+ // going to assume the binary has been stripped. Don't allow assembly
+ // language instruction emulation because we don't know proper function
+ // start boundaries.
//
// For all other types of binaries (kernels, stand-alone bare board
- // binaries, kexts), they
- // may not have LC_FUNCTION_STARTS / eh_frame sections - we should not make
- // any assumptions
- // about them based on that.
+ // binaries, kexts), they may not have LC_FUNCTION_STARTS / eh_frame
+ // sections - we should not make any assumptions about them based on that.
if (function_starts_count == 0 && CalculateStrata() == eStrataUser) {
m_allow_assembly_emulation_unwind_plans = false;
Log *unwind_or_symbol_log(lldb_private::GetLogIfAnyCategoriesSet(
@@ -2545,8 +2525,8 @@ size_t ObjectFileMachO::ParseSymtab() {
ValueToSymbolIndexMap N_FUN_addr_to_sym_idx;
ValueToSymbolIndexMap N_STSYM_addr_to_sym_idx;
ConstNameToSymbolIndexMap N_GSYM_name_to_sym_idx;
- // Any symbols that get merged into another will get an entry
- // in this map so we know
+ // Any symbols that get merged into another will get an entry in this map
+ // so we know
NListIndexToSymbolIndexMap m_nlist_idx_to_sym_idx;
uint32_t nlist_idx = 0;
Symbol *symbol_ptr = NULL;
@@ -2585,21 +2565,18 @@ size_t ObjectFileMachO::ParseSymtab() {
(defined(__arm__) || defined(__arm64__) || defined(__aarch64__))
// Some recent builds of the dyld_shared_cache (hereafter: DSC) have been
- // optimized by moving LOCAL
- // symbols out of the memory mapped portion of the DSC. The symbol
- // information has all been retained,
- // but it isn't available in the normal nlist data. However, there *are*
- // duplicate entries of *some*
+ // optimized by moving LOCAL symbols out of the memory mapped portion of
+ // the DSC. The symbol information has all been retained, but it isn't
+ // available in the normal nlist data. However, there *are* duplicate
+ // entries of *some*
// LOCAL symbols in the normal nlist data. To handle this situation
// correctly, we must first attempt
// to parse any DSC unmapped symbol information. If we find any, we set a
- // flag that tells the normal
- // nlist parser to ignore all LOCAL symbols.
+ // flag that tells the normal nlist parser to ignore all LOCAL symbols.
if (m_header.flags & 0x80000000u) {
- // Before we can start mapping the DSC, we need to make certain the target
- // process is actually
- // using the cache we can find.
+ // Before we can start mapping the DSC, we need to make certain the
+ // target process is actually using the cache we can find.
// Next we need to determine the correct path for the dyld shared cache.
@@ -2633,9 +2610,9 @@ size_t ObjectFileMachO::ParseSymtab() {
process_shared_cache_uuid = GetProcessSharedCacheUUID(process);
}
- // First see if we can find an exact match for the inferior process shared
- // cache UUID in
- // the development or non-development shared caches on disk.
+ // First see if we can find an exact match for the inferior process
+ // shared cache UUID in the development or non-development shared caches
+ // on disk.
if (process_shared_cache_uuid.IsValid()) {
if (dsc_development_filespec.Exists()) {
UUID dsc_development_uuid = GetSharedCacheUUID(
@@ -2700,8 +2677,7 @@ size_t ObjectFileMachO::ParseSymtab() {
if (process_shared_cache_uuid.IsValid() &&
dsc_uuid != process_shared_cache_uuid) {
// The on-disk dyld_shared_cache file is not the same as the one in
- // this
- // process' memory, don't use it.
+ // this process' memory, don't use it.
uuid_match = false;
ModuleSP module_sp(GetModule());
if (module_sp)
@@ -2729,11 +2705,9 @@ size_t ObjectFileMachO::ParseSymtab() {
offset = 0;
// The File addresses (from the in-memory Mach-O load commands) for
- // the shared libraries
- // in the shared library cache need to be adjusted by an offset to
- // match up with the
- // dylibOffset identifying field in the
- // dyld_cache_local_symbol_entry's. This offset is
+ // the shared libraries in the shared library cache need to be
+ // adjusted by an offset to match up with the dylibOffset identifying
+ // field in the dyld_cache_local_symbol_entry's. This offset is
// recorded in mapping_offset_value.
const uint64_t mapping_offset_value =
dsc_mapping_info_data.GetU64(&offset);
@@ -2827,8 +2801,8 @@ size_t ObjectFileMachO::ParseSymtab() {
if (symbol_name == NULL) {
// No symbol should be NULL, even the symbols with no
- // string values should have an offset zero which points
- // to an empty C-string
+ // string values should have an offset zero which
+ // points to an empty C-string
Host::SystemLog(
Host::eSystemLogError,
"error: DSC unmapped local symbol[%u] has invalid "
@@ -2863,14 +2837,13 @@ size_t ObjectFileMachO::ParseSymtab() {
// FIXME: In the .o files, we have a GSYM and a debug
// symbol for all the ObjC data. They
// have the same address, but we want to ensure that
- // we always find only the real symbol,
- // 'cause we don't currently correctly attribute the
+ // we always find only the real symbol, 'cause we
+ // don't currently correctly attribute the
// GSYM one to the ObjCClass/Ivar/MetaClass
- // symbol type. This is a temporary hack to make sure
- // the ObjectiveC symbols get treated
- // correctly. To do this right, we should coalesce
- // all the GSYM & global symbols that have the
- // same address.
+ // symbol type. This is a temporary hack to make
+ // sure the ObjectiveC symbols get treated correctly.
+ // To do this right, we should coalesce all the GSYM
+ // & global symbols that have the same address.
is_gsym = true;
sym[sym_idx].SetExternal(true);
@@ -2924,25 +2897,24 @@ size_t ObjectFileMachO::ParseSymtab() {
N_FUN_addr_to_sym_idx.insert(
std::make_pair(nlist.n_value, sym_idx));
// We use the current number of symbols in the
- // symbol table in lieu of
- // using nlist_idx in case we ever start trimming
- // entries out
+ // symbol table in lieu of using nlist_idx in case
+ // we ever start trimming entries out
N_FUN_indexes.push_back(sym_idx);
} else {
type = eSymbolTypeCompiler;
if (!N_FUN_indexes.empty()) {
- // Copy the size of the function into the original
+ // Copy the size of the function into the
+ // original
// STAB entry so we don't have
// to hunt for it later
symtab->SymbolAtIndex(N_FUN_indexes.back())
->SetByteSize(nlist.n_value);
N_FUN_indexes.pop_back();
// We don't really need the end function STAB as
- // it contains the size which
- // we already placed with the original symbol, so
- // don't add it if we want a
- // minimal symbol table
+ // it contains the size which we already placed
+ // with the original symbol, so don't add it if
+ // we want a minimal symbol table
add_nlist = false;
}
}
@@ -2969,19 +2941,17 @@ size_t ObjectFileMachO::ParseSymtab() {
case N_BNSYM:
// We use the current number of symbols in the symbol
- // table in lieu of
- // using nlist_idx in case we ever start trimming
- // entries out
- // Skip these if we want minimal symbol tables
+ // table in lieu of using nlist_idx in case we ever
+ // start trimming entries out Skip these if we want
+ // minimal symbol tables
add_nlist = false;
break;
case N_ENSYM:
// Set the size of the N_BNSYM to the terminating
- // index of this N_ENSYM
- // so that we can always skip the entire symbol if we
- // need to navigate
- // more quickly at the source level when parsing STABS
+ // index of this N_ENSYM so that we can always skip
+ // the entire symbol if we need to navigate more
+ // quickly at the source level when parsing STABS
// Skip these if we want minimal symbol tables
add_nlist = false;
break;
@@ -3015,11 +2985,9 @@ size_t ObjectFileMachO::ParseSymtab() {
add_nlist = false;
if (N_SO_index != UINT32_MAX) {
// Set the size of the N_SO to the terminating
- // index of this N_SO
- // so that we can always skip the entire N_SO if
- // we need to navigate
- // more quickly at the source level when parsing
- // STABS
+ // index of this N_SO so that we can always skip
+ // the entire N_SO if we need to navigate more
+ // quickly at the source level when parsing STABS
symbol_ptr = symtab->SymbolAtIndex(N_SO_index);
symbol_ptr->SetByteSize(sym_idx);
symbol_ptr->SetSizeIsSibling(true);
@@ -3032,17 +3000,16 @@ size_t ObjectFileMachO::ParseSymtab() {
N_SO_index = UINT32_MAX;
} else {
// We use the current number of symbols in the
- // symbol table in lieu of
- // using nlist_idx in case we ever start trimming
- // entries out
+ // symbol table in lieu of using nlist_idx in case
+ // we ever start trimming entries out
const bool N_SO_has_full_path =
symbol_name[0] == '/';
if (N_SO_has_full_path) {
if ((N_SO_index == sym_idx - 1) &&
((sym_idx - 1) < num_syms)) {
// We have two consecutive N_SO entries where
- // the first contains a directory
- // and the second contains a full path.
+ // the first contains a directory and the
+ // second contains a full path.
sym[sym_idx - 1].GetMangled().SetValue(
ConstString(symbol_name), false);
m_nlist_idx_to_sym_idx[nlist_idx] = sym_idx - 1;
@@ -3056,9 +3023,9 @@ size_t ObjectFileMachO::ParseSymtab() {
} else if ((N_SO_index == sym_idx - 1) &&
((sym_idx - 1) < num_syms)) {
// This is usually the second N_SO entry that
- // contains just the filename,
- // so here we combine it with the first one if we
- // are minimizing the symbol table
+ // contains just the filename, so here we combine
+ // it with the first one if we are minimizing the
+ // symbol table
const char *so_path =
sym[sym_idx - 1]
.GetMangled()
@@ -3072,11 +3039,11 @@ size_t ObjectFileMachO::ParseSymtab() {
if (double_slash_pos != std::string::npos) {
// The linker has been generating bad N_SO
// entries with doubled up paths
- // in the format "%s%s" where the first string
- // in the DW_AT_comp_dir,
- // and the second is the directory for the
- // source file so you end up with
- // a path that looks like "/tmp/src//tmp/src/"
+ // in the format "%s%s" where the first
+ // string in the DW_AT_comp_dir, and the
+ // second is the directory for the source
+ // file so you end up with a path that looks
+ // like "/tmp/src//tmp/src/"
FileSpec so_dir(so_path, false);
if (!so_dir.Exists()) {
so_dir.SetFile(
@@ -3118,11 +3085,10 @@ size_t ObjectFileMachO::ParseSymtab() {
// INCL scopes
//----------------------------------------------------------------------
case N_BINCL:
- // include file beginning: name,,NO_SECT,0,sum
- // We use the current number of symbols in the symbol
- // table in lieu of
- // using nlist_idx in case we ever start trimming
- // entries out
+ // include file beginning: name,,NO_SECT,0,sum We use
+ // the current number of symbols in the symbol table
+ // in lieu of using nlist_idx in case we ever start
+ // trimming entries out
N_INCL_indexes.push_back(sym_idx);
type = eSymbolTypeScopeBegin;
break;
@@ -3130,10 +3096,9 @@ size_t ObjectFileMachO::ParseSymtab() {
case N_EINCL:
// include file end: name,,NO_SECT,0,0
// Set the size of the N_BINCL to the terminating
- // index of this N_EINCL
- // so that we can always skip the entire symbol if we
- // need to navigate
- // more quickly at the source level when parsing STABS
+ // index of this N_EINCL so that we can always skip
+ // the entire symbol if we need to navigate more
+ // quickly at the source level when parsing STABS
if (!N_INCL_indexes.empty()) {
symbol_ptr =
symtab->SymbolAtIndex(N_INCL_indexes.back());
@@ -3183,11 +3148,10 @@ size_t ObjectFileMachO::ParseSymtab() {
// Left and Right Braces
//----------------------------------------------------------------------
case N_LBRAC:
- // left bracket: 0,,NO_SECT,nesting level,address
- // We use the current number of symbols in the symbol
- // table in lieu of
- // using nlist_idx in case we ever start trimming
- // entries out
+ // left bracket: 0,,NO_SECT,nesting level,address We
+ // use the current number of symbols in the symbol
+ // table in lieu of using nlist_idx in case we ever
+ // start trimming entries out
symbol_section = section_info.GetSection(
nlist.n_sect, nlist.n_value);
N_BRAC_indexes.push_back(sym_idx);
@@ -3197,10 +3161,9 @@ size_t ObjectFileMachO::ParseSymtab() {
case N_RBRAC:
// right bracket: 0,,NO_SECT,nesting level,address
// Set the size of the N_LBRAC to the terminating
- // index of this N_RBRAC
- // so that we can always skip the entire symbol if we
- // need to navigate
- // more quickly at the source level when parsing STABS
+ // index of this N_RBRAC so that we can always skip
+ // the entire symbol if we need to navigate more
+ // quickly at the source level when parsing STABS
symbol_section = section_info.GetSection(
nlist.n_sect, nlist.n_value);
if (!N_BRAC_indexes.empty()) {
@@ -3224,9 +3187,8 @@ size_t ObjectFileMachO::ParseSymtab() {
case N_BCOMM:
// begin common: name,,NO_SECT,0,0
// We use the current number of symbols in the symbol
- // table in lieu of
- // using nlist_idx in case we ever start trimming
- // entries out
+ // table in lieu of using nlist_idx in case we ever
+ // start trimming entries out
type = eSymbolTypeScopeBegin;
N_COMM_indexes.push_back(sym_idx);
break;
@@ -3240,10 +3202,10 @@ size_t ObjectFileMachO::ParseSymtab() {
case N_ECOMM:
// end common: name,,n_sect,0,0
// Set the size of the N_BCOMM to the terminating
- // index of this N_ECOMM/N_ECOML
- // so that we can always skip the entire symbol if we
- // need to navigate
- // more quickly at the source level when parsing STABS
+ // index of this N_ECOMM/N_ECOML so that we can
+ // always skip the entire symbol if we need to
+ // navigate more quickly at the source level when
+ // parsing STABS
if (!N_COMM_indexes.empty()) {
symbol_ptr =
symtab->SymbolAtIndex(N_COMM_indexes.back());
@@ -3533,16 +3495,16 @@ size_t ObjectFileMachO::ParseSymtab() {
function_starts_count > 0) {
addr_t symbol_lookup_file_addr = nlist.n_value;
// Do an exact address match for non-ARM addresses,
- // else get the closest since
- // the symbol might be a thumb symbol which has an
- // address with bit zero set
+ // else get the closest since the symbol might be a
+ // thumb symbol which has an address with bit zero
+ // set
FunctionStarts::Entry *func_start_entry =
function_starts.FindEntry(
symbol_lookup_file_addr, !is_arm);
if (is_arm && func_start_entry) {
// Verify that the function start address is the
- // symbol address (ARM)
- // or the symbol address + 1 (thumb)
+ // symbol address (ARM) or the symbol address + 1
+ // (thumb)
if (func_start_entry->addr !=
symbol_lookup_file_addr &&
func_start_entry->addr !=
@@ -3574,8 +3536,8 @@ size_t ObjectFileMachO::ParseSymtab() {
addr_t next_symbol_file_addr =
next_func_start_entry->addr;
// Be sure the clear the Thumb address bit when
- // we calculate the size
- // from the current and next address
+ // we calculate the size from the current and
+ // next address
if (is_arm)
next_symbol_file_addr &=
THUMB_ADDRESS_BIT_MASK;
@@ -3594,12 +3556,10 @@ size_t ObjectFileMachO::ParseSymtab() {
if (is_debug == false) {
if (type == eSymbolTypeCode) {
// See if we can find a N_FUN entry for any code
- // symbols.
- // If we do find a match, and the name matches, then
- // we
- // can merge the two into just the function symbol
- // to avoid
- // duplicate entries in the symbol table
+ // symbols. If we do find a match, and the name
+ // matches, then we can merge the two into just the
+ // function symbol to avoid duplicate entries in
+ // the symbol table
std::pair<ValueToSymbolIndexMap::const_iterator,
ValueToSymbolIndexMap::const_iterator>
range;
@@ -3647,12 +3607,10 @@ size_t ObjectFileMachO::ParseSymtab() {
type == eSymbolTypeObjCMetaClass ||
type == eSymbolTypeObjCIVar) {
// See if we can find a N_STSYM entry for any data
- // symbols.
- // If we do find a match, and the name matches, then
- // we
- // can merge the two into just the Static symbol to
- // avoid
- // duplicate entries in the symbol table
+ // symbols. If we do find a match, and the name
+ // matches, then we can merge the two into just the
+ // Static symbol to avoid duplicate entries in the
+ // symbol table
std::pair<ValueToSymbolIndexMap::const_iterator,
ValueToSymbolIndexMap::const_iterator>
range;
@@ -3694,8 +3652,8 @@ size_t ObjectFileMachO::ParseSymtab() {
Mangled::ePreferMangled)
.GetCString();
if (gsym_name) {
- // Combine N_GSYM stab entries with the non stab
- // symbol
+ // Combine N_GSYM stab entries with the non
+ // stab symbol
ConstNameToSymbolIndexMap::const_iterator pos =
N_GSYM_name_to_sym_idx.find(gsym_name);
if (pos != N_GSYM_name_to_sym_idx.end()) {
@@ -3811,9 +3769,8 @@ size_t ObjectFileMachO::ParseSymtab() {
symbol_name = strtab_data.PeekCStr(nlist.n_strx);
if (symbol_name == NULL) {
- // No symbol should be NULL, even the symbols with no
- // string values should have an offset zero which points
- // to an empty C-string
+ // 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, ignoring symbol\n",
@@ -3852,14 +3809,12 @@ size_t ObjectFileMachO::ParseSymtab() {
// FIXME: In the .o files, we have a GSYM and a debug symbol for all
// the ObjC data. They
// have the same address, but we want to ensure that we always find
- // only the real symbol,
- // 'cause we don't currently correctly attribute the GSYM one to the
- // ObjCClass/Ivar/MetaClass
- // symbol type. This is a temporary hack to make sure the
- // ObjectiveC symbols get treated
- // correctly. To do this right, we should coalesce all the GSYM &
- // global symbols that have the
- // same address.
+ // only the real symbol, 'cause we don't currently correctly
+ // attribute the GSYM one to the ObjCClass/Ivar/MetaClass symbol
+ // type. This is a temporary hack to make sure the ObjectiveC
+ // symbols get treated correctly. To do this right, we should
+ // coalesce all the GSYM & global symbols that have the same
+ // address.
is_gsym = true;
sym[sym_idx].SetExternal(true);
@@ -3906,24 +3861,21 @@ size_t ObjectFileMachO::ParseSymtab() {
N_FUN_addr_to_sym_idx.insert(
std::make_pair(nlist.n_value, sym_idx));
// We use the current number of symbols in the symbol table in
- // lieu of
- // using nlist_idx in case we ever start trimming entries out
+ // lieu of using nlist_idx in case we ever start trimming entries
+ // out
N_FUN_indexes.push_back(sym_idx);
} else {
type = eSymbolTypeCompiler;
if (!N_FUN_indexes.empty()) {
- // Copy the size of the function into the original STAB entry so
- // we don't have
- // to hunt for it later
+ // Copy the size of the function into the original STAB entry
+ // so we don't have to hunt for it later
symtab->SymbolAtIndex(N_FUN_indexes.back())
->SetByteSize(nlist.n_value);
N_FUN_indexes.pop_back();
- // We don't really need the end function STAB as it contains the
- // size which
- // we already placed with the original symbol, so don't add it
- // if we want a
- // minimal symbol table
+ // We don't really need the end function STAB as it contains
+ // the size which we already placed with the original symbol,
+ // so don't add it if we want a minimal symbol table
add_nlist = false;
}
}
@@ -3950,18 +3902,15 @@ size_t ObjectFileMachO::ParseSymtab() {
case N_BNSYM:
// We use the current number of symbols in the symbol table in lieu
- // of
- // using nlist_idx in case we ever start trimming entries out
+ // of using nlist_idx in case we ever start trimming entries out
// Skip these if we want minimal symbol tables
add_nlist = false;
break;
case N_ENSYM:
// Set the size of the N_BNSYM to the terminating index of this
- // N_ENSYM
- // so that we can always skip the entire symbol if we need to
- // navigate
- // more quickly at the source level when parsing STABS
+ // N_ENSYM so that we can always skip the entire symbol if we need
+ // to navigate more quickly at the source level when parsing STABS
// Skip these if we want minimal symbol tables
add_nlist = false;
break;
@@ -3995,10 +3944,9 @@ size_t ObjectFileMachO::ParseSymtab() {
add_nlist = false;
if (N_SO_index != UINT32_MAX) {
// Set the size of the N_SO to the terminating index of this
- // N_SO
- // so that we can always skip the entire N_SO if we need to
- // navigate
- // more quickly at the source level when parsing STABS
+ // N_SO so that we can always skip the entire N_SO if we need
+ // to navigate more quickly at the source level when parsing
+ // STABS
symbol_ptr = symtab->SymbolAtIndex(N_SO_index);
symbol_ptr->SetByteSize(sym_idx);
symbol_ptr->SetSizeIsSibling(true);
@@ -4011,30 +3959,27 @@ size_t ObjectFileMachO::ParseSymtab() {
N_SO_index = UINT32_MAX;
} else {
// We use the current number of symbols in the symbol table in
- // lieu of
- // using nlist_idx in case we ever start trimming entries out
+ // lieu of using nlist_idx in case we ever start trimming entries
+ // out
const bool N_SO_has_full_path = symbol_name[0] == '/';
if (N_SO_has_full_path) {
if ((N_SO_index == sym_idx - 1) && ((sym_idx - 1) < num_syms)) {
// We have two consecutive N_SO entries where the first
- // contains a directory
- // and the second contains a full path.
+ // contains a directory and the second contains a full path.
sym[sym_idx - 1].GetMangled().SetValue(
ConstString(symbol_name), false);
m_nlist_idx_to_sym_idx[nlist_idx] = sym_idx - 1;
add_nlist = false;
} else {
- // This is the first entry in a N_SO that contains a directory
- // or
- // a full path to the source file
+ // This is the first entry in a N_SO that contains a
+ // directory or a full path to the source file
N_SO_index = sym_idx;
}
} else if ((N_SO_index == sym_idx - 1) &&
((sym_idx - 1) < num_syms)) {
// This is usually the second N_SO entry that contains just the
- // filename,
- // so here we combine it with the first one if we are minimizing
- // the symbol table
+ // filename, so here we combine it with the first one if we are
+ // minimizing the symbol table
const char *so_path =
sym[sym_idx - 1]
.GetMangled()
@@ -4045,12 +3990,10 @@ size_t ObjectFileMachO::ParseSymtab() {
const size_t double_slash_pos = full_so_path.find("//");
if (double_slash_pos != std::string::npos) {
// The linker has been generating bad N_SO entries with
- // doubled up paths
- // in the format "%s%s" where the first string in the
- // DW_AT_comp_dir,
- // and the second is the directory for the source file so
- // you end up with
- // a path that looks like "/tmp/src//tmp/src/"
+ // doubled up paths in the format "%s%s" where the first
+ // string in the DW_AT_comp_dir, and the second is the
+ // directory for the source file so you end up with a path
+ // that looks like "/tmp/src//tmp/src/"
FileSpec so_dir(so_path, false);
if (!so_dir.Exists()) {
so_dir.SetFile(&full_so_path[double_slash_pos + 1],
@@ -4090,10 +4033,9 @@ size_t ObjectFileMachO::ParseSymtab() {
// INCL scopes
//----------------------------------------------------------------------
case N_BINCL:
- // include file beginning: name,,NO_SECT,0,sum
- // We use the current number of symbols in the symbol table in lieu
- // of
- // using nlist_idx in case we ever start trimming entries out
+ // include file beginning: name,,NO_SECT,0,sum We use the current
+ // number of symbols in the symbol table in lieu of using nlist_idx
+ // in case we ever start trimming entries out
N_INCL_indexes.push_back(sym_idx);
type = eSymbolTypeScopeBegin;
break;
@@ -4101,10 +4043,8 @@ size_t ObjectFileMachO::ParseSymtab() {
case N_EINCL:
// include file end: name,,NO_SECT,0,0
// Set the size of the N_BINCL to the terminating index of this
- // N_EINCL
- // so that we can always skip the entire symbol if we need to
- // navigate
- // more quickly at the source level when parsing STABS
+ // N_EINCL so that we can always skip the entire symbol if we need
+ // to navigate more quickly at the source level when parsing STABS
if (!N_INCL_indexes.empty()) {
symbol_ptr = symtab->SymbolAtIndex(N_INCL_indexes.back());
symbol_ptr->SetByteSize(sym_idx + 1);
@@ -4153,10 +4093,9 @@ size_t ObjectFileMachO::ParseSymtab() {
// Left and Right Braces
//----------------------------------------------------------------------
case N_LBRAC:
- // left bracket: 0,,NO_SECT,nesting level,address
- // We use the current number of symbols in the symbol table in lieu
- // of
- // using nlist_idx in case we ever start trimming entries out
+ // left bracket: 0,,NO_SECT,nesting level,address We use the
+ // current number of symbols in the symbol table in lieu of using
+ // nlist_idx in case we ever start trimming entries out
symbol_section =
section_info.GetSection(nlist.n_sect, nlist.n_value);
N_BRAC_indexes.push_back(sym_idx);
@@ -4164,12 +4103,10 @@ size_t ObjectFileMachO::ParseSymtab() {
break;
case N_RBRAC:
- // right bracket: 0,,NO_SECT,nesting level,address
- // Set the size of the N_LBRAC to the terminating index of this
- // N_RBRAC
- // so that we can always skip the entire symbol if we need to
- // navigate
- // more quickly at the source level when parsing STABS
+ // right bracket: 0,,NO_SECT,nesting level,address Set the size of
+ // the N_LBRAC to the terminating index of this N_RBRAC so that we
+ // can always skip the entire symbol if we need to navigate more
+ // quickly at the source level when parsing STABS
symbol_section =
section_info.GetSection(nlist.n_sect, nlist.n_value);
if (!N_BRAC_indexes.empty()) {
@@ -4192,8 +4129,7 @@ size_t ObjectFileMachO::ParseSymtab() {
case N_BCOMM:
// begin common: name,,NO_SECT,0,0
// We use the current number of symbols in the symbol table in lieu
- // of
- // using nlist_idx in case we ever start trimming entries out
+ // of using nlist_idx in case we ever start trimming entries out
type = eSymbolTypeScopeBegin;
N_COMM_indexes.push_back(sym_idx);
break;
@@ -4207,10 +4143,9 @@ size_t ObjectFileMachO::ParseSymtab() {
case N_ECOMM:
// end common: name,,n_sect,0,0
// Set the size of the N_BCOMM to the terminating index of this
- // N_ECOMM/N_ECOML
- // so that we can always skip the entire symbol if we need to
- // navigate
- // more quickly at the source level when parsing STABS
+ // N_ECOMM/N_ECOML so that we can always skip the entire symbol if
+ // we need to navigate more quickly at the source level when
+ // parsing STABS
if (!N_COMM_indexes.empty()) {
symbol_ptr = symtab->SymbolAtIndex(N_COMM_indexes.back());
symbol_ptr->SetByteSize(sym_idx + 1);
@@ -4470,15 +4405,13 @@ size_t ObjectFileMachO::ParseSymtab() {
if (symbol_byte_size == 0 && function_starts_count > 0) {
addr_t symbol_lookup_file_addr = nlist.n_value;
// Do an exact address match for non-ARM addresses, else get the
- // closest since
- // the symbol might be a thumb symbol which has an address with
- // bit zero set
+ // closest since the symbol might be a thumb symbol which has an
+ // address with bit zero set
FunctionStarts::Entry *func_start_entry =
function_starts.FindEntry(symbol_lookup_file_addr, !is_arm);
if (is_arm && func_start_entry) {
// Verify that the function start address is the symbol address
- // (ARM)
- // or the symbol address + 1 (thumb)
+ // (ARM) or the symbol address + 1 (thumb)
if (func_start_entry->addr != symbol_lookup_file_addr &&
func_start_entry->addr != (symbol_lookup_file_addr + 1)) {
// Not the right entry, NULL it out...
@@ -4499,8 +4432,7 @@ size_t ObjectFileMachO::ParseSymtab() {
if (next_func_start_entry) {
addr_t next_symbol_file_addr = next_func_start_entry->addr;
// Be sure the clear the Thumb address bit when we calculate
- // the size
- // from the current and next address
+ // the size from the current and next address
if (is_arm)
next_symbol_file_addr &= THUMB_ADDRESS_BIT_MASK;
symbol_byte_size = std::min<lldb::addr_t>(
@@ -4516,10 +4448,10 @@ size_t ObjectFileMachO::ParseSymtab() {
if (is_debug == false) {
if (type == eSymbolTypeCode) {
- // See if we can find a N_FUN entry for any code symbols.
- // If we do find a match, and the name matches, then we
- // can merge the two into just the function symbol to avoid
- // duplicate entries in the symbol table
+ // See if we can find a N_FUN entry for any code symbols. If we
+ // do find a match, and the name matches, then we can merge the
+ // two into just the function symbol to avoid duplicate entries
+ // in the symbol table
std::pair<ValueToSymbolIndexMap::const_iterator,
ValueToSymbolIndexMap::const_iterator>
range;
@@ -4536,9 +4468,8 @@ size_t ObjectFileMachO::ParseSymtab() {
Mangled::ePreferMangled)) {
m_nlist_idx_to_sym_idx[nlist_idx] = pos->second;
// We just need the flags from the linker symbol, so put
- // these flags
- // into the N_FUN flags to avoid duplicate symbols in the
- // symbol table
+ // these flags into the N_FUN flags to avoid duplicate
+ // symbols in the symbol table
sym[pos->second].SetExternal(sym[sym_idx].IsExternal());
sym[pos->second].SetFlags(nlist.n_type << 16 |
nlist.n_desc);
@@ -4561,10 +4492,10 @@ size_t ObjectFileMachO::ParseSymtab() {
type == eSymbolTypeObjCClass ||
type == eSymbolTypeObjCMetaClass ||
type == eSymbolTypeObjCIVar) {
- // See if we can find a N_STSYM entry for any data symbols.
- // If we do find a match, and the name matches, then we
- // can merge the two into just the Static symbol to avoid
- // duplicate entries in the symbol table
+ // See if we can find a N_STSYM entry for any data symbols. If we
+ // do find a match, and the name matches, then we can merge the
+ // two into just the Static symbol to avoid duplicate entries in
+ // the symbol table
std::pair<ValueToSymbolIndexMap::const_iterator,
ValueToSymbolIndexMap::const_iterator>
range;
@@ -4581,9 +4512,8 @@ size_t ObjectFileMachO::ParseSymtab() {
Mangled::ePreferMangled)) {
m_nlist_idx_to_sym_idx[nlist_idx] = pos->second;
// We just need the flags from the linker symbol, so put
- // these flags
- // into the N_STSYM flags to avoid duplicate symbols in the
- // symbol table
+ // these flags into the N_STSYM flags to avoid duplicate
+ // symbols in the symbol table
sym[pos->second].SetExternal(sym[sym_idx].IsExternal());
sym[pos->second].SetFlags(nlist.n_type << 16 |
nlist.n_desc);
@@ -4607,16 +4537,15 @@ size_t ObjectFileMachO::ParseSymtab() {
if (pos != N_GSYM_name_to_sym_idx.end()) {
const uint32_t GSYM_sym_idx = pos->second;
m_nlist_idx_to_sym_idx[nlist_idx] = GSYM_sym_idx;
- // Copy the address, because often the N_GSYM address has an
- // invalid address of zero
- // when the global is a common symbol
+ // Copy the address, because often the N_GSYM address has
+ // an invalid address of zero when the global is a common
+ // symbol
sym[GSYM_sym_idx].GetAddressRef().SetSection(
symbol_section);
sym[GSYM_sym_idx].GetAddressRef().SetOffset(symbol_value);
// We just need the flags from the linker symbol, so put
- // these flags
- // into the N_GSYM flags to avoid duplicate symbols in the
- // symbol table
+ // these flags into the N_GSYM flags to avoid duplicate
+ // symbols in the symbol table
sym[GSYM_sym_idx].SetFlags(nlist.n_type << 16 |
nlist.n_desc);
sym[sym_idx].Clear();
@@ -4723,8 +4652,8 @@ size_t ObjectFileMachO::ParseSymtab() {
}
}
- // Trim our symbols down to just what we ended up with after
- // removing any symbols.
+ // Trim our symbols down to just what we ended up with after removing any
+ // symbols.
if (sym_idx < num_syms) {
num_syms = sym_idx;
sym = symtab->Resize(num_syms);
@@ -4772,13 +4701,12 @@ size_t ObjectFileMachO::ParseSymtab() {
m_nlist_idx_to_sym_idx.find(stub_sym_id);
Symbol *stub_symbol = NULL;
if (index_pos != end_index_pos) {
- // We have a remapping from the original nlist index to
- // a current symbol index, so just look this up by index
+ // We have a remapping from the original nlist index to a
+ // current symbol index, so just look this up by index
stub_symbol = symtab->SymbolAtIndex(index_pos->second);
} else {
- // We need to lookup a symbol using the original nlist
- // symbol index since this index is coming from the
- // S_SYMBOL_STUBS
+ // We need to lookup a symbol using the original nlist symbol
+ // index since this index is coming from the S_SYMBOL_STUBS
stub_symbol = symtab->FindSymbolByID(stub_sym_id);
}
@@ -4787,12 +4715,9 @@ size_t ObjectFileMachO::ParseSymtab() {
if (stub_symbol->GetType() == eSymbolTypeUndefined) {
// Change the external symbol into a trampoline that makes
- // sense
- // These symbols were N_UNDF N_EXT, and are useless to us,
- // so we
- // can re-use them so we don't have to make up a synthetic
- // symbol
- // for no good reason.
+ // sense These symbols were N_UNDF N_EXT, and are useless
+ // to us, so we can re-use them so we don't have to make up
+ // a synthetic symbol for no good reason.
if (resolver_addresses.find(symbol_stub_addr) ==
resolver_addresses.end())
stub_symbol->SetType(eSymbolTypeTrampoline);
@@ -4837,8 +4762,8 @@ size_t ObjectFileMachO::ParseSymtab() {
if (!trie_entries.empty()) {
for (const auto &e : trie_entries) {
if (e.entry.import_name) {
- // Only add indirect symbols from the Trie entries if we
- // didn't have a N_INDR nlist entry for this already
+ // Only add indirect symbols from the Trie entries if we didn't have
+ // a N_INDR nlist entry for this already
if (indirect_symbol_names.find(e.entry.name) ==
indirect_symbol_names.end()) {
// Make a synthetic symbol to describe re-exported symbol.
@@ -4952,16 +4877,16 @@ bool ObjectFileMachO::GetArchitecture(const llvm::MachO::mach_header &header,
if (header.filetype == MH_PRELOAD) {
if (header.cputype == CPU_TYPE_ARM) {
- // If this is a 32-bit arm binary, and it's a standalone binary,
- // force the Vendor to Apple so we don't accidentally pick up
- // the generic armv7 ABI at runtime. Apple's armv7 ABI always uses
- // r7 for the frame pointer register; most other armv7 ABIs use a
- // combination of r7 and r11.
+ // If this is a 32-bit arm binary, and it's a standalone binary, force
+ // the Vendor to Apple so we don't accidentally pick up the generic
+ // armv7 ABI at runtime. Apple's armv7 ABI always uses r7 for the
+ // frame pointer register; most other armv7 ABIs use a combination of
+ // r7 and r11.
triple.setVendor(llvm::Triple::Apple);
} else {
// Set vendor to an unspecified unknown or a "*" so it can match any
- // vendor
- // This is required for correct behavior of EFI debugging on x86_64
+ // vendor This is required for correct behavior of EFI debugging on
+ // x86_64
triple.setVendor(llvm::Triple::UnknownVendor);
triple.setVendorName(llvm::StringRef());
}
@@ -5032,7 +4957,8 @@ uint32_t ObjectFileMachO::GetDependentModules(FileSpecList &files) {
std::vector<std::string> rpath_relative_paths;
std::vector<std::string> at_exec_relative_paths;
const bool resolve_path = false; // Don't resolve the dependent file paths
- // since they may not reside on this system
+ // since they may not reside on this
+ // system
uint32_t i;
for (i = 0; i < m_header.ncmds; ++i) {
const uint32_t cmd_offset = offset;
@@ -5096,8 +5022,8 @@ uint32_t ObjectFileMachO::GetDependentModules(FileSpecList &files) {
for (const auto &rpath : rpath_paths) {
std::string path = rpath;
path += rpath_relative_path;
- // It is OK to resolve this path because we must find a file on
- // disk for us to accept it anyway if it is rpath relative.
+ // It is OK to resolve this path because we must find a file on disk
+ // for us to accept it anyway if it is rpath relative.
FileSpec file_spec(path, true);
if (file_spec.Exists() && files.AppendIfUnique(file_spec)) {
count++;
@@ -5126,17 +5052,15 @@ uint32_t ObjectFileMachO::GetDependentModules(FileSpecList &files) {
lldb_private::Address ObjectFileMachO::GetEntryPointAddress() {
// If the object file is not an executable it can't hold the entry point.
- // m_entry_point_address
- // is initialized to an invalid address, so we can just return that.
- // If m_entry_point_address is valid it means we've found it already, so
- // return the cached value.
+ // m_entry_point_address is initialized to an invalid address, so we can just
+ // return that. If m_entry_point_address is valid it means we've found it
+ // already, so return the cached value.
if (!IsExecutable() || m_entry_point_address.IsValid())
return m_entry_point_address;
// Otherwise, look for the UnixThread or Thread command. The data for the
- // Thread command is given in
- // /usr/include/mach-o.h, but it is basically:
+ // Thread command is given in /usr/include/mach-o.h, but it is basically:
//
// uint32_t flavor - this is the flavor argument you would pass to
// thread_get_state
@@ -5150,9 +5074,9 @@ lldb_private::Address ObjectFileMachO::GetEntryPointAddress() {
// FIXME: We will need to have a "RegisterContext data provider" class at some
// point that can get all the registers
// out of data in this form & attach them to a given thread. That should
- // underlie the MacOS X User process plugin,
- // and we'll also need it for the MacOS X Core File process plugin. When we
- // have that we can also use it here.
+ // underlie the MacOS X User process plugin, and we'll also need it for the
+ // MacOS X Core File process plugin. When we have that we can also use it
+ // here.
//
// For now we hard-code the offsets and flavors we need:
//
@@ -5257,16 +5181,14 @@ lldb_private::Address ObjectFileMachO::GetEntryPointAddress() {
if (start_address != LLDB_INVALID_ADDRESS) {
// We got the start address from the load commands, so now resolve that
- // address in the sections
- // of this ObjectFile:
+ // address in the sections of this ObjectFile:
if (!m_entry_point_address.ResolveAddressUsingFileSections(
start_address, GetSectionList())) {
m_entry_point_address.Clear();
}
} else {
// 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.
+ // As a fallback look for the "start" symbol in the main executable.
ModuleSP module_sp(GetModule());
@@ -5331,8 +5253,8 @@ std::string ObjectFileMachO::GetIdentifierString() {
if (module_sp) {
std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex());
- // First, look over the load commands for an LC_NOTE load command
- // with data_owner string "kern ver str" & use that if found.
+ // First, look over the load commands for an LC_NOTE load command with
+ // data_owner string "kern ver str" & use that if found.
lldb::offset_t offset = MachHeaderSizeFromMagic(m_header.magic);
for (uint32_t i = 0; i < m_header.ncmds; ++i) {
const uint32_t cmd_offset = offset;
@@ -5348,8 +5270,8 @@ std::string ObjectFileMachO::GetIdentifierString() {
uint64_t fileoff = m_data.GetU64_unchecked (&offset);
uint64_t size = m_data.GetU64_unchecked (&offset);
- // "kern ver str" has a uint32_t version and then a
- // nul terminated c-string.
+ // "kern ver str" has a uint32_t version and then a nul terminated
+ // c-string.
if (strcmp ("kern ver str", data_owner) == 0)
{
offset = fileoff;
@@ -5376,8 +5298,8 @@ std::string ObjectFileMachO::GetIdentifierString() {
offset = cmd_offset + lc.cmdsize;
}
- // Second, make a pass over the load commands looking for an
- // obsolete LC_IDENT load command.
+ // Second, make a pass over the load commands looking for an obsolete
+ // LC_IDENT load command.
offset = MachHeaderSizeFromMagic(m_header.magic);
for (uint32_t i = 0; i < m_header.ncmds; ++i) {
const uint32_t cmd_offset = offset;
@@ -5422,7 +5344,8 @@ bool ObjectFileMachO::GetCorefileMainBinaryInfo (addr_t &address, UUID &uuid) {
uint64_t fileoff = m_data.GetU64_unchecked (&offset);
uint64_t size = m_data.GetU64_unchecked (&offset);
- // "main bin spec" (main binary specification) data payload is formatted:
+ // "main bin spec" (main binary specification) data payload is
+ // formatted:
// uint32_t version [currently 1]
// uint32_t type [0 == unspecified, 1 == kernel, 2 == user process]
// uint64_t address [ UINT64_MAX if address not specified ]
@@ -5503,9 +5426,9 @@ ObjectFile::Type ObjectFileMachO::CalculateType() {
// UUID load command.
UUID uuid;
if (GetUUID(&uuid)) {
- // this checking for the UUID load command is not enough
- // we could eventually look for the symbol named
- // "OSKextGetCurrentIdentifier" as this is required of kexts
+ // this checking for the UUID load command is not enough we could
+ // eventually look for the symbol named "OSKextGetCurrentIdentifier" as
+ // this is required of kexts
if (m_strata == eStrataInvalid)
m_strata = eStrataKernel;
return eTypeSharedLibrary;
@@ -5547,9 +5470,9 @@ ObjectFile::Strata ObjectFileMachO::CalculateStrata() {
// UUID load command.
UUID uuid;
if (GetUUID(&uuid)) {
- // this checking for the UUID load command is not enough
- // we could eventually look for the symbol named
- // "OSKextGetCurrentIdentifier" as this is required of kexts
+ // this checking for the UUID load command is not enough we could
+ // eventually look for the symbol named "OSKextGetCurrentIdentifier" as
+ // this is required of kexts
if (m_type == eTypeInvalid)
m_type = eTypeSharedLibrary;
@@ -5636,8 +5559,8 @@ uint32_t ObjectFileMachO::GetVersion(uint32_t *versions,
for (i = 3; i < num_versions; ++i)
versions[i] = UINT32_MAX;
}
- // The LC_ID_DYLIB load command has a version with 3 version numbers
- // in it, so always return 3
+ // The LC_ID_DYLIB load command has a version with 3 version numbers in
+ // it, so always return 3
return 3;
}
}
@@ -5837,9 +5760,9 @@ lldb_private::ConstString ObjectFileMachO::GetPluginName() {
uint32_t ObjectFileMachO::GetPluginVersion() { return 1; }
Section *ObjectFileMachO::GetMachHeaderSection() {
- // Find the first address of the mach header which is the first non-zero
- // file sized section whose file offset is zero. This is the base file address
- // of the mach-o file which can be subtracted from the vmaddr of the other
+ // Find the first address of the mach header which is the first non-zero file
+ // sized section whose file offset is zero. This is the base file address of
+ // the mach-o file which can be subtracted from the vmaddr of the other
// segments found in memory and added to the load address
ModuleSP module_sp = GetModule();
if (module_sp) {
@@ -5877,8 +5800,8 @@ lldb::addr_t ObjectFileMachO::CalculateSectionLoadAddressForMemoryImage(
module_sp.get() == section->GetModule().get()) {
// Ignore __LINKEDIT and __DWARF segments
if (section->GetName() == GetSegmentNameLINKEDIT()) {
- // Only map __LINKEDIT if we have an in memory image and this isn't
- // a kernel binary like a kext or mach_kernel.
+ // Only map __LINKEDIT if we have an in memory image and this isn't a
+ // kernel binary like a kext or mach_kernel.
const bool is_memory_image = (bool)m_process_wp.lock();
const Strata strata = GetStrata();
if (is_memory_image == false || strata == eStrataKernel)
@@ -5904,9 +5827,8 @@ bool ObjectFileMachO::SetLoadAddress(Target &target, lldb::addr_t value,
if (value_is_offset) {
// "value" is an offset to apply to each top level segment
for (size_t sect_idx = 0; sect_idx < num_sections; ++sect_idx) {
- // Iterate through the object file sections to find all
- // of the sections that size on disk (to avoid __PAGEZERO)
- // and load them
+ // Iterate through the object file sections to find all of the
+ // sections that size on disk (to avoid __PAGEZERO) and load them
SectionSP section_sp(section_list->GetSectionAtIndex(sect_idx));
if (section_sp && section_sp->GetFileSize() > 0 &&
section_sp->IsThreadSpecific() == false &&
@@ -5914,8 +5836,7 @@ bool ObjectFileMachO::SetLoadAddress(Target &target, lldb::addr_t value,
// Ignore __LINKEDIT and __DWARF segments
if (section_sp->GetName() == GetSegmentNameLINKEDIT()) {
// Only map __LINKEDIT if we have an in memory image and this
- // isn't
- // a kernel binary like a kext or mach_kernel.
+ // isn't a kernel binary like a kext or mach_kernel.
const bool is_memory_image = (bool)m_process_wp.lock();
const Strata strata = GetStrata();
if (is_memory_image == false || strata == eStrataKernel)
@@ -6065,10 +5986,10 @@ bool ObjectFileMachO::SaveCore(const lldb::ProcessSP &process_sp,
ThreadList &thread_list = process_sp->GetThreadList();
const uint32_t num_threads = thread_list.GetSize();
- // Make an array of LC_THREAD data items. Each one contains
- // the contents of the LC_THREAD load command. The data doesn't
- // contain the load command + load command size, we will
- // add the load command and load command size as we emit the data.
+ // Make an array of LC_THREAD data items. Each one contains the
+ // contents of the LC_THREAD load command. The data doesn't contain
+ // the load command + load command size, we will add the load command
+ // and load command size as we emit the data.
std::vector<StreamString> LC_THREAD_datas(num_threads);
for (auto &LC_THREAD_data : LC_THREAD_datas) {
LC_THREAD_data.GetFlags().Set(Stream::eBinary);
@@ -6228,8 +6149,8 @@ bool ObjectFileMachO::SaveCore(const lldb::ProcessSP &process_sp,
bytes_left -= bytes_read;
addr += bytes_read;
} else {
- // Some pages within regions are not readable, those
- // should be zero filled
+ // Some pages within regions are not readable, those should
+ // be zero filled
memset(bytes, 0, bytes_to_read);
size_t bytes_written = bytes_to_read;
error = core_file.Write(bytes, bytes_written);
diff --git a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
index 77bfa7fe0a6..3612ff0b595 100644
--- a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
+++ b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
@@ -236,8 +236,8 @@ bool ObjectFilePECOFF::SetLoadAddress(Target &target, addr_t value,
size_t sect_idx = 0;
for (sect_idx = 0; sect_idx < num_sections; ++sect_idx) {
- // Iterate through the object file sections to find all
- // of the sections that have SHF_ALLOC in their flag bits.
+ // Iterate through the object file sections to find all of the sections
+ // that have SHF_ALLOC in their flag bits.
SectionSP section_sp(section_list->GetSectionAtIndex(sect_idx));
if (section_sp && !section_sp->IsThreadSpecific()) {
if (target.GetSectionLoadList().SetSectionLoadAddress(
@@ -268,8 +268,8 @@ uint32_t ObjectFilePECOFF::GetAddressByteSize() const {
//----------------------------------------------------------------------
// NeedsEndianSwap
//
-// Return true if an endian swap needs to occur when extracting data
-// from this file.
+// Return true if an endian swap needs to occur when extracting data from this
+// file.
//----------------------------------------------------------------------
bool ObjectFilePECOFF::NeedsEndianSwap() const {
#if defined(__LITTLE_ENDIAN__)
@@ -552,8 +552,8 @@ Symtab *ObjectFilePECOFF::GetSymtab() {
// are followed by a 4-byte string table offset. Else these
// 8 bytes contain the symbol name
if (symtab_data.GetU32(&offset) == 0) {
- // Long string that doesn't fit into the symbol table name,
- // so now we must read the 4 byte string table offset
+ // Long string that doesn't fit into the symbol table name, so
+ // now we must read the 4 byte string table offset
uint32_t strtab_offset = symtab_data.GetU32(&offset);
symbol_name_cstr = strtab_data.PeekCStr(strtab_offset);
symbol_name.assign(symbol_name_cstr);
OpenPOWER on IntegriCloud