[Lldb-commits] [lldb] r190968 - Made SymbolFileDWARF not crash if a function doesn't

Sean Callanan scallanan at apple.com
Wed Sep 18 15:59:55 PDT 2013


Author: spyffe
Date: Wed Sep 18 17:59:55 2013
New Revision: 190968

URL: http://llvm.org/viewvc/llvm-project?rev=190968&view=rev
Log:
Made SymbolFileDWARF not crash if a function doesn't
have a type.  It does warn, though.

Modified:
    lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp

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=190968&r1=190967&r2=190968&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Wed Sep 18 17:59:55 2013
@@ -3696,22 +3696,30 @@ SymbolFileDWARF::FindFunctions (const Co
                                     {
                                         Type *type = sc.function->GetType();
                                         
-                                        clang::DeclContext* decl_ctx = GetClangDeclContextContainingTypeUID (type->GetID());
-                                        if (decl_ctx->isRecord())
+                                        if (type)
                                         {
-                                            if (name_type_mask & eFunctionNameTypeBase)
+                                            clang::DeclContext* decl_ctx = GetClangDeclContextContainingTypeUID (type->GetID());
+                                            if (decl_ctx->isRecord())
                                             {
-                                                sc_list.RemoveContextAtIndex(sc_list.GetSize()-1);
-                                                keep_die = false;
+                                                if (name_type_mask & eFunctionNameTypeBase)
+                                                {
+                                                    sc_list.RemoveContextAtIndex(sc_list.GetSize()-1);
+                                                    keep_die = false;
+                                                }
+                                            }
+                                            else
+                                            {
+                                                if (name_type_mask & eFunctionNameTypeMethod)
+                                                {
+                                                    sc_list.RemoveContextAtIndex(sc_list.GetSize()-1);
+                                                    keep_die = false;
+                                                }
                                             }
                                         }
                                         else
                                         {
-                                            if (name_type_mask & eFunctionNameTypeMethod)
-                                            {
-                                                sc_list.RemoveContextAtIndex(sc_list.GetSize()-1);
-                                                keep_die = false;
-                                            }
+                                            GetObjectFile()->GetModule()->ReportWarning ("function at die offset 0x%8.8x had no function type",
+                                                                                         die_offset);
                                         }
                                     }
                                 }





More information about the lldb-commits mailing list