diff options
Diffstat (limited to 'lldb')
30 files changed, 160 insertions, 135 deletions
diff --git a/lldb/include/lldb/Symbol/VariableList.h b/lldb/include/lldb/Symbol/VariableList.h index 27d6b2872cc..21f37e4fc9f 100644 --- a/lldb/include/lldb/Symbol/VariableList.h +++ b/lldb/include/lldb/Symbol/VariableList.h @@ -50,11 +50,6 @@ public: lldb::VariableSP FindVariable (const ConstString& name); - // Find the argument variable that represents the language specific - // object pointer ("this" in C++, or "self" in Objective C). - lldb::VariableSP - FindArtificialObjectVariable (lldb::LanguageType language) const; - uint32_t FindVariableIndex (const lldb::VariableSP &var_sp); diff --git a/lldb/lldb.xcodeproj/project.pbxproj b/lldb/lldb.xcodeproj/project.pbxproj index e5f870be2f0..4f52df695ef 100644 --- a/lldb/lldb.xcodeproj/project.pbxproj +++ b/lldb/lldb.xcodeproj/project.pbxproj @@ -4544,7 +4544,6 @@ ); GCC_SYMBOLS_PRIVATE_EXTERN = NO; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - MACOSX_DEPLOYMENT_TARGET = 10.7; OTHER_CFLAGS = ""; OTHER_LDFLAGS = ""; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -4562,7 +4561,6 @@ CURRENT_PROJECT_VERSION = 168; GCC_ENABLE_OBJC_EXCEPTIONS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - MACOSX_DEPLOYMENT_TARGET = 10.7; OTHER_CFLAGS = ""; OTHER_LDFLAGS = ""; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -4580,7 +4578,6 @@ CURRENT_PROJECT_VERSION = 168; GCC_ENABLE_OBJC_EXCEPTIONS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - MACOSX_DEPLOYMENT_TARGET = 10.7; OTHER_CFLAGS = ""; OTHER_LDFLAGS = ""; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -4604,7 +4601,6 @@ HEADER_SEARCH_PATHS = /usr/include/libxml2; LD_DYLIB_INSTALL_NAME = "$(DEVELOPER_DIR)/Library/PrivateFrameworks/LLDB.framework/Resources/lldb-core.a"; MACH_O_TYPE = staticlib; - MACOSX_DEPLOYMENT_TARGET = 10.7; OTHER_CPLUSPLUSFLAGS = ( "-fno-rtti", "-Wglobal-constructors", @@ -4635,7 +4631,6 @@ HEADER_SEARCH_PATHS = /usr/include/libxml2; LD_DYLIB_INSTALL_NAME = "$(DEVELOPER_DIR)/Library/PrivateFrameworks/LLDB.framework/Resources/lldb-core.a"; MACH_O_TYPE = staticlib; - MACOSX_DEPLOYMENT_TARGET = 10.7; OTHER_CPLUSPLUSFLAGS = ( "-fno-rtti", "-Wglobal-constructors", @@ -4666,7 +4661,6 @@ HEADER_SEARCH_PATHS = /usr/include/libxml2; LD_DYLIB_INSTALL_NAME = "$(DEVELOPER_DIR)/Library/PrivateFrameworks/LLDB.framework/Resources/lldb-core.a"; MACH_O_TYPE = staticlib; - MACOSX_DEPLOYMENT_TARGET = 10.7; OTHER_CPLUSPLUSFLAGS = ( "-fno-rtti", "-Wglobal-constructors", @@ -5363,7 +5357,6 @@ HEADER_SEARCH_PATHS = /usr/include/libxml2; LD_DYLIB_INSTALL_NAME = "$(DEVELOPER_DIR)/Library/PrivateFrameworks/LLDB.framework/Resources/lldb-core.a"; MACH_O_TYPE = staticlib; - MACOSX_DEPLOYMENT_TARGET = 10.7; OTHER_CPLUSPLUSFLAGS = ( "-fno-rtti", "-Wglobal-constructors", @@ -5532,7 +5525,6 @@ ); GCC_SYMBOLS_PRIVATE_EXTERN = NO; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - MACOSX_DEPLOYMENT_TARGET = 10.7; OTHER_CFLAGS = ""; OTHER_LDFLAGS = ""; PRODUCT_NAME = "$(TARGET_NAME)"; diff --git a/lldb/source/API/SBTypeNameSpecifier.cpp b/lldb/source/API/SBTypeNameSpecifier.cpp index 49a8b4155e6..bc3c63e7ff4 100644 --- a/lldb/source/API/SBTypeNameSpecifier.cpp +++ b/lldb/source/API/SBTypeNameSpecifier.cpp @@ -116,6 +116,8 @@ SBTypeNameSpecifier::IsEqualTo (lldb::SBTypeNameSpecifier &rhs) if (IsRegex() != rhs.IsRegex()) return false; + if (GetName() == NULL || rhs.GetName() == NULL) + return false; return (strcmp(GetName(), rhs.GetName()) == 0); } diff --git a/lldb/source/API/SBTypeSummary.cpp b/lldb/source/API/SBTypeSummary.cpp index 4108da05962..fd6e9292c18 100644 --- a/lldb/source/API/SBTypeSummary.cpp +++ b/lldb/source/API/SBTypeSummary.cpp @@ -233,7 +233,7 @@ SBTypeSummary::IsEqualTo (lldb::SBTypeSummary &rhs) if (IsFunctionName() != rhs.IsFunctionName()) return false; - if ( strcmp(GetData(), rhs.GetData()) ) + if ( GetData() == NULL || rhs.GetData() == NULL || strcmp(GetData(), rhs.GetData()) ) return false; return GetOptions() == rhs.GetOptions(); diff --git a/lldb/source/Commands/CommandObjectTarget.cpp b/lldb/source/Commands/CommandObjectTarget.cpp index 82f7cf3f4f9..6f77106a6f7 100644 --- a/lldb/source/Commands/CommandObjectTarget.cpp +++ b/lldb/source/Commands/CommandObjectTarget.cpp @@ -1227,7 +1227,7 @@ DumpModuleArchitecture (Stream &strm, Module *module, bool full_triple, uint32_t static void DumpModuleUUID (Stream &strm, Module *module) { - if (module->GetUUID().IsValid()) + if (module && module->GetUUID().IsValid()) module->GetUUID().Dump (&strm); else strm.PutCString(" "); @@ -2720,8 +2720,14 @@ protected: } else { - module->GetFileSpec().GetPath (path, sizeof(path)); - result.AppendErrorWithFormat ("invalid module '%s'.\n", path); + FileSpec *module_spec_file = module_spec.GetFileSpecPtr(); + if (module_spec_file) + { + module_spec_file->GetPath (path, sizeof(path)); + result.AppendErrorWithFormat ("invalid module '%s'.\n", path); + } + else + result.AppendError ("no module spec"); result.SetStatus (eReturnStatusFailed); } } @@ -3033,6 +3039,12 @@ protected: PrintModule (Target *target, Module *module, uint32_t idx, int indent, Stream &strm) { + if (module == NULL) + { + strm.PutCString("Null module"); + return; + } + bool dump_object_name = false; if (m_options.m_format_array.empty()) { diff --git a/lldb/source/Expression/ClangExpressionDeclMap.cpp b/lldb/source/Expression/ClangExpressionDeclMap.cpp index 5166300083d..5a575bd8303 100644 --- a/lldb/source/Expression/ClangExpressionDeclMap.cpp +++ b/lldb/source/Expression/ClangExpressionDeclMap.cpp @@ -117,12 +117,14 @@ ClangExpressionDeclMap::DidParse() ++entity_index) { ClangExpressionVariableSP var_sp(m_found_entities.GetVariableAtIndex(entity_index)); - if (var_sp && - var_sp->m_parser_vars.get() && - var_sp->m_parser_vars->m_lldb_value) + if (var_sp) + { + if (var_sp->m_parser_vars.get() && + var_sp->m_parser_vars->m_lldb_value) delete var_sp->m_parser_vars->m_lldb_value; - var_sp->DisableParserVars(); + var_sp->DisableParserVars(); + } } for (size_t pvar_index = 0, num_pvars = m_parser_vars->m_persistent_vars->GetSize(); @@ -2706,7 +2708,7 @@ ClangExpressionDeclMap::FindExternalVisibleDecls (NameSearchContext &context, append, sc_list); } - else if (!namespace_decl) + else if (target && !namespace_decl) { const bool include_symbols = true; diff --git a/lldb/source/Expression/ClangExpressionParser.cpp b/lldb/source/Expression/ClangExpressionParser.cpp index 1bf791bfc08..3d82b125d35 100644 --- a/lldb/source/Expression/ClangExpressionParser.cpp +++ b/lldb/source/Expression/ClangExpressionParser.cpp @@ -755,6 +755,7 @@ ClangExpressionParser::DisassembleFunction (Stream &stream, ExecutionContext &ex { ret.SetErrorToGenericError(); ret.SetErrorString("Couldn't find the target"); + return ret; } lldb::DataBufferSP buffer_sp(new DataBufferHeap(func_range.second, 0)); diff --git a/lldb/source/Expression/ClangUserExpression.cpp b/lldb/source/Expression/ClangUserExpression.cpp index 877c8d7cabc..c037d0238f9 100644 --- a/lldb/source/Expression/ClangUserExpression.cpp +++ b/lldb/source/Expression/ClangUserExpression.cpp @@ -552,7 +552,7 @@ ClangUserExpression::Execute (Stream &error_stream, if (m_jit_start_addr != LLDB_INVALID_ADDRESS) { - lldb::addr_t struct_address; + lldb::addr_t struct_address = LLDB_INVALID_ADDRESS; lldb::addr_t object_ptr = 0; lldb::addr_t cmd_ptr = 0; diff --git a/lldb/source/Expression/IRForTarget.cpp b/lldb/source/Expression/IRForTarget.cpp index 02b901d469c..e0342c995ce 100644 --- a/lldb/source/Expression/IRForTarget.cpp +++ b/lldb/source/Expression/IRForTarget.cpp @@ -78,11 +78,14 @@ static std::string PrintValue(const Value *value, bool truncate = false) { std::string s; - raw_string_ostream rso(s); - value->print(rso); - rso.flush(); - if (truncate) - s.resize(s.length() - 1); + if (value) + { + raw_string_ostream rso(s); + value->print(rso); + rso.flush(); + if (truncate) + s.resize(s.length() - 1); + } return s; } @@ -238,7 +241,7 @@ IRForTarget::GetFunctionAddress (llvm::Function *fun, // Check for an alternate mangling for "std::basic_string<char>" // that is part of the itanium C++ name mangling scheme const char *name_cstr = name.GetCString(); - if (strncmp(name_cstr, "_ZNKSbIcE", strlen("_ZNKSbIcE")) == 0) + if (name_cstr && strncmp(name_cstr, "_ZNKSbIcE", strlen("_ZNKSbIcE")) == 0) { std::string alternate_mangling("_ZNKSs"); alternate_mangling.append (name_cstr + strlen("_ZNKSbIcE")); @@ -492,6 +495,9 @@ IRForTarget::MaybeSetCastResult (lldb_private::TypeFromParser type) } } + if (!original_load) + return; + Value *loaded_value = original_load->getPointerOperand(); GlobalVariable *loaded_global = dyn_cast<GlobalVariable>(loaded_value); diff --git a/lldb/source/Interpreter/CommandObjectScript.cpp b/lldb/source/Interpreter/CommandObjectScript.cpp index 76bfe6e9928..ce097b79670 100644 --- a/lldb/source/Interpreter/CommandObjectScript.cpp +++ b/lldb/source/Interpreter/CommandObjectScript.cpp @@ -55,6 +55,7 @@ CommandObjectScript::DoExecute { result.AppendError("no script interpreter"); result.SetStatus (eReturnStatusFailed); + return false; } DataVisualization::ForceUpdate(); // script might change Python code we use for formatting.. make sure we keep up to date with it diff --git a/lldb/source/Interpreter/Options.cpp b/lldb/source/Interpreter/Options.cpp index daf631f3b05..484e7789e5a 100644 --- a/lldb/source/Interpreter/Options.cpp +++ b/lldb/source/Interpreter/Options.cpp @@ -439,7 +439,8 @@ Options::GenerateOptionUsage // Different option sets may require different args. StreamString args_str; - cmd->GetFormattedCommandArguments(args_str, opt_set_mask); + if (cmd) + cmd->GetFormattedCommandArguments(args_str, opt_set_mask); // First go through and print all options that take no arguments as // a single string. If a command has "-a" "-b" and "-c", this will show @@ -569,7 +570,8 @@ Options::GenerateOptionUsage } } - if (cmd->WantsRawCommandString() && + if (cmd && + cmd->WantsRawCommandString() && arguments_str.GetSize() > 0) { strm.PutChar('\n'); diff --git a/lldb/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp b/lldb/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp index e3b4ae6d1fa..9b4c056d396 100644 --- a/lldb/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp +++ b/lldb/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp @@ -618,9 +618,8 @@ ABISysV_x86_64::SetReturnValueObject(lldb::StackFrameSP &frame_sp, lldb::ValueOb unsigned char buffer[16]; ByteOrder byte_order = data.GetByteOrder(); - uint32_t return_bytes; - return_bytes = data.CopyByteOrderedData (0, num_bytes, buffer, 16, byte_order); + data.CopyByteOrderedData (0, num_bytes, buffer, 16, byte_order); xmm0_value.SetBytes(buffer, 16, byte_order); reg_ctx->WriteRegister(xmm0_info, xmm0_value); set_it_simple = true; diff --git a/lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp b/lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp index fd091fe8c57..378d9c5638a 100644 --- a/lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp +++ b/lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp @@ -178,11 +178,15 @@ InstructionLLVM::CalculateMnemonicOperandsAndComment (const ExecutionContext* ex uint32_t addr_nibble_size = 8; addr_t base_addr = LLDB_INVALID_ADDRESS; Target *target = exe_ctx ? exe_ctx->GetTargetPtr() : NULL; - if (target && !target->GetSectionLoadList().IsEmpty()) - base_addr = GetAddress().GetLoadAddress (target); + if (target) + { + addr_nibble_size = target->GetArchitecture().GetAddressByteSize() * 2; + if (!target->GetSectionLoadList().IsEmpty()) + base_addr = GetAddress().GetLoadAddress (target); + } + if (base_addr == LLDB_INVALID_ADDRESS) base_addr = GetAddress().GetFileAddress (); - addr_nibble_size = target->GetArchitecture().GetAddressByteSize() * 2; lldb::addr_t PC = base_addr + EDInstByteSize(m_inst); diff --git a/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp b/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp index a7ec411cfbd..247eb1695e7 100644 --- a/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp +++ b/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp @@ -446,7 +446,7 @@ DynamicLoaderDarwinKernel::LoadKernelModuleIfNeeded() } } - if (m_kernel.IsLoaded()) + if (m_kernel.IsLoaded() && m_kernel.module_sp) { static ConstString kext_summary_symbol ("gLoadedKextSummaries"); const Symbol *symbol = m_kernel.module_sp->FindFirstSymbolWithNameAndType (kext_summary_symbol, eSymbolTypeData); diff --git a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp index f44f1856ace..9d288a4d5bf 100644 --- a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp +++ b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp @@ -3570,24 +3570,27 @@ ObjectFileMachO::GetThreadContextAtIndex (uint32_t idx, lldb_private::Thread &th GetNumThreadContexts (); const FileRangeArray::Entry *thread_context_file_range = m_thread_context_offsets.GetEntryAtIndex (idx); + if (thread_context_file_range) + { - DataExtractor data (m_data, - thread_context_file_range->GetRangeBase(), - thread_context_file_range->GetByteSize()); + DataExtractor data (m_data, + thread_context_file_range->GetRangeBase(), + thread_context_file_range->GetByteSize()); - switch (m_header.cputype) - { - case llvm::MachO::CPUTypeARM: - reg_ctx_sp.reset (new RegisterContextDarwin_arm_Mach (thread, data)); - break; - - case llvm::MachO::CPUTypeI386: - reg_ctx_sp.reset (new RegisterContextDarwin_i386_Mach (thread, data)); - break; - - case llvm::MachO::CPUTypeX86_64: - reg_ctx_sp.reset (new RegisterContextDarwin_x86_64_Mach (thread, data)); - break; + switch (m_header.cputype) + { + case llvm::MachO::CPUTypeARM: + reg_ctx_sp.reset (new RegisterContextDarwin_arm_Mach (thread, data)); + break; + + case llvm::MachO::CPUTypeI386: + reg_ctx_sp.reset (new RegisterContextDarwin_i386_Mach (thread, data)); + break; + + case llvm::MachO::CPUTypeX86_64: + reg_ctx_sp.reset (new RegisterContextDarwin_x86_64_Mach (thread, data)); + break; + } } } return reg_ctx_sp; diff --git a/lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp b/lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp index d811fee9366..96b812901a4 100644 --- a/lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp +++ b/lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp @@ -779,7 +779,7 @@ RegisterContextLLDB::GetFullUnwindPlanForFrame () // right thing. It'd be nice if there was a way to ask the eh_frame directly if it is asynchronous // (can be trusted at every instruction point) or synchronous (the normal case - only at call sites). // But there is not. - if (process->GetDynamicLoader() && process->GetDynamicLoader()->AlwaysRelyOnEHUnwindInfo (m_sym_ctx)) + if (process && process->GetDynamicLoader() && process->GetDynamicLoader()->AlwaysRelyOnEHUnwindInfo (m_sym_ctx)) { unwind_plan_sp = func_unwinders_sp->GetUnwindPlanAtCallSite (m_current_offset_backed_up_one); if (unwind_plan_sp && unwind_plan_sp->PlanValidAtAddress (m_current_pc)) diff --git a/lldb/source/Plugins/Process/Utility/UnwindLLDB.cpp b/lldb/source/Plugins/Process/Utility/UnwindLLDB.cpp index b993c95325c..5581496ab6b 100644 --- a/lldb/source/Plugins/Process/Utility/UnwindLLDB.cpp +++ b/lldb/source/Plugins/Process/Utility/UnwindLLDB.cpp @@ -175,7 +175,7 @@ UnwindLLDB::AddOneMoreFrame (ABI *abi) { if (m_frames.back()->cfa == cursor_sp->cfa) goto unwind_done; // Infinite loop where the current cursor is the same as the previous one... - else if (abi->StackUsesFrames()) + else if (abi && abi->StackUsesFrames()) { // We might have a CFA that is not using the frame pointer and // we want to validate that the frame pointer is valid. diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp index 60f349c4005..1d0814c7940 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp @@ -386,7 +386,9 @@ DWARFCompileUnit::BuildAddressRangeTable (SymbolFileDWARF* dwarf2Data, // down. const bool clear_dies = ExtractDIEsIfNeeded (false) > 1; - DIE()->BuildAddressRangeTable(dwarf2Data, this, debug_aranges); + const DWARFDebugInfoEntry* die = DIE(); + if (die) + die->BuildAddressRangeTable(dwarf2Data, this, debug_aranges); // Keep memory down by clearing DIEs if this generate function // caused them to be parsed @@ -410,7 +412,9 @@ DWARFCompileUnit::GetFunctionAranges () "DWARFCompileUnit::GetFunctionAranges() for compile unit at .debug_info[0x%8.8x]", GetOffset()); } - DIE()->BuildFunctionAddressRangeTable (m_dwarf2Data, this, m_func_aranges_ap.get()); + const DWARFDebugInfoEntry* die = DIE(); + if (die) + die->BuildFunctionAddressRangeTable (m_dwarf2Data, this, m_func_aranges_ap.get()); const bool minimize = false; m_func_aranges_ap->Sort(minimize); } diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp index 41a3d865c82..ec212fdc137 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp @@ -117,10 +117,11 @@ DWARFDebugAranges::Dump (Log *log) const for (size_t i=0; i<num_entries; ++i) { const RangeToDIE::Entry *entry = m_aranges.GetEntryAtIndex(i); - log->Printf ("0x%8.8x: [0x%llx - 0x%llx)", - entry->data, - entry->GetRangeBase(), - entry->GetRangeEnd()); + if (entry) + log->Printf ("0x%8.8x: [0x%llx - 0x%llx)", + entry->data, + entry->GetRangeBase(), + entry->GetRangeEnd()); } } diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp index 68b95162afe..5395a6adae7 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp @@ -701,7 +701,10 @@ DWARFDebugInfo::Dump (Stream *s, const uint32_t die_offset, const uint32_t recur { const DWARFCompileUnitSP& cu_sp = *pos; DumpCallback(m_dwarf2Data, (DWARFCompileUnitSP&)cu_sp, NULL, 0, curr_depth, &dumpInfo); - cu_sp->DIE()->Dump(m_dwarf2Data, cu_sp.get(), *s, recurse_depth); + + const DWARFDebugInfoEntry* die = cu_sp->DIE(); + if (die) + die->Dump(m_dwarf2Data, cu_sp.get(), *s, recurse_depth); } } diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp index 9343f8c6717..529ba9b2c04 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp @@ -1035,6 +1035,7 @@ DWARFDebugInfoEntry::DumpAttribute { bool verbose = s.GetVerbose(); bool show_form = s.GetFlags().Test(DWARFDebugInfo::eDumpFlag_ShowForm); + const DataExtractor* debug_str_data = dwarf2Data ? &dwarf2Data->get_debug_str_data() : NULL; if (verbose) s.Offset (*offset_ptr); @@ -1158,7 +1159,8 @@ DWARFDebugInfoEntry::DumpAttribute form_value.Dump(s, debug_str_data, cu); uint32_t ranges_offset = form_value.Unsigned(); dw_addr_t base_addr = cu ? cu->GetBaseAddress() : 0; - DWARFDebugRanges::Dump(s, dwarf2Data->get_debug_ranges_data(), &ranges_offset, base_addr); + if (dwarf2Data) + DWARFDebugRanges::Dump(s, dwarf2Data->get_debug_ranges_data(), &ranges_offset, base_addr); } break; @@ -1509,6 +1511,9 @@ DWARFDebugInfoEntry::GetPubname ) const { const char* name = NULL; + if (!dwarf2Data) + return name; + DWARFFormValue form_value; if (GetAttributeValue(dwarf2Data, cu, DW_AT_MIPS_linkage_name, form_value)) @@ -1546,6 +1551,12 @@ DWARFDebugInfoEntry::GetName Stream &s ) { + if (dwarf2Data == NULL) + { + s.PutCString("NULL"); + return false; + } + DWARFDebugInfoEntry die; uint32_t offset = die_offset; if (die.Extract(dwarf2Data, cu, &offset)) @@ -1589,6 +1600,12 @@ DWARFDebugInfoEntry::AppendTypeName Stream &s ) { + if (dwarf2Data == NULL) + { + s.PutCString("NULL"); + return false; + } + DWARFDebugInfoEntry die; uint32_t offset = die_offset; if (die.Extract(dwarf2Data, cu, &offset)) @@ -1609,6 +1626,9 @@ DWARFDebugInfoEntry::AppendTypeName { bool result = true; const DWARFAbbreviationDeclaration* abbrevDecl = die.GetAbbreviationDeclarationPtr(dwarf2Data, cu, offset); + + if (abbrevDecl == NULL) + return false; switch (abbrevDecl->Tag()) { @@ -2142,23 +2162,26 @@ DWARFDebugInfoEntry::GetAbbreviationDeclarationPtr (SymbolFileDWARF* dwarf2Data, const DWARFCompileUnit *cu, dw_offset_t &offset) const { - offset = GetOffset(); - - const DWARFAbbreviationDeclaration* abbrev_decl = cu->GetAbbreviations()->GetAbbreviationDeclaration (m_abbr_idx); - if (abbrev_decl) + if (dwarf2Data) { - // Make sure the abbreviation code still matches. If it doesn't and - // the DWARF data was mmap'ed, the backing file might have been modified - // which is bad news. - const uint64_t abbrev_code = dwarf2Data->get_debug_info_data().GetULEB128 (&offset); - - if (abbrev_decl->Code() == abbrev_code) - return abbrev_decl; + offset = GetOffset(); + + const DWARFAbbreviationDeclaration* abbrev_decl = cu->GetAbbreviations()->GetAbbreviationDeclaration (m_abbr_idx); + if (abbrev_decl) + { + // Make sure the abbreviation code still matches. If it doesn't and + // the DWARF data was mmap'ed, the backing file might have been modified + // which is bad news. + const uint64_t abbrev_code = dwarf2Data->get_debug_info_data().GetULEB128 (&offset); - dwarf2Data->GetObjectFile()->GetModule()->ReportErrorIfModifyDetected ("0x%8.8x: the DWARF debug information has been modified (abbrev code was %u, and is now %u)", - GetOffset(), - (uint32_t)abbrev_decl->Code(), - (uint32_t)abbrev_code); + if (abbrev_decl->Code() == abbrev_code) + return abbrev_decl; + + dwarf2Data->GetObjectFile()->GetModule()->ReportErrorIfModifyDetected ("0x%8.8x: the DWARF debug information has been modified (abbrev code was %u, and is now %u)", + GetOffset(), + (uint32_t)abbrev_decl->Code(), + (uint32_t)abbrev_code); + } } offset = DW_INVALID_OFFSET; return NULL; diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFLocationList.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFLocationList.cpp index ef53eb55121..ff65d08e5fc 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFLocationList.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFLocationList.cpp @@ -34,11 +34,12 @@ DWARFLocationList::Dump(Stream &s, const DWARFCompileUnit* cu, const DataExtract s.PutCString("\n "); s.Indent(); - s.AddressRange (start_addr + base_addr, - end_addr + base_addr, - cu->GetAddressByteSize(), - NULL, - ": "); + if (cu) + s.AddressRange (start_addr + base_addr, + end_addr + base_addr, + cu->GetAddressByteSize(), + NULL, + ": "); uint32_t loc_length = debug_loc_data.GetU16(&offset); DataExtractor locationData(debug_loc_data, offset, loc_length); diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp index 80c98b03f39..bb96eae2684 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -921,9 +921,12 @@ SymbolFileDWARF::ParseCompileUnitLanguage (const SymbolContext& sc) if (dwarf_cu) { const DWARFDebugInfoEntry *die = dwarf_cu->GetCompileUnitDIEOnly(); - const uint32_t language = die->GetAttributeValueAsUnsigned(this, dwarf_cu, DW_AT_language, 0); - if (language) - return (lldb::LanguageType)language; + if (die) + { + const uint32_t language = die->GetAttributeValueAsUnsigned(this, dwarf_cu, DW_AT_language, 0); + if (language) + return (lldb::LanguageType)language; + } } return eLanguageTypeUnknown; } diff --git a/lldb/source/Symbol/ClangASTImporter.cpp b/lldb/source/Symbol/ClangASTImporter.cpp index b1328aa5771..b12128467de 100644 --- a/lldb/source/Symbol/ClangASTImporter.cpp +++ b/lldb/source/Symbol/ClangASTImporter.cpp @@ -316,6 +316,7 @@ ClangASTImporter::GetNamespaceMap(const clang::NamespaceDecl *decl) void ClangASTImporter::BuildNamespaceMap(const clang::NamespaceDecl *decl) { + assert (decl); ASTContextMetadataSP context_md = GetContextMetadata(&decl->getASTContext()); const DeclContext *parent_context = decl->getDeclContext(); diff --git a/lldb/source/Symbol/Function.cpp b/lldb/source/Symbol/Function.cpp index 9ee35e3737e..0f060ddda9f 100644 --- a/lldb/source/Symbol/Function.cpp +++ b/lldb/source/Symbol/Function.cpp @@ -343,7 +343,9 @@ void Function::GetDescription(Stream *s, lldb::DescriptionLevel level, Target *target) { Type* func_type = GetType(); - *s << "id = " << (const UserID&)*this << ", name = \"" << func_type->GetName() << "\", range = "; + const char *name = func_type ? func_type->GetName().AsCString() : "<unknown>"; + + *s << "id = " << (const UserID&)*this << ", name = \"" << name << "\", range = "; Address::DumpStyle fallback_style; if (level == eDescriptionLevelVerbose) @@ -493,10 +495,14 @@ Function::GetType() const clang_type_t Function::GetReturnClangType () { - clang::QualType clang_type (clang::QualType::getFromOpaquePtr(GetType()->GetClangFullType())); - const clang::FunctionType *function_type = llvm::dyn_cast<clang::FunctionType> (clang_type); - if (function_type) - return function_type->getResultType().getAsOpaquePtr(); + Type *type = GetType(); + if (type) + { + clang::QualType clang_type (clang::QualType::getFromOpaquePtr(type->GetClangFullType())); + const clang::FunctionType *function_type = llvm::dyn_cast<clang::FunctionType> (clang_type); + if (function_type) + return function_type->getResultType().getAsOpaquePtr(); + } return NULL; } diff --git a/lldb/source/Symbol/VariableList.cpp b/lldb/source/Symbol/VariableList.cpp index 251fea82c4d..11eb46c407c 100644 --- a/lldb/source/Symbol/VariableList.cpp +++ b/lldb/source/Symbol/VariableList.cpp @@ -178,41 +178,3 @@ VariableList::Dump(Stream *s, bool show_context) const (*pos)->Dump(s, show_context); } } - -lldb::VariableSP -VariableList::FindArtificialObjectVariable (lldb::LanguageType language) const -{ - lldb::VariableSP object_variable_sp; - ConstString object_variable_name; - switch (language) - { - case eLanguageTypeC_plus_plus: - object_variable_name.SetCString("this"); - break; - - case eLanguageTypeObjC: - case eLanguageTypeObjC_plus_plus: - object_variable_name.SetCString("self"); - break; - - default: - break; - } - if (object_variable_name) - { - const_iterator pos, end = m_variables.end(); - for (pos = m_variables.begin(); pos != end; ++pos) - { - Variable *variable = pos->get(); - if (variable->IsArtificial() && - variable->GetScope() == eValueTypeVariableArgument && - variable->GetName() == object_variable_name) - { - object_variable_sp = *pos; - break; - } - } - } - return object_variable_sp; -} - diff --git a/lldb/source/Target/StackFrameList.cpp b/lldb/source/Target/StackFrameList.cpp index 801bbc3e352..575063eeadb 100644 --- a/lldb/source/Target/StackFrameList.cpp +++ b/lldb/source/Target/StackFrameList.cpp @@ -274,8 +274,6 @@ StackFrameList::GetFramesUpTo(uint32_t end_idx) if (end_idx > 0) end_idx += inlined_depth; } - else - inlined_depth = 0; } StackFrameSP unwind_frame_sp; diff --git a/lldb/source/Target/Thread.cpp b/lldb/source/Target/Thread.cpp index 5a48a0ad4a3..6e505f2119b 100644 --- a/lldb/source/Target/Thread.cpp +++ b/lldb/source/Target/Thread.cpp @@ -1451,6 +1451,7 @@ Thread::ReturnFromFrame (lldb::StackFrameSP frame_sp, lldb::ValueObjectSP return if (!abi) { return_error.SetErrorString("Could not find ABI to set return value."); + return return_error; } SymbolContext sc = frame_sp->GetSymbolContext(eSymbolContextFunction); diff --git a/lldb/source/Target/ThreadPlanTracer.cpp b/lldb/source/Target/ThreadPlanTracer.cpp index 87e5e1964fb..ab61c3c7639 100644 --- a/lldb/source/Target/ThreadPlanTracer.cpp +++ b/lldb/source/Target/ThreadPlanTracer.cpp @@ -72,9 +72,12 @@ ThreadPlanTracer::Log() bool show_fullpaths = false; Stream *stream = GetLogStream(); - m_thread.GetStackFrameAtIndex(0)->Dump (stream, show_frame_index, show_fullpaths); - stream->Printf("\n"); - stream->Flush(); + if (stream) + { + m_thread.GetStackFrameAtIndex(0)->Dump (stream, show_frame_index, show_fullpaths); + stream->Printf("\n"); + stream->Flush(); + } } diff --git a/lldb/test/functionalities/abbreviation/TestAbbreviations.py b/lldb/test/functionalities/abbreviation/TestAbbreviations.py index e79aa8edc17..b6c124acf44 100644 --- a/lldb/test/functionalities/abbreviation/TestAbbreviations.py +++ b/lldb/test/functionalities/abbreviation/TestAbbreviations.py @@ -89,7 +89,7 @@ class AbbreviationsTestCase(TestBase): patterns = [ "Current executable set to .*a.out.*" ]) # By default, the setting interpreter.expand-regex-aliases is false. - self.expect("_regexp-b product", matching=False, + self.expect("_regexp-br product", matching=False, substrs = [ "breakpoint set --name" ]) match_object = lldbutil.run_break_set_command (self, "br s -n sum") |