[llvm-branch-commits] [lldb] r270114 - Don't crash if we have a DIE that has a DW_AT_ranges attribute and yet the SymbolFileDWARF doesn't have a DebugRanges. If this happens print a nice error message to prompt the user to file a bug and attach the offending DWARF file so we can get the correct compiler fixed.

Francis Ricci via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu May 19 13:38:33 PDT 2016


Author: fjricci
Date: Thu May 19 15:38:33 2016
New Revision: 270114

URL: http://llvm.org/viewvc/llvm-project?rev=270114&view=rev
Log:
Don't crash if we have a DIE that has a DW_AT_ranges attribute and yet the SymbolFileDWARF doesn't have a DebugRanges. If this happens print a nice error message to prompt the user to file a bug and attach the offending DWARF file so we can get the correct compiler fixed.

<rdar://problem/24458016>

This is a cherry-pick of commit r260626

Author:    Greg Clayton <gclayton at apple.com>
Date:      Fri Feb 12 00:07:16 2016 +0000

Modified:
    lldb/branches/release_38/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp

Modified: lldb/branches/release_38/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/release_38/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp?rev=270114&r1=270113&r2=270114&view=diff
==============================================================================
--- lldb/branches/release_38/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp (original)
+++ lldb/branches/release_38/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp Thu May 19 15:38:33 2016
@@ -482,11 +482,19 @@ DWARFDebugInfoEntry::GetDIENamesAndRange
                 case DW_AT_ranges:
                     {
                         const DWARFDebugRanges* debug_ranges = dwarf2Data->DebugRanges();
-                        debug_ranges->FindRanges(form_value.Unsigned(), ranges);
-                        // All DW_AT_ranges are relative to the base address of the
-                        // compile unit. We add the compile unit base address to make
-                        // sure all the addresses are properly fixed up.
-                        ranges.Slide(cu->GetBaseAddress());
+                        if (debug_ranges)
+                        {
+                            debug_ranges->FindRanges(form_value.Unsigned(), ranges);
+                            // All DW_AT_ranges are relative to the base address of the
+                            // compile unit. We add the compile unit base address to make
+                            // sure all the addresses are properly fixed up.
+                            ranges.Slide(cu->GetBaseAddress());
+                        }
+                        else
+                        {
+                            cu->GetSymbolFileDWARF()->GetObjectFile()->GetModule()->ReportError ("{0x%8.8x}: DIE has DW_AT_ranges(0x%" PRIx64 ") attribute yet DWARF has no .debug_ranges, please file a bug and attach the file at the start of this error message",
+                                                                                                 m_offset, form_value.Unsigned());
+                        }
                     }
                     break;
 




More information about the llvm-branch-commits mailing list