From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 35927 invoked by alias); 25 Apr 2019 18:53:11 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 35918 invoked by uid 89); 25 Apr 2019 18:53:11 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-29.3 required=5.0 tests=AWL,BAYES_00,ENV_AND_HDR_SPF_MATCH,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_PASS,USER_IN_DEF_SPF_WL autolearn=ham version=3.3.1 spammy=googlecom, 20190427, google.com, 2019-04-27 X-HELO: mail-wm1-f66.google.com Received: from mail-wm1-f66.google.com (HELO mail-wm1-f66.google.com) (209.85.128.66) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 25 Apr 2019 18:53:08 +0000 Received: by mail-wm1-f66.google.com with SMTP id h11so656334wmb.5 for ; Thu, 25 Apr 2019 11:53:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=1hI4O/tqlxa1SWMLHLxtKVtWUmUtef2EUR8QwwwxAMo=; b=INU9WTrfNYk3ilKOSnsSsfYPqTxGc2V7FwtwraiNtYsI5VY3BwRi7repBPEAnaZDOc CtfoyVJIx3pAb+xLKsscQbAaXWdkGNHSL24Mwb+xJ3FDXLNs++Q1lqKlZlt5Vetmgue3 ybj8duqcjXhYP/OFvOZaqiI1EI4lPI3frdhkDltDtBFF2OEieGUkfYqkTqWjt3G0dXXd P8WinRF/fVYrwlxhyybMjhIYVlJzFPRgSxpuhTpkQvCclX+WFU3l92j+h4ZZHcYI/tiY sJDF9k7qpA2R/CK8s9fQsbJfAGB8cANskWcvfmXUcx4jJ4dlC0krgOWeJdSUz4ulyq2l mLMg== MIME-Version: 1.0 References: <20190423123338.GG2737@embecosm.com> In-Reply-To: <20190423123338.GG2737@embecosm.com> From: "Ali Tamur via gdb-patches" Reply-To: Ali Tamur Date: Thu, 25 Apr 2019 18:53:00 -0000 Message-ID: Subject: Re: [PATCH] Support for DW_FORM_strx tag To: Andrew Burgess Cc: gdb-patches@sourceware.org Content-Type: text/plain; charset="UTF-8" X-IsSubscribed: yes X-SW-Source: 2019-04/txt/msg00553.txt.bz2 Hi, Sorry, somewhere from terminal to vim to mail client, tabs must have converted to spaces, I double checked the real patch, it's good. The patch description with the latest changes are below. I'm committing now, thank you. Ali gdb/ChangeLog 2019-04-25 Ali Tamur * 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. --- gdb/dwarf2read.c | 11 +++++++++-- gdb/testsuite/lib/dwarf.exp | 2 ++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index 829b07f01a..7bf50ca2d2 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: diff --git a/gdb/testsuite/lib/dwarf.exp b/gdb/testsuite/lib/dwarf.exp index 3955e0b154..3a430fcd96 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 - On Tue, Apr 23, 2019 at 5:33 AM Andrew Burgess wrote: > * Ali Tamur via gdb-patches [2019-04-22 > 19:07:49 -0700]: > > > 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. > > This looks good, with a few minor nits below... > > > > > gdb/ChangeLog > > 2019-04-27 Ali Tamur > > > > * 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 > > These should all have '.' at the end. > > > --- > > 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 > > Your mail client seems to have corrupted the patch slightly so I > couldn't check you had the correct tabs/spaces here. Please double > check before you commit. > > > || 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: > > Same white space check here please. > > > 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: > > Additionally could you look at expanding 'proc _handle_DW_FORM' in > gdb/testsuite/lib/dwarf.exp to also handle DW_FORM_strx, this should > just require adding a line like this 'DW_FORM_strx -' at the correct > place. > > Thanks, > Andrew >