diff options
author | Greg Clayton <gclayton@apple.com> | 2012-07-17 03:23:13 +0000 |
---|---|---|
committer | Greg Clayton <gclayton@apple.com> | 2012-07-17 03:23:13 +0000 |
commit | 23f59509a8790b04c691ec063c55724a3bfee7eb (patch) | |
tree | 9bd1537b53423b7a43ccd4b9bceb178960bbbb02 /lldb/source/Plugins | |
parent | 24a8378c4f5ab46f9156e8c271500a6e051c2fd4 (diff) | |
download | bcm5719-llvm-23f59509a8790b04c691ec063c55724a3bfee7eb.tar.gz bcm5719-llvm-23f59509a8790b04c691ec063c55724a3bfee7eb.zip |
Ran the static analyzer on the codebase and found a few things.
llvm-svn: 160338
Diffstat (limited to 'lldb/source/Plugins')
14 files changed, 174 insertions, 250 deletions
diff --git a/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp b/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp index 7800a977db4..fb7272de966 100644 --- a/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp +++ b/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp @@ -208,7 +208,6 @@ DynamicLoaderDarwinKernel::OSKextLoadedKextSummary::LoadImageUsingMemoryModule ( if (!module_sp) { - bool uuid_is_valid = uuid.IsValid(); if (uuid_is_valid) { ModuleList &target_images = target.GetImages(); diff --git a/lldb/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp b/lldb/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp index 7157f405385..cad15fe75f2 100644 --- a/lldb/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp +++ b/lldb/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp @@ -564,7 +564,7 @@ EmulateInstructionARM::EmulatePOP (const uint32_t opcode, const ARMEncoding enco // In ARMv5T and above, this is an interworking branch. if (!LoadWritePC(context, data)) return false; - addr += addr_byte_size; + //addr += addr_byte_size; } context.type = EmulateInstruction::eContextAdjustStackPointer; @@ -1295,13 +1295,12 @@ EmulateInstructionARM::EmulateADDSPImm (const uint32_t opcode, const ARMEncoding return false; uint32_t imm32; // the immediate operand uint32_t d; - bool setflags; + //bool setflags = false; // Add this back if/when support eEncodingT3 eEncodingA1 switch (encoding) { case eEncodingT1: // d = UInt(Rd); setflags = FALSE; imm32 = ZeroExtend(imm8:'00', 32); d = Bits32 (opcode, 10, 8); - setflags = false; imm32 = (Bits32 (opcode, 7, 0) << 2); break; @@ -1309,7 +1308,6 @@ EmulateInstructionARM::EmulateADDSPImm (const uint32_t opcode, const ARMEncoding case eEncodingT2: // d = 13; setflags = FALSE; imm32 = ZeroExtend(imm7:'00', 32); d = 13; - setflags = false; imm32 = ThumbImm7Scaled(opcode); // imm32 = ZeroExtend(imm7:'00', 32) break; @@ -1335,6 +1333,15 @@ EmulateInstructionARM::EmulateADDSPImm (const uint32_t opcode, const ARMEncoding { if (!WriteRegisterUnsigned (context, eRegisterKindDWARF, dwarf_r0 + d, addr)) return false; + + // Add this back if/when support eEncodingT3 eEncodingA1 + //if (setflags) + //{ + // APSR.N = result<31>; + // APSR.Z = IsZeroBit(result); + // APSR.C = carry; + // APSR.V = overflow; + //} } } return true; @@ -5395,6 +5402,7 @@ EmulateInstructionARM::EmulateADR (const uint32_t opcode, const ARMEncoding enco case eEncodingT1: Rd = Bits32(opcode, 10, 8); imm32 = ThumbImm8Scaled(opcode); // imm32 = ZeroExtend(imm8:'00', 32) + add = true; break; case eEncodingT2: case eEncodingT3: @@ -11505,6 +11513,10 @@ EmulateInstructionARM::EmulateVLD1Single (const uint32_t opcode, const ARMEncodi else alignment = 4; } + else + { + return false; + } // d = UInt(D:Vd); n = UInt(Rn); m = UInt(Rm); d = (Bit32 (opcode, 22) << 4) | Bits32 (opcode, 15, 12); n = Bits32 (opcode, 19, 16); @@ -11841,6 +11853,10 @@ EmulateInstructionARM::EmulateVST1Single (const uint32_t opcode, ARMEncoding enc else alignment = 4; } + else + { + return false; + } // d = UInt(D:Vd); n = UInt(Rn); m = UInt(Rm); d = (Bit32 (opcode, 22) << 4) | Bits32 (opcode, 15, 12); n = Bits32 (opcode, 19, 16); diff --git a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp index 3db50391f33..dbbca6f56f1 100644 --- a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp +++ b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp @@ -877,14 +877,11 @@ ObjectFileELF::ParseDynamicSymbols() DataExtractor dynsym_data; if (ReadSectionData(dynsym, dynsym_data)) { - const unsigned section_size = dynsym_data.GetByteSize(); - unsigned offset = 0; unsigned cursor = 0; while (cursor < section_size) { - offset = cursor; if (!symbol.Parse(dynsym_data, &cursor)) break; diff --git a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp index 4818ad13a77..7d44f8316e6 100644 --- a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp +++ b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp @@ -2933,13 +2933,8 @@ struct lldb_copy_dyld_cache_local_symbols_entry func_start_entry->data = true; addr_t symbol_file_addr = func_start_entry->addr; - uint32_t symbol_flags = 0; if (is_arm) - { - if (symbol_file_addr & 1) - symbol_flags = MACHO_NLIST_ARM_SYMBOL_IS_THUMB; symbol_file_addr &= 0xfffffffffffffffeull; - } const FunctionStarts::Entry *next_func_start_entry = function_starts.FindNextEntry (func_start_entry); const addr_t section_end_file_addr = section_file_addr + symbol_section->GetByteSize(); diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp index 5fd5b6d9506..7b1a7274046 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp @@ -99,6 +99,7 @@ PlatformRemoteiOS::CreateInstance (bool force, const ArchSpec *arch) { case llvm::Triple::Apple: create = true; + break; case llvm::Triple::UnknownArch: create = !arch->TripleVendorWasSpecified(); diff --git a/lldb/source/Plugins/Process/Utility/ARMUtils.h b/lldb/source/Plugins/Process/Utility/ARMUtils.h index fce066d91ff..76d64e15a53 100644 --- a/lldb/source/Plugins/Process/Utility/ARMUtils.h +++ b/lldb/source/Plugins/Process/Utility/ARMUtils.h @@ -25,10 +25,10 @@ static inline uint32_t Align(uint32_t val, uint32_t alignment) static inline uint32_t DecodeImmShift(const uint32_t type, const uint32_t imm5, ARM_ShifterType &shift_t) { - switch (type) { + switch (type) + { default: //assert(0 && "Invalid shift type"); - return UINT32_MAX; case 0: shift_t = SRType_LSL; return imm5; @@ -50,6 +50,9 @@ static inline uint32_t DecodeImmShift(const uint32_t type, const uint32_t imm5, return imm5; } } + shift_t = SRType_Invalid; + return UINT32_MAX; + } // A8.6.35 CMP (register) -- Encoding T3 @@ -322,6 +325,7 @@ static inline uint32_t ThumbExpandImm_C(uint32_t opcode, uint32_t carry_in, uint if (bits(imm12, 11, 10) == 0) { switch (bits(imm12, 9, 8)) { + default: // Keep static analyzer happy with a default case case 0: imm32 = abcdefgh; break; diff --git a/lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp b/lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp index d1040d37d31..e8633358e28 100644 --- a/lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp +++ b/lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp @@ -184,7 +184,7 @@ RegisterContextLLDB::InitializeZerothFrame() UnwindPlan::RowSP active_row; int cfa_offset = 0; - int row_register_kind; + int row_register_kind = -1; if (m_full_unwind_plan_sp && m_full_unwind_plan_sp->PlanValidAtAddress (m_current_pc)) { active_row = m_full_unwind_plan_sp->GetRowForFunctionOffset (m_current_offset); @@ -507,7 +507,7 @@ RegisterContextLLDB::InitializeNonZerothFrame() UnwindPlan::RowSP active_row; int cfa_offset = 0; - int row_register_kind; + int row_register_kind = -1; // Try to get by with just the fast UnwindPlan if possible - the full UnwindPlan may be expensive to get // (e.g. if we have to parse the entire eh_frame section of an ObjectFile for the first time.) @@ -670,8 +670,8 @@ RegisterContextLLDB::GetFastUnwindPlanForFrame () const char *has_fast = ""; if (m_fast_unwind_plan_sp) has_fast = ", and has a fast UnwindPlan"; - log->Printf("%*sFrame %u frame has a fast UnwindPlan", - m_frame_number < 100 ? m_frame_number : 100, "", m_frame_number); + log->Printf("%*sFrame %u frame%s", + m_frame_number < 100 ? m_frame_number : 100, "", m_frame_number, has_fast); } m_frame_type = eNormalFrame; return unwind_plan_sp; diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp index 4fac83d334c..180c1f3a5ef 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp @@ -1824,13 +1824,13 @@ GDBRemoteCommunicationClient::LaunchGDBserverAndGetPort () std::string name; std::string value; uint16_t port = 0; - lldb::pid_t pid = LLDB_INVALID_PROCESS_ID; + //lldb::pid_t pid = LLDB_INVALID_PROCESS_ID; while (response.GetNameColonValue(name, value)) { if (name.size() == 4 && name.compare("port") == 0) port = Args::StringToUInt32(value.c_str(), 0, 0); - if (name.size() == 3 && name.compare("pid") == 0) - pid = Args::StringToUInt32(value.c_str(), LLDB_INVALID_PROCESS_ID, 0); +// if (name.size() == 3 && name.compare("pid") == 0) +// pid = Args::StringToUInt32(value.c_str(), LLDB_INVALID_PROCESS_ID, 0); } return port; } diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp index 06d19e40033..6e8b3c4251e 100644 --- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp @@ -229,8 +229,7 @@ ProcessGDBRemote::BuildDynamicRegisterInfo (bool force) m_register_info.Clear(); uint32_t reg_offset = 0; uint32_t reg_num = 0; - StringExtractorGDBRemote::ResponseType response_type; - for (response_type = StringExtractorGDBRemote::eResponse; + for (StringExtractorGDBRemote::ResponseType response_type = StringExtractorGDBRemote::eResponse; response_type == StringExtractorGDBRemote::eResponse; ++reg_num) { @@ -376,7 +375,6 @@ ProcessGDBRemote::BuildDynamicRegisterInfo (bool force) } else { - response_type = StringExtractorGDBRemote::eError; break; } } @@ -1271,7 +1269,6 @@ ProcessGDBRemote::SetThreadStopInfo (StringExtractor& stop_packet) uint32_t exc_type = 0; std::vector<addr_t> exc_data; addr_t thread_dispatch_qaddr = LLDB_INVALID_ADDRESS; - uint32_t exc_data_count = 0; ThreadSP thread_sp; while (stop_packet.GetNameColonValue(name, value)) @@ -1281,11 +1278,6 @@ ProcessGDBRemote::SetThreadStopInfo (StringExtractor& stop_packet) // exception type in big endian hex exc_type = Args::StringToUInt32 (value.c_str(), 0, 16); } - else if (name.compare("mecount") == 0) - { - // exception count in big endian hex - exc_data_count = Args::StringToUInt32 (value.c_str(), 0, 16); - } else if (name.compare("medata") == 0) { // exception data in big endian hex diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp index af870d51836..b0ec6091f8b 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp @@ -618,9 +618,8 @@ DWARFCompileUnit::Index (const uint32_t cu_idx, DWARFDebugInfoEntry::Attributes attributes; const char *name = NULL; const char *mangled_cstr = NULL; - bool is_variable = false; bool is_declaration = false; - bool is_artificial = false; + //bool is_artificial = false; bool has_address = false; bool has_location = false; bool is_global_or_static_variable = false; @@ -629,8 +628,6 @@ DWARFCompileUnit::Index (const uint32_t cu_idx, const size_t num_attributes = die.GetAttributes(m_dwarf2Data, this, fixed_form_sizes, attributes); if (num_attributes > 0) { - is_variable = tag == DW_TAG_variable; - for (uint32_t i=0; i<num_attributes; ++i) { dw_attr_t attr = attributes.AttributeAtIndex(i); @@ -647,10 +644,10 @@ DWARFCompileUnit::Index (const uint32_t cu_idx, is_declaration = form_value.Unsigned() != 0; break; - case DW_AT_artificial: - if (attributes.ExtractFormValueAtIndex(m_dwarf2Data, i, form_value)) - is_artificial = form_value.Unsigned() != 0; - break; +// case DW_AT_artificial: +// if (attributes.ExtractFormValueAtIndex(m_dwarf2Data, i, form_value)) +// is_artificial = form_value.Unsigned() != 0; +// break; case DW_AT_MIPS_linkage_name: if (attributes.ExtractFormValueAtIndex(m_dwarf2Data, i, form_value)) @@ -798,7 +795,7 @@ DWARFCompileUnit::Index (const uint32_t cu_idx, // as our name. If it starts with '_', then it is ok, else compare // the string to make sure it isn't the same and we don't end up // with duplicate entries - if (name != mangled_cstr && ((mangled_cstr[0] == '_') || (::strcmp(name, mangled_cstr) != 0))) + if (name != mangled_cstr && ((mangled_cstr[0] == '_') || (name && ::strcmp(name, mangled_cstr) != 0))) { Mangled mangled (mangled_cstr, true); func_fullnames.Insert (mangled.GetMangledName(), die.GetOffset()); diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugPubnames.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugPubnames.cpp index 8c2f46a48c7..79f36d28ca5 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugPubnames.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugPubnames.cpp @@ -105,7 +105,6 @@ DWARFDebugPubnames::GeneratePubnames(SymbolFileDWARF* dwarf2Data) const char *name = NULL; const char *mangled = NULL; bool add_die = false; - bool is_variable = false; const size_t num_attributes = die->GetAttributes(dwarf2Data, cu, fixed_form_sizes, attributes); if (num_attributes > 0) { @@ -113,8 +112,6 @@ DWARFDebugPubnames::GeneratePubnames(SymbolFileDWARF* dwarf2Data) dw_tag_t tag = die->Tag(); - is_variable = tag == DW_TAG_variable; - for (i=0; i<num_attributes; ++i) { dw_attr_t attr = attributes.AttributeAtIndex(i); diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp index 07b232a55e5..6ccd5601aab 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp @@ -186,83 +186,83 @@ DWARFFormValue::SkipValue(const DataExtractor& debug_info_data, uint32_t* offset bool DWARFFormValue::SkipValue(dw_form_t form, const DataExtractor& debug_info_data, uint32_t* offset_ptr, const DWARFCompileUnit* cu) { - bool indirect = false; - do + switch (form) { - indirect = false; - switch (form) - { - // Blocks if inlined data that have a length field and the data bytes - // inlined in the .debug_info - case DW_FORM_exprloc: - case DW_FORM_block: { dw_uleb128_t size = debug_info_data.GetULEB128(offset_ptr); *offset_ptr += size; } return true; - case DW_FORM_block1: { dw_uleb128_t size = debug_info_data.GetU8(offset_ptr); *offset_ptr += size; } return true; - case DW_FORM_block2: { dw_uleb128_t size = debug_info_data.GetU16(offset_ptr); *offset_ptr += size; } return true; - case DW_FORM_block4: { dw_uleb128_t size = debug_info_data.GetU32(offset_ptr); *offset_ptr += size; } return true; - - // Inlined NULL terminated C-strings - case DW_FORM_string: - debug_info_data.GetCStr(offset_ptr); - return true; - - // Compile unit address sized values - case DW_FORM_addr: - case DW_FORM_ref_addr: - *offset_ptr += DWARFCompileUnit::GetAddressByteSize(cu); - return true; - - // 0 bytes values (implied from DW_FORM) - case DW_FORM_flag_present: - return true; - - // 1 byte values - case DW_FORM_data1: - case DW_FORM_flag: - case DW_FORM_ref1: - *offset_ptr += 1; - return true; + // Blocks if inlined data that have a length field and the data bytes + // inlined in the .debug_info + case DW_FORM_exprloc: + case DW_FORM_block: { dw_uleb128_t size = debug_info_data.GetULEB128(offset_ptr); *offset_ptr += size; } return true; + case DW_FORM_block1: { dw_uleb128_t size = debug_info_data.GetU8(offset_ptr); *offset_ptr += size; } return true; + case DW_FORM_block2: { dw_uleb128_t size = debug_info_data.GetU16(offset_ptr); *offset_ptr += size; } return true; + case DW_FORM_block4: { dw_uleb128_t size = debug_info_data.GetU32(offset_ptr); *offset_ptr += size; } return true; - // 2 byte values - case DW_FORM_data2: - case DW_FORM_ref2: - *offset_ptr += 2; - return true; + // Inlined NULL terminated C-strings + case DW_FORM_string: + debug_info_data.GetCStr(offset_ptr); + return true; - // 32 bit for DWARF 32, 64 for DWARF 64 - case DW_FORM_sec_offset: - *offset_ptr += 4; - return true; + // Compile unit address sized values + case DW_FORM_addr: + case DW_FORM_ref_addr: + *offset_ptr += DWARFCompileUnit::GetAddressByteSize(cu); + return true; - // 4 byte values - case DW_FORM_strp: - case DW_FORM_data4: - case DW_FORM_ref4: - *offset_ptr += 4; - return true; + // 0 bytes values (implied from DW_FORM) + case DW_FORM_flag_present: + return true; - // 8 byte values - case DW_FORM_data8: - case DW_FORM_ref8: - case DW_FORM_ref_sig8: - *offset_ptr += 8; - return true; + // 1 byte values + case DW_FORM_data1: + case DW_FORM_flag: + case DW_FORM_ref1: + *offset_ptr += 1; + return true; - // signed or unsigned LEB 128 values - case DW_FORM_sdata: - case DW_FORM_udata: - case DW_FORM_ref_udata: - debug_info_data.Skip_LEB128(offset_ptr); - return true; + // 2 byte values + case DW_FORM_data2: + case DW_FORM_ref2: + *offset_ptr += 2; + return true; - case DW_FORM_indirect: - indirect = true; - form = debug_info_data.GetULEB128(offset_ptr); - break; - default: - return false; + // 32 bit for DWARF 32, 64 for DWARF 64 + case DW_FORM_sec_offset: + *offset_ptr += 4; + return true; + + // 4 byte values + case DW_FORM_strp: + case DW_FORM_data4: + case DW_FORM_ref4: + *offset_ptr += 4; + return true; + + // 8 byte values + case DW_FORM_data8: + case DW_FORM_ref8: + case DW_FORM_ref_sig8: + *offset_ptr += 8; + return true; + + // signed or unsigned LEB 128 values + case DW_FORM_sdata: + case DW_FORM_udata: + case DW_FORM_ref_udata: + debug_info_data.Skip_LEB128(offset_ptr); + return true; + + case DW_FORM_indirect: + { + dw_form_t indirect_form = debug_info_data.GetULEB128(offset_ptr); + return DWARFFormValue::SkipValue (indirect_form, + debug_info_data, + offset_ptr, + cu); } - } while (indirect); - return true; + + default: + break; + } + return false; } diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp index 3b474535ed1..371343c7f4b 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -421,16 +421,8 @@ SymbolFileDWARF::CalculateAbilities () return 0; uint64_t debug_abbrev_file_size = 0; - uint64_t debug_aranges_file_size = 0; - uint64_t debug_frame_file_size = 0; uint64_t debug_info_file_size = 0; uint64_t debug_line_file_size = 0; - uint64_t debug_loc_file_size = 0; - uint64_t debug_macinfo_file_size = 0; - uint64_t debug_pubnames_file_size = 0; - uint64_t debug_pubtypes_file_size = 0; - uint64_t debug_ranges_file_size = 0; - uint64_t debug_str_file_size = 0; section = section_list->FindSectionByName(GetDWARFMachOSegmentName ()).get(); @@ -449,15 +441,11 @@ SymbolFileDWARF::CalculateAbilities () m_flags.Set (flagsGotDebugAbbrevData); section = section_list->FindSectionByType (eSectionTypeDWARFDebugAranges, true).get(); - if (section) - debug_aranges_file_size = section->GetFileSize(); - else + if (!section) m_flags.Set (flagsGotDebugArangesData); section = section_list->FindSectionByType (eSectionTypeDWARFDebugFrame, true).get(); - if (section) - debug_frame_file_size = section->GetFileSize(); - else + if (!section) m_flags.Set (flagsGotDebugFrameData); section = section_list->FindSectionByType (eSectionTypeDWARFDebugLine, true).get(); @@ -467,39 +455,27 @@ SymbolFileDWARF::CalculateAbilities () m_flags.Set (flagsGotDebugLineData); section = section_list->FindSectionByType (eSectionTypeDWARFDebugLoc, true).get(); - if (section) - debug_loc_file_size = section->GetFileSize(); - else + if (!section) m_flags.Set (flagsGotDebugLocData); section = section_list->FindSectionByType (eSectionTypeDWARFDebugMacInfo, true).get(); - if (section) - debug_macinfo_file_size = section->GetFileSize(); - else + if (!section) m_flags.Set (flagsGotDebugMacInfoData); section = section_list->FindSectionByType (eSectionTypeDWARFDebugPubNames, true).get(); - if (section) - debug_pubnames_file_size = section->GetFileSize(); - else + if (!section) m_flags.Set (flagsGotDebugPubNamesData); section = section_list->FindSectionByType (eSectionTypeDWARFDebugPubTypes, true).get(); - if (section) - debug_pubtypes_file_size = section->GetFileSize(); - else + if (!section) m_flags.Set (flagsGotDebugPubTypesData); section = section_list->FindSectionByType (eSectionTypeDWARFDebugRanges, true).get(); - if (section) - debug_ranges_file_size = section->GetFileSize(); - else + if (!section) m_flags.Set (flagsGotDebugRangesData); section = section_list->FindSectionByType (eSectionTypeDWARFDebugStr, true).get(); - if (section) - debug_str_file_size = section->GetFileSize(); - else + if (!section) m_flags.Set (flagsGotDebugStrData); } else @@ -1834,7 +1810,7 @@ SymbolFileDWARF::ParseChildMembers AccessType accessibility = default_accessibility; bool is_virtual = false; bool is_base_of_class = true; - off_t member_offset = 0; + //off_t member_offset = 0; uint32_t i; for (i=0; i<num_attributes; ++i) { @@ -1848,31 +1824,31 @@ SymbolFileDWARF::ParseChildMembers case DW_AT_decl_line: decl.SetLine(form_value.Unsigned()); break; case DW_AT_decl_column: decl.SetColumn(form_value.Unsigned()); break; case DW_AT_type: encoding_uid = form_value.Reference(dwarf_cu); break; - case DW_AT_data_member_location: - if (form_value.BlockData()) - { - Value initialValue(0); - Value memberOffset(0); - const DataExtractor& debug_info_data = get_debug_info_data(); - uint32_t block_length = form_value.Unsigned(); - uint32_t block_offset = form_value.BlockData() - debug_info_data.GetDataStart(); - if (DWARFExpression::Evaluate (NULL, - NULL, - NULL, - NULL, - NULL, - debug_info_data, - block_offset, - block_length, - eRegisterKindDWARF, - &initialValue, - memberOffset, - NULL)) - { - member_offset = memberOffset.ResolveValue(NULL, NULL).UInt(); - } - } - break; +// case DW_AT_data_member_location: +// if (form_value.BlockData()) +// { +// Value initialValue(0); +// Value memberOffset(0); +// const DataExtractor& debug_info_data = get_debug_info_data(); +// uint32_t block_length = form_value.Unsigned(); +// uint32_t block_offset = form_value.BlockData() - debug_info_data.GetDataStart(); +// if (DWARFExpression::Evaluate (NULL, +// NULL, +// NULL, +// NULL, +// NULL, +// debug_info_data, +// block_offset, +// block_length, +// eRegisterKindDWARF, +// &initialValue, +// memberOffset, +// NULL)) +// { +// member_offset = memberOffset.ResolveValue(NULL, NULL).UInt(); +// } +// } +// break; case DW_AT_accessibility: accessibility = DW_ACCESS_to_AccessType(form_value.Unsigned()); @@ -4011,58 +3987,12 @@ SymbolFileDWARF::ParseChildArrayInfo const dw_tag_t tag = die->Tag(); switch (tag) { - case DW_TAG_enumerator: - { - DWARFDebugInfoEntry::Attributes attributes; - const size_t num_child_attributes = die->GetAttributes(this, dwarf_cu, fixed_form_sizes, attributes); - if (num_child_attributes > 0) - { - const char *name = NULL; - bool got_value = false; - int64_t enum_value = 0; - - uint32_t i; - for (i=0; i<num_child_attributes; ++i) - { - const dw_attr_t attr = attributes.AttributeAtIndex(i); - DWARFFormValue form_value; - if (attributes.ExtractFormValueAtIndex(this, i, form_value)) - { - switch (attr) - { - case DW_AT_const_value: - got_value = true; - enum_value = form_value.Unsigned(); - break; - - case DW_AT_name: - name = form_value.AsCString(&get_debug_str_data()); - break; - - case DW_AT_description: - default: - case DW_AT_decl_file: - case DW_AT_decl_line: - case DW_AT_decl_column: - case DW_AT_sibling: - break; - } - } - } - } - } - break; - case DW_TAG_subrange_type: { DWARFDebugInfoEntry::Attributes attributes; const size_t num_child_attributes = die->GetAttributes(this, dwarf_cu, fixed_form_sizes, attributes); if (num_child_attributes > 0) { - const char *name = NULL; - bool got_value = false; - uint64_t byte_size = 0; - int64_t enum_value = 0; uint64_t num_elements = 0; uint64_t lower_bound = 0; uint64_t upper_bound = 0; @@ -4075,13 +4005,7 @@ SymbolFileDWARF::ParseChildArrayInfo { switch (attr) { - case DW_AT_const_value: - got_value = true; - enum_value = form_value.Unsigned(); - break; - case DW_AT_name: - name = form_value.AsCString(&get_debug_str_data()); break; case DW_AT_count: @@ -4096,10 +4020,6 @@ SymbolFileDWARF::ParseChildArrayInfo byte_stride = form_value.Unsigned(); break; - case DW_AT_byte_size: - byte_size = form_value.Unsigned(); - break; - case DW_AT_lower_bound: lower_bound = form_value.Unsigned(); break; @@ -5152,7 +5072,6 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu, ConstString type_name_const_str; Type::ResolveState resolve_state = Type::eResolveStateUnresolved; size_t byte_size = 0; - bool byte_size_valid = false; Declaration decl; Type::EncodingDataType encoding_data_type = Type::eEncodingIsUID; @@ -5206,7 +5125,7 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu, if (type_name_cstr) type_name_const_str.SetCString(type_name_cstr); break; - case DW_AT_byte_size: byte_size = form_value.Unsigned(); byte_size_valid = true; break; + case DW_AT_byte_size: byte_size = form_value.Unsigned(); break; case DW_AT_encoding: encoding = form_value.Unsigned(); break; case DW_AT_type: encoding_uid = form_value.Reference(dwarf_cu); break; default: @@ -5328,6 +5247,7 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu, { // Set a bit that lets us know that we are currently parsing this m_die_to_type[die] = DIE_IS_BEING_PARSED; + bool byte_size_valid = false; LanguageType class_language = eLanguageTypeUnknown; bool is_complete_objc_class = false; @@ -5711,9 +5631,9 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu, type_name_const_str.SetCString(type_name_cstr); break; case DW_AT_type: encoding_uid = form_value.Reference(dwarf_cu); break; - case DW_AT_byte_size: byte_size = form_value.Unsigned(); byte_size_valid = true; break; - case DW_AT_accessibility: accessibility = DW_ACCESS_to_AccessType(form_value.Unsigned()); break; - case DW_AT_declaration: is_forward_declaration = form_value.Unsigned() != 0; break; + case DW_AT_byte_size: byte_size = form_value.Unsigned(); break; + case DW_AT_accessibility: break; //accessibility = DW_ACCESS_to_AccessType(form_value.Unsigned()); break; + case DW_AT_declaration: break; //is_forward_declaration = form_value.Unsigned() != 0; break; case DW_AT_allocated: case DW_AT_associated: case DW_AT_bit_stride: @@ -5781,7 +5701,7 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu, // Set a bit that lets us know that we are currently parsing this m_die_to_type[die] = DIE_IS_BEING_PARSED; - const char *mangled = NULL; + //const char *mangled = NULL; dw_offset_t type_die_offset = DW_INVALID_OFFSET; bool is_variadic = false; bool is_inline = false; @@ -5816,10 +5736,10 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu, type_name_const_str.SetCString(type_name_cstr); break; - case DW_AT_MIPS_linkage_name: mangled = form_value.AsCString(&get_debug_str_data()); break; + case DW_AT_MIPS_linkage_name: break; // mangled = form_value.AsCString(&get_debug_str_data()); break; case DW_AT_type: type_die_offset = form_value.Reference(dwarf_cu); break; case DW_AT_accessibility: accessibility = DW_ACCESS_to_AccessType(form_value.Unsigned()); break; - case DW_AT_declaration: is_forward_declaration = form_value.Unsigned() != 0; break; + case DW_AT_declaration: break; // is_forward_declaration = form_value.Unsigned() != 0; break; case DW_AT_inline: is_inline = form_value.Unsigned() != 0; break; case DW_AT_virtuality: is_virtual = form_value.Unsigned() != 0; break; case DW_AT_explicit: is_explicit = form_value.Unsigned() != 0; break; @@ -6214,11 +6134,11 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu, break; case DW_AT_type: type_die_offset = form_value.Reference(dwarf_cu); break; - case DW_AT_byte_size: byte_size = form_value.Unsigned(); byte_size_valid = true; break; + case DW_AT_byte_size: break; // byte_size = form_value.Unsigned(); break; case DW_AT_byte_stride: byte_stride = form_value.Unsigned(); break; case DW_AT_bit_stride: bit_stride = form_value.Unsigned(); break; - case DW_AT_accessibility: accessibility = DW_ACCESS_to_AccessType(form_value.Unsigned()); break; - case DW_AT_declaration: is_forward_declaration = form_value.Unsigned() != 0; break; + case DW_AT_accessibility: break; // accessibility = DW_ACCESS_to_AccessType(form_value.Unsigned()); break; + case DW_AT_declaration: break; // is_forward_declaration = form_value.Unsigned() != 0; break; case DW_AT_allocated: case DW_AT_associated: case DW_AT_data_location: @@ -6597,7 +6517,7 @@ SymbolFileDWARF::ParseVariableDIE bool is_external = false; bool is_artificial = false; bool location_is_const_value_data = false; - AccessType accessibility = eAccessNone; + //AccessType accessibility = eAccessNone; for (i=0; i<num_attributes; ++i) { @@ -6644,7 +6564,7 @@ SymbolFileDWARF::ParseVariableDIE break; case DW_AT_artificial: is_artificial = form_value.Unsigned() != 0; break; - case DW_AT_accessibility: accessibility = DW_ACCESS_to_AccessType(form_value.Unsigned()); break; + case DW_AT_accessibility: break; //accessibility = DW_ACCESS_to_AccessType(form_value.Unsigned()); break; case DW_AT_declaration: case DW_AT_description: case DW_AT_endianity: diff --git a/lldb/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp b/lldb/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp index d2cd3a542ed..a3f6445201f 100644 --- a/lldb/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp +++ b/lldb/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp @@ -225,31 +225,37 @@ SymbolVendorMacOSX::CreateInstance (const lldb::ModuleSP &module_sp) xmlNode *value_node = key_node->next; while (value_node && value_node->type != XML_ELEMENT_NODE) value_node = value_node->next; - if (strcmp((const char *)value_node->name, "string") == 0) + if (value_node && value_node->name) { - const char *node_content = (const char *)::xmlNodeGetContent(value_node); - if (node_content) + if (strcmp((const char *)value_node->name, "string") == 0) { - strncpy(DBGBuildSourcePath, node_content, sizeof(DBGBuildSourcePath)); + const char *node_content = (const char *)::xmlNodeGetContent(value_node); + if (node_content) + { + strncpy(DBGBuildSourcePath, node_content, sizeof(DBGBuildSourcePath)); + } } + key_node = value_node; } - key_node = value_node; } else if (strcmp(key_name, "DBGSourcePath") == 0) { xmlNode *value_node = key_node->next; while (value_node && value_node->type != XML_ELEMENT_NODE) value_node = value_node->next; - if (strcmp((const char *)value_node->name, "string") == 0) + if (value_node && value_node->name) { - const char *node_content = (const char *)::xmlNodeGetContent(value_node); - if (node_content) + if (strcmp((const char *)value_node->name, "string") == 0) { - FileSpec resolved_source_path(node_content, true); - resolved_source_path.GetPath(DBGSourcePath, sizeof(DBGSourcePath)); + const char *node_content = (const char *)::xmlNodeGetContent(value_node); + if (node_content) + { + FileSpec resolved_source_path(node_content, true); + resolved_source_path.GetPath(DBGSourcePath, sizeof(DBGSourcePath)); + } } + key_node = value_node; } - key_node = value_node; } } } |