From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27258 invoked by alias); 23 Jul 2013 11:03:57 -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 27248 invoked by uid 89); 23 Jul 2013 11:03:57 -0000 X-Spam-SWARE-Status: No, score=-3.9 required=5.0 tests=AWL,BAYES_50,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL,RDNS_NONE,TO_NO_BRKTS_NORDNS autolearn=no version=3.3.1 Received: from Unknown (HELO mga01.intel.com) (192.55.52.88) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Tue, 23 Jul 2013 11:03:56 +0000 Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP; 23 Jul 2013 04:03:37 -0700 X-ExtLoop1: 1 Received: from irvmail001.ir.intel.com ([163.33.26.43]) by fmsmga002.fm.intel.com with ESMTP; 23 Jul 2013 04:03:36 -0700 Received: from ulliclel004.iul.intel.com (ulliclel004.iul.intel.com [172.28.50.125]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id r6NB3abi027250 for ; Tue, 23 Jul 2013 12:03:36 +0100 Received: from ulliclel004.iul.intel.com (ulliclel004.iul.intel.com [127.0.0.1]) by ulliclel004.iul.intel.com (8.13.8/8.12.8/MailSET/client) with ESMTP id r6NB3ZAR003395 for ; Tue, 23 Jul 2013 13:03:35 +0200 Received: (from sagovic@localhost) by ulliclel004.iul.intel.com (8.13.8/8.13.1/Submit) id r6NB3ThO003394 for gdb-patches@sourceware.org; Tue, 23 Jul 2013 13:03:29 +0200 From: Sanimir Agovic To: gdb-patches@sourceware.org Subject: [PATCH 1/2] cleanup: rename is_ref_attr to attr_form_is_ref Date: Tue, 23 Jul 2013 11:03:00 -0000 Message-Id: <1374577403-3356-2-git-send-email-sanimir.agovic@intel.com> In-Reply-To: <1374577403-3356-1-git-send-email-sanimir.agovic@intel.com> References: <1374577403-3356-1-git-send-email-sanimir.agovic@intel.com> X-SW-Source: 2013-07/txt/msg00531.txt.bz2 Renamed dwarf form predicate function to match the naming schema. Grouped functions. gdb: 2013-07-24 Sanimir Agovic * dwarf2read.c (attr_is_ref): Rename to attr_form_is_ref. All uses updated. Change-Id: I3df124bebcd491dfd55f64dc7d83ce7c4ecc79f5 --- gdb/dwarf2read.c | 65 +++++++++++++++++++++++++++-------------------------- 1 files changed, 33 insertions(+), 32 deletions(-) diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index 94727a7..1ee36bb 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -1608,8 +1608,6 @@ static void dump_die_1 (struct ui_file *, int level, int max_level, static void store_in_ref_table (struct die_info *, struct dwarf2_cu *); -static int is_ref_attr (struct attribute *); - static sect_offset dwarf2_get_ref_die_offset (struct attribute *); static LONGEST dwarf2_get_attr_constant_value (struct attribute *, int); @@ -1657,6 +1655,8 @@ static int attr_form_is_section_offset (struct attribute *); static int attr_form_is_constant (struct attribute *); +static int attr_form_is_ref (struct attribute *); + static void fill_in_loclist_baton (struct dwarf2_cu *cu, struct dwarf2_loclist_baton *baton, struct attribute *attr); @@ -10364,7 +10364,7 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu) SET_FIELD_DWARF_BLOCK (call_site->target, dlbaton); } - else if (is_ref_attr (attr)) + else if (attr_form_is_ref (attr)) { struct dwarf2_cu *target_cu = cu; struct die_info *target_die; @@ -10437,7 +10437,7 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu) loc = dwarf2_attr (child_die, DW_AT_location, cu); origin = dwarf2_attr (child_die, DW_AT_abstract_origin, cu); - if (loc == NULL && origin != NULL && is_ref_attr (origin)) + if (loc == NULL && origin != NULL && attr_form_is_ref (origin)) { sect_offset offset; @@ -13379,7 +13379,7 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu) attr = dwarf2_attr (die, DW_AT_upper_bound, cu); if (attr) { - if (attr_form_is_block (attr) || is_ref_attr (attr)) + if (attr_form_is_block (attr) || attr_form_is_ref (attr)) { /* GCC encodes arrays with unspecified or dynamic length with a DW_FORM_block1 attribute or a reference attribute. @@ -14820,7 +14820,7 @@ read_attribute_value (const struct die_reader_specs *reader, } /* Super hack. */ - if (cu->per_cu->is_dwz && is_ref_attr (attr)) + if (cu->per_cu->is_dwz && attr_form_is_ref (attr)) attr->form = DW_FORM_GNU_ref_alt; /* We have seen instances where the compiler tried to emit a byte @@ -17078,7 +17078,7 @@ lookup_die_type (struct die_info *die, struct attribute *attr, per_cu = dwarf2_find_containing_comp_unit (offset, 1, cu->objfile); this_type = get_die_type_at_offset (offset, per_cu); } - else if (is_ref_attr (attr)) + else if (attr_form_is_ref (attr)) { sect_offset offset = dwarf2_get_ref_die_offset (attr); @@ -17107,7 +17107,7 @@ lookup_die_type (struct die_info *die, struct attribute *attr, struct die_info *type_die = NULL; struct dwarf2_cu *type_cu = cu; - if (is_ref_attr (attr)) + if (attr_form_is_ref (attr)) type_die = follow_die_ref (die, attr, &type_cu); if (type_die == NULL) return build_error_marker_type (cu, die); @@ -17950,27 +17950,6 @@ store_in_ref_table (struct die_info *die, struct dwarf2_cu *cu) *slot = die; } -/* DW_ADDR is always stored already as sect_offset; despite for the forms - besides DW_FORM_ref_addr it is stored as cu_offset in the DWARF file. */ - -static int -is_ref_attr (struct attribute *attr) -{ - switch (attr->form) - { - case DW_FORM_ref_addr: - case DW_FORM_ref1: - case DW_FORM_ref2: - case DW_FORM_ref4: - case DW_FORM_ref8: - case DW_FORM_ref_udata: - case DW_FORM_GNU_ref_alt: - return 1; - default: - return 0; - } -} - /* Return DIE offset of ATTR. Return 0 with complaint if ATTR is not of the required kind. */ @@ -17979,7 +17958,7 @@ dwarf2_get_ref_die_offset (struct attribute *attr) { sect_offset retval = { DW_UNSND (attr) }; - if (is_ref_attr (attr)) + if (attr_form_is_ref (attr)) return retval; retval.sect_off = 0; @@ -18022,7 +18001,7 @@ follow_die_ref_or_sig (struct die_info *src_die, struct attribute *attr, { struct die_info *die; - if (is_ref_attr (attr)) + if (attr_form_is_ref (attr)) die = follow_die_ref (src_die, attr, ref_cu); else if (attr->form == DW_FORM_ref_sig8) die = follow_die_sig (src_die, attr, ref_cu); @@ -18505,7 +18484,7 @@ get_DW_AT_signature_type (struct die_info *die, struct attribute *attr, struct dwarf2_cu *cu) /* ARI: editCase function */ { /* Yes, DW_AT_signature can use a non-ref_sig8 reference. */ - if (is_ref_attr (attr)) + if (attr_form_is_ref (attr)) { struct dwarf2_cu *type_cu = cu; struct die_info *type_die = follow_die_ref (die, attr, &type_cu); @@ -19873,6 +19852,28 @@ attr_form_is_constant (struct attribute *attr) } } + +/* DW_ADDR is always stored already as sect_offset; despite for the forms + besides DW_FORM_ref_addr it is stored as cu_offset in the DWARF file. */ + +static int +attr_form_is_ref (struct attribute *attr) +{ + switch (attr->form) + { + case DW_FORM_ref_addr: + case DW_FORM_ref1: + case DW_FORM_ref2: + case DW_FORM_ref4: + case DW_FORM_ref8: + case DW_FORM_ref_udata: + case DW_FORM_GNU_ref_alt: + return 1; + default: + return 0; + } +} + /* Return the .debug_loc section to use for CU. For DWO files use .debug_loc.dwo. */ -- 1.7.1.1