[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gdb-cvs
Subject:    [binutils-gdb] [PATCH] Support for DW_FORM_strx tag
From:       Ali Tamur <alitamur () sourceware ! org>
Date:       2019-04-25 18:53:19
Message-ID: 20190425185319.36723.qmail () sourceware ! org
[Download RAW message or body]

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=cf532bd13616fbabe487d98107cde3202ad58ab7

commit cf532bd13616fbabe487d98107cde3202ad58ab7
Author: Ali Tamur <tamur@google.com>
Date:   Fri Mar 29 19:29:24 2019 -0700

    [PATCH] Support for DW_FORM_strx tag
    
    DW_FORM_strx is the new name of DW_FORM_GNU_str_index in the Dwarf 5 standard.
    This is a small step towards supporting Dwarf 5 in gdb.

Diff:
---
 gdb/ChangeLog               | 13 +++++++++++++
 gdb/dwarf2read.c            | 11 +++++++++--
 gdb/testsuite/lib/dwarf.exp |  2 ++
 3 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index da4e350..5167cc2 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,16 @@
+2019-04-25  Ali Tamur  <tamur@google.com>
+
+	* dwarf2read.c (skip_one_die): Add DW_FORM_strx.
+	(read_attribute_value): Likewise.
+	(dwarf2_read_addr_index): Update comment.
+	(read_str_index): Add DW_FORM_strx.
+	(dwarf2_string_attr): Likewise.
+	(dwarf2_const_value_attr): Likewise.
+	(dump_die_shallow): Likewise.
+	(dwarf2_fetch_constant_bytes): Likewise.
+	(skip_form_bytes): Likewise.
+	* testsuite/lib/dwarf.exp (_handle_DW_FORM): Add DW_FORM_strx.
+
 2019-04-25  Sergio Durigan Junior  <sergiodj@redhat.com>
 
 	PR corefiles/11608
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index e182935..4259c38 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -9361,6 +9361,7 @@ skip_one_die (const struct die_reader_specs *reader, const gdb_byte *info_ptr,
 	  info_ptr += 4 + read_4_bytes (abfd, info_ptr);
 	  break;
 	case DW_FORM_addrx:
+	case DW_FORM_strx:
 	case DW_FORM_sdata:
 	case DW_FORM_udata:
 	case DW_FORM_ref_udata:
@@ -19287,6 +19288,7 @@ read_attribute_value (const struct die_reader_specs *reader,
       DW_ADDR (attr) = read_addr_index_from_leb128 (cu, info_ptr, &bytes_read);
       info_ptr += bytes_read;
       break;
+    case DW_FORM_strx:
     case DW_FORM_GNU_str_index:
       if (reader->dwo_file == NULL)
 	{
@@ -19882,7 +19884,7 @@ dwarf2_read_addr_index (struct dwarf2_per_cu_data *per_cu,
 			    addr_size);
 }
 
-/* Given a DW_FORM_GNU_str_index, fetch the string.
+/* Given a DW_FORM_GNU_str_index or DW_FORM_strx, fetch the string.
    This is only used by the Fission support.  */
 
 static const char *
@@ -19899,7 +19901,7 @@ read_str_index (const struct die_reader_specs *reader, ULONGEST str_index)
     &reader->dwo_file->sections.str_offsets;
   const gdb_byte *info_ptr;
   ULONGEST str_offset;
-  static const char form_name[] = "DW_FORM_GNU_str_index";
+  static const char form_name[] = "DW_FORM_GNU_str_index or DW_FORM_strx";
 
   dwarf2_read_section (objfile, str_section);
   dwarf2_read_section (objfile, str_offsets_section);
@@ -20065,6 +20067,7 @@ dwarf2_string_attr (struct die_info *die, unsigned int name, struct dwarf2_cu *c
     {
       if (attr->form == DW_FORM_strp || attr->form == DW_FORM_line_strp
 	  || attr->form == DW_FORM_string
+	  || attr->form == DW_FORM_strx
 	  || attr->form == DW_FORM_GNU_str_index
 	  || attr->form == DW_FORM_GNU_strp_alt)
 	str = DW_STRING (attr);
@@ -21888,6 +21891,7 @@ dwarf2_const_value_attr (const struct attribute *attr, struct type *type,
       break;
     case DW_FORM_string:
     case DW_FORM_strp:
+    case DW_FORM_strx:
     case DW_FORM_GNU_str_index:
     case DW_FORM_GNU_strp_alt:
       /* DW_STRING is already allocated on the objfile obstack, point
@@ -22892,6 +22896,7 @@ dump_die_shallow (struct ui_file *f, int indent, struct die_info *die)
 	case DW_FORM_string:
 	case DW_FORM_strp:
 	case DW_FORM_line_strp:
+	case DW_FORM_strx:
 	case DW_FORM_GNU_str_index:
 	case DW_FORM_GNU_strp_alt:
 	  fprintf_unfiltered (f, "string: \"%s\" (%s canonicalized)",
@@ -23320,6 +23325,7 @@ dwarf2_fetch_constant_bytes (sect_offset sect_off,
       break;
     case DW_FORM_string:
     case DW_FORM_strp:
+    case DW_FORM_strx:
     case DW_FORM_GNU_str_index:
     case DW_FORM_GNU_strp_alt:
       /* DW_STRING is already allocated on the objfile obstack, point
@@ -24285,6 +24291,7 @@ skip_form_bytes (bfd *abfd, const gdb_byte *bytes, const gdb_byte *buffer_end,
 
     case DW_FORM_addrx:
     case DW_FORM_sdata:
+    case DW_FORM_strx:
     case DW_FORM_udata:
     case DW_FORM_GNU_addr_index:
     case DW_FORM_GNU_str_index:
diff --git a/gdb/testsuite/lib/dwarf.exp b/gdb/testsuite/lib/dwarf.exp
index 3955e0b..3a430fc 100644
--- a/gdb/testsuite/lib/dwarf.exp
+++ b/gdb/testsuite/lib/dwarf.exp
@@ -527,6 +527,8 @@ namespace eval Dwarf {
 	    DW_FORM_indirect -
 	    DW_FORM_exprloc -
 
+	    DW_FORM_strx -
+
 	    DW_FORM_GNU_addr_index -
 	    DW_FORM_GNU_str_index -
 	    DW_FORM_GNU_ref_alt -
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic