From patchwork Tue Sep 10 18:45:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Terekhov, Mikhail via Gdb-patches" X-Patchwork-Id: 34469 Received: (qmail 116468 invoked by alias); 10 Sep 2019 18:45:50 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 116457 invoked by uid 89); 10 Sep 2019 18:45:50 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-23.8 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=controversial X-HELO: mail-vs1-f74.google.com Received: from mail-vs1-f74.google.com (HELO mail-vs1-f74.google.com) (209.85.217.74) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 10 Sep 2019 18:45:48 +0000 Received: by mail-vs1-f74.google.com with SMTP id h11so3039594vsj.15 for ; Tue, 10 Sep 2019 11:45:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=yy0ZLI+eqKtsc2kiOhGPUu5k6/ANgLJvtw+jAdMrBh0=; b=JfFWDf9fkEhIyRoUrPzh0h6zpY9EerFP5CMH+fyNG4WAG1OtrVE7VBgZgqlouaN55r t9S04CjcOeLGZ6VRuEQaJw8oHwBkqX0WnpZTn7zdMVjyYrK3FrhsNy/GjdbfH8xPGbb3 G5p/CAgTwTcvGOKK6mVHXMZxZHtQXqW7tKvH6Xe5JKMMeygYLUgFnOPGpnWVPz+O5nR0 kd1XY3i1ci+B83fEqUlvvuLJBYgVp7611Mb+g1fTeEiMSNXlTD9iF42LBNDn+9aIP8Hl eEZngdxfo1VAaGHKLFFF+sfBE1MwhAbmCg3nyI7rLGXdrsfDrS9q5dFmzBTPDSO3sck7 2anw== Date: Tue, 10 Sep 2019 11:45:42 -0700 In-Reply-To: Message-Id: <20190910184542.256253-1-tamur@google.com> Mime-Version: 1.0 References: Subject: [PATCH v2 2/4] DWARF 5 support: Handle DW_FORM_strx X-Patchwork-Original-From: "Ali Tamur via gdb-patches" From: "Terekhov, Mikhail via Gdb-patches" Reply-To: Ali Tamur To: gdb-patches@sourceware.org Cc: Ali Tamur X-IsSubscribed: yes 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 ? §ions->loclists : §ions->loc; } return (cu->header.version >= 5 ? &dwarf2_per_objfile->loclists