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
Cc: Ali Tamur <tamur@google.com>
Subject: [PATCH v2 2/4] DWARF 5 support: Handle DW_FORM_strx
Date: Tue, 10 Sep 2019 18:45:00 -0000	[thread overview]
Message-ID: <20190910184542.256253-1-tamur@google.com> (raw)
In-Reply-To: <bdcdf330-a1b3-4dc9-a697-431fafd1a063@simark.ca>

Simon Marchi reviewed the first patch in the series but he is out this week,
and I'm hoping maybe someone else can take a look. This one should not be
controversial. Thanks.
---


* Handle DW_FORM_strx forms everywhere.
* A couple of annoying whitespace corrections.

Tested with CC=/usr/bin/gcc (version 8.3.0) against master branch (also with
-gsplit-dwarf and -gdwarf-4 flags) and there was no increase in the set of
tests that fails.

This is part of an effort to support DWARF 5 in gdb.


gdb/ChangeLog:

	* dwarf2read.c (skip_one_die): Handle DW_FORM_strx forms.
	(process_full_comp_unit): Correct whitespace.
	(process_full_type_unit): Likewise.
	(dwarf2_string_attr): Handle strx forms.
	(dump_die_shallow): Correct whitespace.
	(cu_debug_loc_section): Likewise.
---
 gdb/dwarf2read.c | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index a75941867a..bcf3d679bc 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -9298,6 +9298,7 @@ skip_one_die (const struct die_reader_specs *reader, const gdb_byte *info_ptr,
 	case DW_FORM_data1:
 	case DW_FORM_ref1:
 	case DW_FORM_flag:
+	case DW_FORM_strx1:
 	  info_ptr += 1;
 	  break;
 	case DW_FORM_flag_present:
@@ -9305,10 +9306,15 @@ skip_one_die (const struct die_reader_specs *reader, const gdb_byte *info_ptr,
 	  break;
 	case DW_FORM_data2:
 	case DW_FORM_ref2:
+	case DW_FORM_strx2:
 	  info_ptr += 2;
 	  break;
+	case DW_FORM_strx3:
+	  info_ptr += 3;
+	  break;
 	case DW_FORM_data4:
 	case DW_FORM_ref4:
+	case DW_FORM_strx4:
 	  info_ptr += 4;
 	  break;
 	case DW_FORM_data8:
@@ -10339,7 +10345,7 @@ process_full_comp_unit (struct dwarf2_per_cu_data *per_cu,
   if (cu->language == language_go)
     fixup_go_packaging (cu);
 
-  /* Now that we have processed all the DIEs in the CU, all the types 
+  /* Now that we have processed all the DIEs in the CU, all the types
      should be complete, and it should now be safe to compute all of the
      physnames.  */
   compute_delayed_physnames (cu);
@@ -10388,7 +10394,7 @@ process_full_comp_unit (struct dwarf2_per_cu_data *per_cu,
 
 	 Still one can confuse GDB by using non-standard GCC compilation
 	 options - this waits on GCC PR other/32998 (-frecord-gcc-switches).
-	 */ 
+	 */
       if (cu->has_loclist && gcc_4_minor >= 5)
 	cust->locations_valid = 1;
 
@@ -10443,7 +10449,7 @@ process_full_type_unit (struct dwarf2_per_cu_data *per_cu,
   if (cu->language == language_go)
     fixup_go_packaging (cu);
 
-  /* Now that we have processed all the DIEs in the CU, all the types 
+  /* Now that we have processed all the DIEs in the CU, all the types
      should be complete, and it should now be safe to compute all of the
      physnames.  */
   compute_delayed_physnames (cu);
@@ -20130,6 +20136,10 @@ 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_strx1
+	  || attr->form == DW_FORM_strx2
+	  || attr->form == DW_FORM_strx3
+	  || attr->form == DW_FORM_strx4
 	  || attr->form == DW_FORM_GNU_str_index
 	  || attr->form == DW_FORM_GNU_strp_alt)
 	str = DW_STRING (attr);
@@ -23024,7 +23034,7 @@ dump_die_shallow (struct ui_file *f, int indent, struct die_info *die)
 	case DW_FORM_indirect:
 	  /* The reader will have reduced the indirect form to
 	     the "base form" so this form should not occur.  */
-	  fprintf_unfiltered (f, 
+	  fprintf_unfiltered (f,
 			      "unexpected attribute form: DW_FORM_indirect");
 	  break;
 	case DW_FORM_implicit_const:
@@ -25125,7 +25135,7 @@ cu_debug_loc_section (struct dwarf2_cu *cu)
   if (cu->dwo_unit)
     {
       struct dwo_sections *sections = &cu->dwo_unit->dwo_file->sections;
-      
+
       return cu->header.version >= 5 ? &sections->loclists : &sections->loc;
     }
   return (cu->header.version >= 5 ? &dwarf2_per_objfile->loclists
-- 
2.23.0.162.g0b9fbb3734-goog

  parent reply	other threads:[~2019-09-10 18:45 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-27 23:41 [PATCH 1/4] Increasing support for dwarf 5 Ali Tamur via gdb-patches
2019-08-28  5:16 ` Simon Marchi
2019-09-06 21:52   ` [PATCH v2 1/4] DWARF 5 support: Handle dwo_id Ali Tamur via gdb-patches
2019-09-07 20:30     ` Simon Marchi
2019-09-09 18:58       ` Ali Tamur via gdb-patches
2019-09-09 21:21         ` Simon Marchi
2019-09-10  1:37           ` Ali Tamur via gdb-patches
2019-09-10 18:45           ` Ali Tamur via gdb-patches [this message]
2019-09-18  3:08             ` [PATCH v2 2/4] DWARF 5 support: Handle DW_FORM_strx Simon Marchi

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=20190910184542.256253-1-tamur@google.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).