[Lldb-commits] [lldb] r165808 - in /lldb/trunk: include/lldb/Symbol/ lldb.xcodeproj/ source/API/ source/Commands/ source/Expression/ source/Interpreter/ source/Plugins/ABI/SysV-x86_64/ source/Plugins/Disassembler/llvm/ source/Plugins/DynamicLoader/Darwin-Kernel/ source/Plugins/ObjectFile/Mach-O/ source/Plugins/Process/Utility/ source/Plugins/SymbolFile/DWARF/ source/Symbol/ source/Target/ test/functionalities/abbreviation/

Jim Ingham jingham at apple.com
Fri Oct 12 10:34:26 PDT 2012


Author: jingham
Date: Fri Oct 12 12:34:26 2012
New Revision: 165808

URL: http://llvm.org/viewvc/llvm-project?rev=165808&view=rev
Log:
Bunch of cleanups for warnings found by the llvm static analyzer.

Modified:
    lldb/trunk/include/lldb/Symbol/VariableList.h
    lldb/trunk/lldb.xcodeproj/project.pbxproj
    lldb/trunk/source/API/SBTypeNameSpecifier.cpp
    lldb/trunk/source/API/SBTypeSummary.cpp
    lldb/trunk/source/Commands/CommandObjectTarget.cpp
    lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp
    lldb/trunk/source/Expression/ClangExpressionParser.cpp
    lldb/trunk/source/Expression/ClangUserExpression.cpp
    lldb/trunk/source/Expression/IRForTarget.cpp
    lldb/trunk/source/Interpreter/CommandObjectScript.cpp
    lldb/trunk/source/Interpreter/Options.cpp
    lldb/trunk/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp
    lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp
    lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
    lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
    lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp
    lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.cpp
    lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
    lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp
    lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
    lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
    lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFLocationList.cpp
    lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
    lldb/trunk/source/Symbol/ClangASTImporter.cpp
    lldb/trunk/source/Symbol/Function.cpp
    lldb/trunk/source/Symbol/VariableList.cpp
    lldb/trunk/source/Target/StackFrameList.cpp
    lldb/trunk/source/Target/Thread.cpp
    lldb/trunk/source/Target/ThreadPlanTracer.cpp
    lldb/trunk/test/functionalities/abbreviation/TestAbbreviations.py

Modified: lldb/trunk/include/lldb/Symbol/VariableList.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/VariableList.h?rev=165808&r1=165807&r2=165808&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/VariableList.h (original)
+++ lldb/trunk/include/lldb/Symbol/VariableList.h Fri Oct 12 12:34:26 2012
@@ -50,11 +50,6 @@
     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);
 

Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=165808&r1=165807&r2=165808&view=diff
==============================================================================
--- lldb/trunk/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/trunk/lldb.xcodeproj/project.pbxproj Fri Oct 12 12:34:26 2012
@@ -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)";

Modified: lldb/trunk/source/API/SBTypeNameSpecifier.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBTypeNameSpecifier.cpp?rev=165808&r1=165807&r2=165808&view=diff
==============================================================================
--- lldb/trunk/source/API/SBTypeNameSpecifier.cpp (original)
+++ lldb/trunk/source/API/SBTypeNameSpecifier.cpp Fri Oct 12 12:34:26 2012
@@ -116,6 +116,8 @@
     
     if (IsRegex() != rhs.IsRegex())
         return false;
+    if (GetName() == NULL || rhs.GetName() == NULL)
+        return false;
     
     return (strcmp(GetName(), rhs.GetName()) == 0);
 }

Modified: lldb/trunk/source/API/SBTypeSummary.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBTypeSummary.cpp?rev=165808&r1=165807&r2=165808&view=diff
==============================================================================
--- lldb/trunk/source/API/SBTypeSummary.cpp (original)
+++ lldb/trunk/source/API/SBTypeSummary.cpp Fri Oct 12 12:34:26 2012
@@ -233,7 +233,7 @@
     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();

Modified: lldb/trunk/source/Commands/CommandObjectTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectTarget.cpp?rev=165808&r1=165807&r2=165808&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectTarget.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectTarget.cpp Fri Oct 12 12:34:26 2012
@@ -1227,7 +1227,7 @@
 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 @@
                     }
                     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 @@
     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())
         {

Modified: lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp?rev=165808&r1=165807&r2=165808&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp (original)
+++ lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp Fri Oct 12 12:34:26 2012
@@ -117,12 +117,14 @@
              ++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 @@
                                          append,
                                          sc_list);
             }
-            else if (!namespace_decl)
+            else if (target && !namespace_decl)
             {
                 const bool include_symbols = true;
                 

Modified: lldb/trunk/source/Expression/ClangExpressionParser.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangExpressionParser.cpp?rev=165808&r1=165807&r2=165808&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangExpressionParser.cpp (original)
+++ lldb/trunk/source/Expression/ClangExpressionParser.cpp Fri Oct 12 12:34:26 2012
@@ -755,6 +755,7 @@
     {
         ret.SetErrorToGenericError();
         ret.SetErrorString("Couldn't find the target");
+        return ret;
     }
     
     lldb::DataBufferSP buffer_sp(new DataBufferHeap(func_range.second, 0));

Modified: lldb/trunk/source/Expression/ClangUserExpression.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangUserExpression.cpp?rev=165808&r1=165807&r2=165808&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangUserExpression.cpp (original)
+++ lldb/trunk/source/Expression/ClangUserExpression.cpp Fri Oct 12 12:34:26 2012
@@ -552,7 +552,7 @@
 
     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;

Modified: lldb/trunk/source/Expression/IRForTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/IRForTarget.cpp?rev=165808&r1=165807&r2=165808&view=diff
==============================================================================
--- lldb/trunk/source/Expression/IRForTarget.cpp (original)
+++ lldb/trunk/source/Expression/IRForTarget.cpp Fri Oct 12 12:34:26 2012
@@ -78,11 +78,14 @@
 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 @@
                 // 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 @@
         }
     }
     
+    if (!original_load)
+        return;
+    
     Value *loaded_value = original_load->getPointerOperand();
     GlobalVariable *loaded_global = dyn_cast<GlobalVariable>(loaded_value);
     

Modified: lldb/trunk/source/Interpreter/CommandObjectScript.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandObjectScript.cpp?rev=165808&r1=165807&r2=165808&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/CommandObjectScript.cpp (original)
+++ lldb/trunk/source/Interpreter/CommandObjectScript.cpp Fri Oct 12 12:34:26 2012
@@ -55,6 +55,7 @@
     {
         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

Modified: lldb/trunk/source/Interpreter/Options.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/Options.cpp?rev=165808&r1=165807&r2=165808&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/Options.cpp (original)
+++ lldb/trunk/source/Interpreter/Options.cpp Fri Oct 12 12:34:26 2012
@@ -439,7 +439,8 @@
 
         // 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 @@
         }
     }
     
-    if (cmd->WantsRawCommandString() &&
+    if (cmd &&
+        cmd->WantsRawCommandString() &&
         arguments_str.GetSize() > 0)
     {        
         strm.PutChar('\n');

Modified: lldb/trunk/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp?rev=165808&r1=165807&r2=165808&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp (original)
+++ lldb/trunk/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp Fri Oct 12 12:34:26 2012
@@ -618,9 +618,8 @@
 
                 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;

Modified: lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp?rev=165808&r1=165807&r2=165808&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp (original)
+++ lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp Fri Oct 12 12:34:26 2012
@@ -178,11 +178,15 @@
         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);
         

Modified: lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp?rev=165808&r1=165807&r2=165808&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp (original)
+++ lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp Fri Oct 12 12:34:26 2012
@@ -446,7 +446,7 @@
             }
         }
 
-        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);

Modified: lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp?rev=165808&r1=165807&r2=165808&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp (original)
+++ lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp Fri Oct 12 12:34:26 2012
@@ -3570,24 +3570,27 @@
             GetNumThreadContexts ();
 
         const FileRangeArray::Entry *thread_context_file_range = m_thread_context_offsets.GetEntryAtIndex (idx);
-        
-        DataExtractor data (m_data, 
-                            thread_context_file_range->GetRangeBase(), 
-                            thread_context_file_range->GetByteSize());
-
-        switch (m_header.cputype)
+        if (thread_context_file_range)
         {
-            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;
+        
+            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;
+            }
         }
     }
     return reg_ctx_sp;

Modified: lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp?rev=165808&r1=165807&r2=165808&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp Fri Oct 12 12:34:26 2012
@@ -779,7 +779,7 @@
     // 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))

Modified: lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.cpp?rev=165808&r1=165807&r2=165808&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.cpp Fri Oct 12 12:34:26 2012
@@ -175,7 +175,7 @@
         {
             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.

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp?rev=165808&r1=165807&r2=165808&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp Fri Oct 12 12:34:26 2012
@@ -386,7 +386,9 @@
     // 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() 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);
     }

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp?rev=165808&r1=165807&r2=165808&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp Fri Oct 12 12:34:26 2012
@@ -117,10 +117,11 @@
     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());
     }
 }
 

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp?rev=165808&r1=165807&r2=165808&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp Fri Oct 12 12:34:26 2012
@@ -701,7 +701,10 @@
     {
         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);
     }
 }
 

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp?rev=165808&r1=165807&r2=165808&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp Fri Oct 12 12:34:26 2012
@@ -1035,6 +1035,7 @@
 {
     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 @@
                 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 @@
 ) 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 @@
     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 @@
     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 @@
             {
                 bool result = true;
                 const DWARFAbbreviationDeclaration* abbrevDecl = die.GetAbbreviationDeclarationPtr(dwarf2Data, cu, offset);
+                
+                if (abbrevDecl == NULL)
+                    return false;
 
                 switch (abbrevDecl->Tag())
                 {
@@ -2142,23 +2162,26 @@
                                                     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();
         
-        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);
+        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);
+        
+            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;

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFLocationList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFLocationList.cpp?rev=165808&r1=165807&r2=165808&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFLocationList.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFLocationList.cpp Fri Oct 12 12:34:26 2012
@@ -34,11 +34,12 @@
 
         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);

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp?rev=165808&r1=165807&r2=165808&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Fri Oct 12 12:34:26 2012
@@ -921,9 +921,12 @@
     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;
 }

Modified: lldb/trunk/source/Symbol/ClangASTImporter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTImporter.cpp?rev=165808&r1=165807&r2=165808&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/ClangASTImporter.cpp (original)
+++ lldb/trunk/source/Symbol/ClangASTImporter.cpp Fri Oct 12 12:34:26 2012
@@ -316,6 +316,7 @@
 void 
 ClangASTImporter::BuildNamespaceMap(const clang::NamespaceDecl *decl)
 {
+    assert (decl);
     ASTContextMetadataSP context_md = GetContextMetadata(&decl->getASTContext());
 
     const DeclContext *parent_context = decl->getDeclContext();

Modified: lldb/trunk/source/Symbol/Function.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/Function.cpp?rev=165808&r1=165807&r2=165808&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/Function.cpp (original)
+++ lldb/trunk/source/Symbol/Function.cpp Fri Oct 12 12:34:26 2012
@@ -343,7 +343,9 @@
 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 @@
 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;
 }
 

Modified: lldb/trunk/source/Symbol/VariableList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/VariableList.cpp?rev=165808&r1=165807&r2=165808&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/VariableList.cpp (original)
+++ lldb/trunk/source/Symbol/VariableList.cpp Fri Oct 12 12:34:26 2012
@@ -178,41 +178,3 @@
         (*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;
-}
-

Modified: lldb/trunk/source/Target/StackFrameList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/StackFrameList.cpp?rev=165808&r1=165807&r2=165808&view=diff
==============================================================================
--- lldb/trunk/source/Target/StackFrameList.cpp (original)
+++ lldb/trunk/source/Target/StackFrameList.cpp Fri Oct 12 12:34:26 2012
@@ -274,8 +274,6 @@
                 if (end_idx > 0)
                     end_idx += inlined_depth;
             }
-            else
-                inlined_depth = 0;
         }
         
         StackFrameSP unwind_frame_sp;

Modified: lldb/trunk/source/Target/Thread.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Thread.cpp?rev=165808&r1=165807&r2=165808&view=diff
==============================================================================
--- lldb/trunk/source/Target/Thread.cpp (original)
+++ lldb/trunk/source/Target/Thread.cpp Fri Oct 12 12:34:26 2012
@@ -1451,6 +1451,7 @@
         if (!abi)
         {
             return_error.SetErrorString("Could not find ABI to set return value.");
+            return return_error;
         }
         SymbolContext sc = frame_sp->GetSymbolContext(eSymbolContextFunction);
         

Modified: lldb/trunk/source/Target/ThreadPlanTracer.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanTracer.cpp?rev=165808&r1=165807&r2=165808&view=diff
==============================================================================
--- lldb/trunk/source/Target/ThreadPlanTracer.cpp (original)
+++ lldb/trunk/source/Target/ThreadPlanTracer.cpp Fri Oct 12 12:34:26 2012
@@ -72,9 +72,12 @@
     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();
+    }
     
 }
 

Modified: lldb/trunk/test/functionalities/abbreviation/TestAbbreviations.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/abbreviation/TestAbbreviations.py?rev=165808&r1=165807&r2=165808&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/abbreviation/TestAbbreviations.py (original)
+++ lldb/trunk/test/functionalities/abbreviation/TestAbbreviations.py Fri Oct 12 12:34:26 2012
@@ -89,7 +89,7 @@
                     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")





More information about the lldb-commits mailing list