Blame SOURCES/0002-PATCH-lldb-Support-DWARF-5-DW_FORM_line_strp-used-by.patch

1f4c4e
From 2e94dca0c2cedf0bdbcf8517db2f3750ba95513b Mon Sep 17 00:00:00 2001
1f4c4e
From: serge-sans-paille <sguelton@redhat.com>
1f4c4e
Date: Tue, 2 Mar 2021 14:08:02 +0100
1f4c4e
Subject: [PATCH 2/2] [PATCH][lldb] Support DWARF-5 DW_FORM_line_strp (used by
1f4c4e
 GCC)
1f4c4e
1f4c4e
---
1f4c4e
 .../SymbolFile/DWARF/DWARFDebugInfoEntry.cpp       |  1 +
1f4c4e
 .../Plugins/SymbolFile/DWARF/DWARFFormValue.cpp    | 73 +++++++++++-----------
1f4c4e
 2 files changed, 39 insertions(+), 35 deletions(-)
1f4c4e
1f4c4e
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
1f4c4e
index 4212988..bce2529 100644
1f4c4e
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
1f4c4e
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
1f4c4e
@@ -173,6 +173,7 @@ bool DWARFDebugInfoEntry::Extract(const DWARFDataExtractor &data,
1f4c4e
             break;
1f4c4e
 
1f4c4e
           case DW_FORM_strp:
1f4c4e
+          case DW_FORM_line_strp:
1f4c4e
           case DW_FORM_sec_offset:
1f4c4e
             data.GetU32(&offset);
1f4c4e
             break;
1f4c4e
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
1f4c4e
index 305f1cb..ec78c5b 100644
1f4c4e
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
1f4c4e
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
1f4c4e
@@ -150,40 +150,40 @@ struct FormSize {
1f4c4e
   uint8_t valid:1, size:7;
1f4c4e
 };
1f4c4e
 static FormSize g_form_sizes[] = {
1f4c4e
-  {0,0}, // 0x00 unused
1f4c4e
-  {0,0}, // 0x01 DW_FORM_addr
1f4c4e
-  {0,0}, // 0x02 unused
1f4c4e
-  {0,0}, // 0x03 DW_FORM_block2
1f4c4e
-  {0,0}, // 0x04 DW_FORM_block4
1f4c4e
-  {1,2}, // 0x05 DW_FORM_data2
1f4c4e
-  {1,4}, // 0x06 DW_FORM_data4
1f4c4e
-  {1,8}, // 0x07 DW_FORM_data8
1f4c4e
-  {0,0}, // 0x08 DW_FORM_string
1f4c4e
-  {0,0}, // 0x09 DW_FORM_block
1f4c4e
-  {0,0}, // 0x0a DW_FORM_block1
1f4c4e
-  {1,1}, // 0x0b DW_FORM_data1
1f4c4e
-  {1,1}, // 0x0c DW_FORM_flag
1f4c4e
-  {0,0}, // 0x0d DW_FORM_sdata
1f4c4e
-  {1,4}, // 0x0e DW_FORM_strp
1f4c4e
-  {0,0}, // 0x0f DW_FORM_udata
1f4c4e
-  {0,0}, // 0x10 DW_FORM_ref_addr (addr size for DWARF2 and earlier, 4 bytes for
1f4c4e
-         // DWARF32, 8 bytes for DWARF32 in DWARF 3 and later
1f4c4e
-  {1,1}, // 0x11 DW_FORM_ref1
1f4c4e
-  {1,2}, // 0x12 DW_FORM_ref2
1f4c4e
-  {1,4}, // 0x13 DW_FORM_ref4
1f4c4e
-  {1,8}, // 0x14 DW_FORM_ref8
1f4c4e
-  {0,0}, // 0x15 DW_FORM_ref_udata
1f4c4e
-  {0,0}, // 0x16 DW_FORM_indirect
1f4c4e
-  {1,4}, // 0x17 DW_FORM_sec_offset
1f4c4e
-  {0,0}, // 0x18 DW_FORM_exprloc
1f4c4e
-  {1,0}, // 0x19 DW_FORM_flag_present
1f4c4e
-  {0,0}, // 0x1a
1f4c4e
-  {0,0}, // 0x1b
1f4c4e
-  {0,0}, // 0x1c
1f4c4e
-  {0,0}, // 0x1d
1f4c4e
-  {0,0}, // 0x1e
1f4c4e
-  {0,0}, // 0x1f
1f4c4e
-  {1,8}, // 0x20 DW_FORM_ref_sig8
1f4c4e
+    {0, 0}, // 0x00 unused
1f4c4e
+    {0, 0}, // 0x01 DW_FORM_addr
1f4c4e
+    {0, 0}, // 0x02 unused
1f4c4e
+    {0, 0}, // 0x03 DW_FORM_block2
1f4c4e
+    {0, 0}, // 0x04 DW_FORM_block4
1f4c4e
+    {1, 2}, // 0x05 DW_FORM_data2
1f4c4e
+    {1, 4}, // 0x06 DW_FORM_data4
1f4c4e
+    {1, 8}, // 0x07 DW_FORM_data8
1f4c4e
+    {0, 0}, // 0x08 DW_FORM_string
1f4c4e
+    {0, 0}, // 0x09 DW_FORM_block
1f4c4e
+    {0, 0}, // 0x0a DW_FORM_block1
1f4c4e
+    {1, 1}, // 0x0b DW_FORM_data1
1f4c4e
+    {1, 1}, // 0x0c DW_FORM_flag
1f4c4e
+    {0, 0}, // 0x0d DW_FORM_sdata
1f4c4e
+    {1, 4}, // 0x0e DW_FORM_strp
1f4c4e
+    {0, 0}, // 0x0f DW_FORM_udata
1f4c4e
+    {0, 0}, // 0x10 DW_FORM_ref_addr (addr size for DWARF2 and earlier, 4 bytes
1f4c4e
+            // for DWARF32, 8 bytes for DWARF32 in DWARF 3 and later
1f4c4e
+    {1, 1},  // 0x11 DW_FORM_ref1
1f4c4e
+    {1, 2},  // 0x12 DW_FORM_ref2
1f4c4e
+    {1, 4},  // 0x13 DW_FORM_ref4
1f4c4e
+    {1, 8},  // 0x14 DW_FORM_ref8
1f4c4e
+    {0, 0},  // 0x15 DW_FORM_ref_udata
1f4c4e
+    {0, 0},  // 0x16 DW_FORM_indirect
1f4c4e
+    {1, 4},  // 0x17 DW_FORM_sec_offset
1f4c4e
+    {0, 0},  // 0x18 DW_FORM_exprloc
1f4c4e
+    {1, 0},  // 0x19 DW_FORM_flag_present
1f4c4e
+    {0, 0},  // 0x1a DW_FORM_strx (ULEB128)
1f4c4e
+    {0, 0},  // 0x1b DW_FORM_addrx (ULEB128)
1f4c4e
+    {1, 4},  // 0x1c DW_FORM_ref_sup4
1f4c4e
+    {0, 0},  // 0x1d DW_FORM_strp_sup (4 bytes for DWARF32, 8 bytes for DWARF64)
1f4c4e
+    {1, 16}, // 0x1e DW_FORM_data16
1f4c4e
+    {1, 4},  // 0x1f DW_FORM_line_strp
1f4c4e
+    {1, 8},  // 0x20 DW_FORM_ref_sig8
1f4c4e
 };
1f4c4e
 
1f4c4e
 llvm::Optional<uint8_t>
1f4c4e
@@ -286,6 +286,7 @@ bool DWARFFormValue::SkipValue(dw_form_t form,
1f4c4e
     // 32 bit for DWARF 32, 64 for DWARF 64
1f4c4e
     case DW_FORM_sec_offset:
1f4c4e
     case DW_FORM_strp:
1f4c4e
+    case DW_FORM_line_strp:
1f4c4e
       *offset_ptr += 4;
1f4c4e
       return true;
1f4c4e
 
1f4c4e
@@ -398,7 +399,8 @@ void DWARFFormValue::Dump(Stream &s) const {
1f4c4e
   case DW_FORM_udata:
1f4c4e
     s.PutULEB128(uvalue);
1f4c4e
     break;
1f4c4e
-  case DW_FORM_strp: {
1f4c4e
+  case DW_FORM_strp:
1f4c4e
+  case DW_FORM_line_strp: {
1f4c4e
     const char *dbg_str = AsCString();
1f4c4e
     if (dbg_str) {
1f4c4e
       s.QuotedCString(dbg_str);
1f4c4e
@@ -606,6 +608,7 @@ bool DWARFFormValue::FormIsSupported(dw_form_t form) {
1f4c4e
     case DW_FORM_flag:
1f4c4e
     case DW_FORM_sdata:
1f4c4e
     case DW_FORM_strp:
1f4c4e
+    case DW_FORM_line_strp:
1f4c4e
     case DW_FORM_strx:
1f4c4e
     case DW_FORM_strx1:
1f4c4e
     case DW_FORM_strx2:
1f4c4e
-- 
1f4c4e
1.8.3.1
1f4c4e