public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: "Ali Tamur via gdb-patches" <gdb-patches@sourceware.org>
To: gdb-patches@sourceware.org
Subject: [PATCH] Support for DW_FORM_strx tag
Date: Tue, 23 Apr 2019 02:08:00 -0000	[thread overview]
Message-ID: <CAH=Am=7D_UqOSdJMtg-=o-_a_CSFAoR8h2+HgwW4QDcKefs9mg@mail.gmail.com> (raw)

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.

gdb/ChangeLog
2019-04-27  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
---
 gdb/dwarf2read.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 829b07f01a..09ecd4fbd4 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -9369,6 +9369,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:
@@ -19295,6 +19296,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)
        {
@@ -19890,7 +19892,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 *
@@ -19907,7 +19909,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);
@@ -20073,6 +20075,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);
@@ -21896,6 +21899,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
@@ -22900,6 +22904,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)",
@@ -23328,6 +23333,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
@@ -24293,6 +24299,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:

             reply	other threads:[~2019-04-23  2:08 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-23  2:08 Ali Tamur via gdb-patches [this message]
2019-04-23 12:33 ` Andrew Burgess
2019-04-25 18:53   ` Ali Tamur via gdb-patches

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAH=Am=7D_UqOSdJMtg-=o-_a_CSFAoR8h2+HgwW4QDcKefs9mg@mail.gmail.com' \
    --to=gdb-patches@sourceware.org \
    --cc=tamur@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).