From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gateway23.websitewelcome.com (gateway23.websitewelcome.com [192.185.49.104]) by sourceware.org (Postfix) with ESMTPS id B342F389907D for ; Sat, 28 Mar 2020 19:22:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org B342F389907D Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tromey.com Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=tom@tromey.com Received: from cm16.websitewelcome.com (cm16.websitewelcome.com [100.42.49.19]) by gateway23.websitewelcome.com (Postfix) with ESMTP id 676A73A13 for ; Sat, 28 Mar 2020 14:22:14 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id IH26joCO98vkBIH26jdfgR; Sat, 28 Mar 2020 14:22:14 -0500 X-Authority-Reason: nr=8 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Sender:Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=TqJ+jK4h8Y4xH5v0HMjtXyev1yRt/NpBqiukaWY+f9c=; b=l0JfHvxEdWO7iKwheEj++0ITCn uK5DwhZKy4UGMQDYgOn5grlACfpsD1r+xpjAPYH6aW/9asjXOBb5wGWZzehBX8GqrXstIrCoiFkV+ 6OcHv8S8z3vLv3Loi3q2Jnb5A; Received: from 97-118-117-21.hlrn.qwest.net ([97.118.117.21]:55190 helo=bapiya.Home) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92) (envelope-from ) id 1jIH26-003oZR-5s; Sat, 28 Mar 2020 13:22:14 -0600 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH 20/20] Remove DW_UNSND Date: Sat, 28 Mar 2020 13:22:08 -0600 Message-Id: <20200328192208.11324-21-tom@tromey.com> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20200328192208.11324-1-tom@tromey.com> References: <20200328192208.11324-1-tom@tromey.com> X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box5379.bluehost.com X-AntiAbuse: Original Domain - sourceware.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 97.118.117.21 X-Source-L: No X-Exim-ID: 1jIH26-003oZR-5s X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-118-117-21.hlrn.qwest.net (bapiya.Home) [97.118.117.21]:55190 X-Source-Auth: tom+tromey.com X-Email-Count: 23 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-Spam-Status: No, score=-20.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, JMQ_SPF_NEUTRAL, KAM_STOCKGEN, RCVD_IN_ABUSEAT, RCVD_IN_DNSWL_NONE, RCVD_IN_SBL_CSS, SPF_HELO_PASS, SPF_NEUTRAL, TXREP, URIBL_CSS, URIBL_CSS_A autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Mar 2020 19:22:18 -0000 This removes DW_UNSND, replacing uses with either get_unsigned or constant_value, depending primarily on whether or not the form is already known to be appropriate. 2020-03-28 Tom Tromey * dwarf2/read.c (lookup_dwo_id, get_type_unit_group) (read_file_scope, dwarf2_get_pc_bounds) (dwarf2_record_block_ranges, dwarf2_add_field, get_alignment) (read_structure_type, handle_struct_member_die) (read_enumeration_type, read_array_type, read_set_type) (read_tag_pointer_type, read_tag_reference_type) (read_subroutine_type, read_base_type, read_subrange_type) (read_full_die_1, partial_die_info::read) (partial_die_info::read, by, new_symbol) (dwarf2_const_value_data, dwarf2_const_value_attr) (dump_die_shallow, dwarf2_fetch_constant_bytes) (prepare_one_comp_unit): Update. * dwarf2/attribute.h (DW_UNSND): Remove. --- gdb/ChangeLog | 16 +++++ gdb/dwarf2/attribute.h | 4 -- gdb/dwarf2/read.c | 152 ++++++++++++++++++++--------------------- 3 files changed, 91 insertions(+), 81 deletions(-) diff --git a/gdb/dwarf2/attribute.h b/gdb/dwarf2/attribute.h index 20947a11642..04c057cd7d2 100644 --- a/gdb/dwarf2/attribute.h +++ b/gdb/dwarf2/attribute.h @@ -272,8 +272,4 @@ struct attribute u; }; -/* Get at parts of an attribute structure. */ - -#define DW_UNSND(attr) ((attr)->u.unsnd) - #endif /* GDB_DWARF2_ATTRIBUTE_H */ diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index cf4a2a333ef..d772f2b21bf 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -6589,9 +6589,9 @@ lookup_dwo_id (struct dwarf2_cu *cu, struct die_info* comp_unit_die) return cu->header.signature; struct attribute *attr; attr = dwarf2_attr (comp_unit_die, DW_AT_GNU_dwo_id, cu); - if (attr == nullptr) + if (attr == nullptr || !attr->form_is_unsigned ()) return gdb::optional (); - return DW_UNSND (attr); + return attr->get_unsigned (); } /* Subroutine of cutu_reader to simplify it. @@ -7081,9 +7081,9 @@ get_type_unit_group (struct dwarf2_cu *cu, const struct attribute *stmt_list) /* Do we need to create a new group, or can we use an existing one? */ - if (stmt_list) + if (stmt_list != nullptr && stmt_list->form_is_unsigned ()) { - line_offset = DW_UNSND (stmt_list); + line_offset = stmt_list->get_unsigned (); ++tu_stats->nr_symtab_sharers; } else @@ -10704,19 +10704,19 @@ read_file_scope (struct die_info *die, struct dwarf2_cu *cu) attr = dwarf2_attr (die, DW_AT_macros, cu); if (attr == NULL) attr = dwarf2_attr (die, DW_AT_GNU_macros, cu); - if (attr && cu->line_header) + if (attr != nullptr && attr->form_is_unsigned () && cu->line_header) { if (dwarf2_attr (die, DW_AT_macro_info, cu)) complaint (_("CU refers to both DW_AT_macros and DW_AT_macro_info")); - dwarf_decode_macros (cu, DW_UNSND (attr), 1); + dwarf_decode_macros (cu, attr->get_unsigned (), 1); } else { attr = dwarf2_attr (die, DW_AT_macro_info, cu); - if (attr && cu->line_header) + if (attr != nullptr && attr->form_is_unsigned () && cu->line_header) { - unsigned int macro_offset = DW_UNSND (attr); + unsigned int macro_offset = attr->get_unsigned (); dwarf_decode_macros (cu, macro_offset, 0); } @@ -13736,13 +13736,13 @@ dwarf2_get_pc_bounds (struct die_info *die, CORE_ADDR *lowpc, else { attr = dwarf2_attr (die, DW_AT_ranges, cu); - if (attr != NULL) + if (attr != nullptr && attr->form_is_unsigned ()) { /* DW_AT_rnglists_base does not apply to DIEs from the DWO skeleton. We take advantage of the fact that DW_AT_ranges does not appear in DW_TAG_compile_unit of DWO files. */ int need_ranges_base = die->tag != DW_TAG_compile_unit; - unsigned int ranges_offset = (DW_UNSND (attr) + unsigned int ranges_offset = (attr->get_unsigned () + (need_ranges_base ? cu->ranges_base : 0)); @@ -13907,7 +13907,7 @@ dwarf2_record_block_ranges (struct die_info *die, struct block *block, } attr = dwarf2_attr (die, DW_AT_ranges, cu); - if (attr != nullptr) + if (attr != nullptr && attr->form_is_unsigned ()) { /* DW_AT_rnglists_base does not apply to DIEs from the DWO skeleton. We take advantage of the fact that DW_AT_ranges does not appear @@ -13916,7 +13916,7 @@ dwarf2_record_block_ranges (struct die_info *die, struct block *block, /* The value of the DW_AT_ranges attribute is the offset of the address range list in the .debug_ranges section. */ - unsigned long offset = (DW_UNSND (attr) + unsigned long offset = (attr->get_unsigned () + (need_ranges_base ? cu->ranges_base : 0)); std::vector blockvec; @@ -14128,7 +14128,7 @@ dwarf2_add_field (struct field_info *fip, struct die_info *die, attr = dwarf2_attr (die, DW_AT_bit_size, cu); if (attr != nullptr) { - FIELD_BITSIZE (*fp) = DW_UNSND (attr); + FIELD_BITSIZE (*fp) = attr->constant_value (0); } else { @@ -14139,7 +14139,7 @@ dwarf2_add_field (struct field_info *fip, struct die_info *die, if (handle_data_member_location (die, cu, &offset)) SET_FIELD_BITPOS (*fp, offset * bits_per_byte); attr = dwarf2_attr (die, DW_AT_bit_offset, cu); - if (attr != nullptr) + if (attr != nullptr && attr->form_is_unsigned ()) { if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG) { @@ -14148,7 +14148,8 @@ dwarf2_add_field (struct field_info *fip, struct die_info *die, anonymous object to the MSB of the field. We don't have to do anything special since we don't need to know the size of the anonymous object. */ - SET_FIELD_BITPOS (*fp, FIELD_BITPOS (*fp) + DW_UNSND (attr)); + SET_FIELD_BITPOS (*fp, (FIELD_BITPOS (*fp) + + attr->get_unsigned ())); } else { @@ -14159,15 +14160,15 @@ dwarf2_add_field (struct field_info *fip, struct die_info *die, the field itself. The result is the bit offset of the LSB of the field. */ int anonymous_size; - int bit_offset = DW_UNSND (attr); + int bit_offset = attr->get_unsigned (); attr = dwarf2_attr (die, DW_AT_byte_size, cu); - if (attr != nullptr) + if (attr != nullptr && attr->form_is_unsigned ()) { /* The size of the anonymous object containing the bit field is explicit, so use the indicated size (in bytes). */ - anonymous_size = DW_UNSND (attr); + anonymous_size = attr->get_unsigned (); } else { @@ -14784,22 +14785,16 @@ get_alignment (struct dwarf2_cu *cu, struct die_info *die) return 0; } - ULONGEST align; - if (attr->form == DW_FORM_sdata) + LONGEST val = attr->constant_value (0); + if (val < 0) { - LONGEST val = attr->get_signed (); - if (val < 0) - { - complaint (_("DW_AT_alignment value must not be negative" - " - DIE at %s [in module %s]"), - sect_offset_str (die->sect_off), - objfile_name (cu->per_cu->dwarf2_per_objfile->objfile)); - return 0; - } - align = val; + complaint (_("DW_AT_alignment value must not be negative" + " - DIE at %s [in module %s]"), + sect_offset_str (die->sect_off), + objfile_name (cu->per_cu->dwarf2_per_objfile->objfile)); + return 0; } - else - align = DW_UNSND (attr); + ULONGEST align = val; if (align == 0) { @@ -14967,18 +14962,18 @@ read_structure_type (struct die_info *die, struct dwarf2_cu *cu) the default value DW_CC_normal. */ attr = dwarf2_attr (die, DW_AT_calling_convention, cu); if (attr != nullptr - && is_valid_DW_AT_calling_convention_for_type (DW_UNSND (attr))) + && is_valid_DW_AT_calling_convention_for_type (attr->constant_value (0))) { ALLOCATE_CPLUS_STRUCT_TYPE (type); TYPE_CPLUS_CALLING_CONVENTION (type) - = (enum dwarf_calling_convention) (DW_UNSND (attr)); + = (enum dwarf_calling_convention) (attr->constant_value (0)); } attr = dwarf2_attr (die, DW_AT_byte_size, cu); if (attr != nullptr) { if (attr->form_is_constant ()) - TYPE_LENGTH (type) = DW_UNSND (attr); + TYPE_LENGTH (type) = attr->constant_value (0); else { /* For the moment, dynamic type sizes are not supported @@ -15108,7 +15103,8 @@ handle_struct_member_die (struct die_info *child_die, struct type *type, if (discr == NULL) fi->fields.back ().variant.default_branch = true; else - fi->fields.back ().variant.discriminant_value = DW_UNSND (discr); + fi->fields.back ().variant.discriminant_value + = discr->constant_value (0); } } @@ -15468,7 +15464,7 @@ read_enumeration_type (struct die_info *die, struct dwarf2_cu *cu) attr = dwarf2_attr (die, DW_AT_byte_size, cu); if (attr != nullptr) { - TYPE_LENGTH (type) = DW_UNSND (attr); + TYPE_LENGTH (type) = attr->constant_value (0); } else { @@ -15641,7 +15637,7 @@ read_array_type (struct die_info *die, struct dwarf2_cu *cu) attr = dwarf2_attr (die, DW_AT_bit_stride, cu); if (attr != NULL) - bit_stride = DW_UNSND (attr); + bit_stride = attr->constant_value (0); /* Irix 6.2 native cc creates array types without children for arrays with unspecified length. */ @@ -15707,10 +15703,10 @@ read_array_type (struct die_info *die, struct dwarf2_cu *cu) implementation may choose to implement triple vectors using this attribute. */ attr = dwarf2_attr (die, DW_AT_byte_size, cu); - if (attr != nullptr) + if (attr != nullptr && attr->form_is_unsigned ()) { - if (DW_UNSND (attr) >= TYPE_LENGTH (type)) - TYPE_LENGTH (type) = DW_UNSND (attr); + if (attr->get_unsigned () >= TYPE_LENGTH (type)) + TYPE_LENGTH (type) = attr->get_unsigned (); else complaint (_("DW_AT_byte_size for array type smaller " "than the total size of elements")); @@ -15787,8 +15783,8 @@ read_set_type (struct die_info *die, struct dwarf2_cu *cu) set_type = create_set_type (NULL, domain_type); attr = dwarf2_attr (die, DW_AT_byte_size, cu); - if (attr != nullptr) - TYPE_LENGTH (set_type) = DW_UNSND (attr); + if (attr != nullptr && attr->form_is_unsigned ()) + TYPE_LENGTH (set_type) = attr->get_unsigned (); maybe_set_alignment (cu, die, set_type); @@ -16144,13 +16140,13 @@ read_tag_pointer_type (struct die_info *die, struct dwarf2_cu *cu) attr_byte_size = dwarf2_attr (die, DW_AT_byte_size, cu); if (attr_byte_size) - byte_size = DW_UNSND (attr_byte_size); + byte_size = attr_byte_size->constant_value (cu_header->addr_size); else byte_size = cu_header->addr_size; attr_address_class = dwarf2_attr (die, DW_AT_address_class, cu); if (attr_address_class) - addr_class = DW_UNSND (attr_address_class); + addr_class = attr_address_class->constant_value (DW_ADDR_none); else addr_class = DW_ADDR_none; @@ -16256,7 +16252,7 @@ read_tag_reference_type (struct die_info *die, struct dwarf2_cu *cu, attr = dwarf2_attr (die, DW_AT_byte_size, cu); if (attr != nullptr) { - TYPE_LENGTH (type) = DW_UNSND (attr); + TYPE_LENGTH (type) = attr->constant_value (cu_header->addr_size); } else { @@ -16544,9 +16540,9 @@ read_subroutine_type (struct die_info *die, struct dwarf2_cu *cu) the default value DW_CC_normal. */ attr = dwarf2_attr (die, DW_AT_calling_convention, cu); if (attr != nullptr - && is_valid_DW_AT_calling_convention_for_subroutine (DW_UNSND (attr))) + && is_valid_DW_AT_calling_convention_for_subroutine (attr->constant_value (0))) TYPE_CALLING_CONVENTION (ftype) - = (enum dwarf_calling_convention) (DW_UNSND (attr)); + = (enum dwarf_calling_convention) attr->constant_value (0); else if (cu->producer && strstr (cu->producer, "IBM XL C for OpenCL")) TYPE_CALLING_CONVENTION (ftype) = DW_CC_GDB_IBM_OpenCL; else @@ -16814,11 +16810,11 @@ read_base_type (struct die_info *die, struct dwarf2_cu *cu) gdbarch *arch; attr = dwarf2_attr (die, DW_AT_encoding, cu); - if (attr != nullptr) - encoding = DW_UNSND (attr); + if (attr != nullptr && attr->form_is_constant ()) + encoding = attr->constant_value (0); attr = dwarf2_attr (die, DW_AT_byte_size, cu); if (attr != nullptr) - bits = DW_UNSND (attr) * TARGET_CHAR_BIT; + bits = attr->constant_value (0) * TARGET_CHAR_BIT; name = dwarf2_name (die, cu); if (!name) complaint (_("DW_AT_name missing from DW_TAG_base_type")); @@ -16827,9 +16823,9 @@ read_base_type (struct die_info *die, struct dwarf2_cu *cu) enum bfd_endian byte_order = gdbarch_byte_order (arch); attr = dwarf2_attr (die, DW_AT_endianity, cu); - if (attr) + if (attr != nullptr && attr->form_is_constant ()) { - int endianity = DW_UNSND (attr); + int endianity = attr->constant_value (0); switch (endianity) { @@ -17285,7 +17281,7 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu) attr = dwarf2_attr (die, DW_AT_byte_size, cu); if (attr != nullptr) - TYPE_LENGTH (range_type) = DW_UNSND (attr); + TYPE_LENGTH (range_type) = attr->constant_value (0); maybe_set_alignment (cu, die, range_type); @@ -17469,8 +17465,8 @@ read_full_die_1 (const struct die_reader_specs *reader, } struct attribute *attr = die->attr (DW_AT_str_offsets_base); - if (attr != nullptr) - cu->str_offsets_base = DW_UNSND (attr); + if (attr != nullptr && attr->form_is_unsigned ()) + cu->str_offsets_base = attr->get_unsigned (); auto maybe_addr_base = die->addr_base (); if (maybe_addr_base.has_value ()) @@ -17962,14 +17958,17 @@ partial_die_info::read (const struct die_reader_specs *reader, Although DWARF now specifies a way to provide this information, we support this practice for backward compatibility. */ - if (DW_UNSND (&attr) == DW_CC_program + if (attr.constant_value (0) == DW_CC_program && cu->language == language_fortran) main_subprogram = 1; break; case DW_AT_inline: - if (DW_UNSND (&attr) == DW_INL_inlined - || DW_UNSND (&attr) == DW_INL_declared_inlined) - may_be_inlined = 1; + { + LONGEST value = attr.constant_value (-1); + if (value == DW_INL_inlined + || value == DW_INL_declared_inlined) + may_be_inlined = 1; + } break; case DW_AT_import: @@ -17991,7 +17990,7 @@ partial_die_info::read (const struct die_reader_specs *reader, but that requires a full DIE, so instead we just reimplement it. */ int need_ranges_base = tag != DW_TAG_compile_unit; - unsigned int ranges_offset = (DW_UNSND (&attr) + unsigned int ranges_offset = (attr.constant_value (0) + (need_ranges_base ? cu->ranges_base : 0)); @@ -18569,11 +18568,11 @@ read_attribute_value (const struct die_reader_specs *reader, treat them as zero by default. */ if (attr->name == DW_AT_byte_size && form == DW_FORM_data4 - && DW_UNSND (attr) >= 0xffffffff) + && attr->get_unsigned () >= 0xffffffff) { complaint (_("Suspicious DW_AT_byte_size value treated as zero instead of %s"), - hex_string (DW_UNSND (attr))); + hex_string (attr->get_unsigned ())); attr->set_unsigned (0); } @@ -20019,16 +20018,15 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu, inlined_func ? DW_AT_call_line : DW_AT_decl_line, cu); if (attr != nullptr) - { - SYMBOL_LINE (sym) = DW_UNSND (attr); - } + SYMBOL_LINE (sym) = attr->constant_value (0); attr = dwarf2_attr (die, inlined_func ? DW_AT_call_file : DW_AT_decl_file, cu); - if (attr != nullptr) + if (attr != nullptr && attr->form_is_unsigned ()) { - file_name_index file_index = (file_name_index) DW_UNSND (attr); + file_name_index file_index + = (file_name_index) attr->get_unsigned (); struct file_entry *fe; if (cu->line_header != NULL) @@ -20378,7 +20376,7 @@ dwarf2_const_value_data (const struct attribute *attr, struct obstack *obstack, struct objfile *objfile = cu->per_cu->dwarf2_per_objfile->objfile; enum bfd_endian byte_order = bfd_big_endian (objfile->obfd) ? BFD_ENDIAN_BIG : BFD_ENDIAN_LITTLE; - LONGEST l = DW_UNSND (attr); + LONGEST l = attr->constant_value (0); if (bits < sizeof (*value) * 8) { @@ -20495,7 +20493,7 @@ dwarf2_const_value_attr (const struct attribute *attr, struct type *type, break; case DW_FORM_udata: - *value = DW_UNSND (attr); + *value = attr->get_unsigned (); break; default: @@ -21337,11 +21335,11 @@ dump_die_shallow (struct ui_file *f, int indent, struct die_info *die) break; case DW_FORM_ref_addr: fprintf_unfiltered (f, "ref address: "); - fputs_filtered (hex_string (DW_UNSND (&die->attrs[i])), f); + fputs_filtered (hex_string (die->attrs[i].get_unsigned ()), f); break; case DW_FORM_GNU_ref_alt: fprintf_unfiltered (f, "alt ref address: "); - fputs_filtered (hex_string (DW_UNSND (&die->attrs[i])), f); + fputs_filtered (hex_string (die->attrs[i].get_unsigned ()), f); break; case DW_FORM_ref1: case DW_FORM_ref2: @@ -21349,7 +21347,7 @@ dump_die_shallow (struct ui_file *f, int indent, struct die_info *die) case DW_FORM_ref8: case DW_FORM_ref_udata: fprintf_unfiltered (f, "constant ref: 0x%lx (adjusted)", - (long) (DW_UNSND (&die->attrs[i]))); + (long) (die->attrs[i].get_unsigned ())); break; case DW_FORM_data1: case DW_FORM_data2: @@ -21357,11 +21355,11 @@ dump_die_shallow (struct ui_file *f, int indent, struct die_info *die) case DW_FORM_data8: case DW_FORM_udata: fprintf_unfiltered (f, "constant: %s", - pulongest (DW_UNSND (&die->attrs[i]))); + pulongest (die->attrs[i].get_unsigned ())); break; case DW_FORM_sec_offset: fprintf_unfiltered (f, "section offset: %s", - pulongest (DW_UNSND (&die->attrs[i]))); + pulongest (die->attrs[i].get_unsigned ())); break; case DW_FORM_ref_sig8: fprintf_unfiltered (f, "signature: %s", @@ -21828,7 +21826,7 @@ dwarf2_fetch_constant_bytes (sect_offset sect_off, case DW_FORM_udata: type = die_type (die, cu); result = write_constant_as_bytes (obstack, byte_order, - type, DW_UNSND (attr), len); + type, attr->get_unsigned (), len); break; default: @@ -22839,7 +22837,7 @@ prepare_one_comp_unit (struct dwarf2_cu *cu, struct die_info *comp_unit_die, /* Set the language we're debugging. */ attr = dwarf2_attr (comp_unit_die, DW_AT_language, cu); if (attr != nullptr) - set_cu_language (DW_UNSND (attr), cu); + set_cu_language (attr->constant_value (0), cu); else { cu->language = pretend_language; -- 2.17.2