From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 129566 invoked by alias); 15 Feb 2017 22:58:08 -0000 Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org Received: (qmail 129543 invoked by uid 89); 15 Feb 2017 22:58:07 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=sk:decode_, Entry, curr, H*MI:host1 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 15 Feb 2017 22:58:05 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D1E223D966; Wed, 15 Feb 2017 22:58:05 +0000 (UTC) Received: from host1.jankratochvil.net (ovpn-116-221.ams2.redhat.com [10.36.116.221]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v1FMw4fC021691; Wed, 15 Feb 2017 17:58:05 -0500 Subject: [PATCH 1/6] DWARF attrs: add delimiter From: Jan Kratochvil To: binutils@sourceware.org Cc: Victor Leschuk Date: Wed, 15 Feb 2017 22:58:00 -0000 Message-ID: <148719947800.19826.950569475344047705.stgit@host1.jankratochvil.net> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2017-02/txt/msg00136.txt.bz2 Hi, currently DWARF attributes are always prefixed by ' '. But DWARF-5 file name table needs to prefix it by 't': The File name Table (offset 0x30): Entry Dir Name 0 0 (indirect line string, offset: 0x0): /home/jkratoch/t/classic.C 1 1 (indirect line string, offset: 0x11): classic.C Jan 2017-02-12 Jan Kratochvil * dwarf.c (display_block): Add parameter delimiter. (decode_location_expression): Update display_block callers. (read_and_display_attr_value): Add parameter delimiter. (read_and_display_attr, display_debug_macro): Update read_and_display_attr_value caller. --- binutils/dwarf.c | 50 +++++++++++++++++++++++++------------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/binutils/dwarf.c b/binutils/dwarf.c index 0184a7a..368c498 100644 --- a/binutils/dwarf.c +++ b/binutils/dwarf.c @@ -871,11 +871,11 @@ get_FORM_name (unsigned long form) static unsigned char * display_block (unsigned char *data, dwarf_vma length, - const unsigned char * const end) + const unsigned char * const end, char delimiter) { dwarf_vma maxlen; - printf (_(" %s byte block: "), dwarf_vmatoa ("u", length)); + printf (_("%c%s byte block: "), delimiter, dwarf_vmatoa ("u", length)); if (data > end) return (unsigned char *) end; @@ -1268,7 +1268,7 @@ decode_location_expression (unsigned char * data, printf ("DW_OP_implicit_value"); uvalue = read_uleb128 (data, &bytes_read, end); data += bytes_read; - data = display_block (data, uvalue, end); + data = display_block (data, uvalue, end, ' '); break; /* GNU extensions. */ @@ -1337,7 +1337,7 @@ decode_location_expression (unsigned char * data, printf ("DW_OP_GNU_const_type: <0x%s> ", dwarf_vmatoa ("x", cu_offset + uvalue)); SAFE_BYTE_GET_AND_INC (uvalue, data, 1, end); - data = display_block (data, uvalue, end); + data = display_block (data, uvalue, end, ' '); break; case DW_OP_GNU_regval_type: uvalue = read_uleb128 (data, &bytes_read, end); @@ -1508,7 +1508,7 @@ read_and_display_attr_value (unsigned long attribute, debug_info * debug_info_p, int do_loc, struct dwarf_section * section, - struct cu_tu_set * this_set) + struct cu_tu_set * this_set, char delimiter) { dwarf_vma uvalue = 0; unsigned char *block_start = NULL; @@ -1587,12 +1587,12 @@ read_and_display_attr_value (unsigned long attribute, form = read_uleb128 (data, & bytes_read, end); data += bytes_read; if (!do_loc) - printf (" %s", get_FORM_name (form)); + printf ("%c%s", delimiter, get_FORM_name (form)); return read_and_display_attr_value (attribute, form, data, end, cu_offset, pointer_size, offset_size, dwarf_version, debug_info_p, do_loc, - section, this_set); + section, this_set, delimiter); case DW_FORM_GNU_addr_index: uvalue = read_uleb128 (data, & bytes_read, end); data += bytes_read; @@ -1603,12 +1603,12 @@ read_and_display_attr_value (unsigned long attribute, { case DW_FORM_ref_addr: if (!do_loc) - printf (" <0x%s>", dwarf_vmatoa ("x",uvalue)); + printf ("%c<0x%s>", delimiter, dwarf_vmatoa ("x",uvalue)); break; case DW_FORM_GNU_ref_alt: if (!do_loc) - printf (" ", dwarf_vmatoa ("x",uvalue)); + printf ("%c", delimiter, dwarf_vmatoa ("x",uvalue)); break; case DW_FORM_ref1: @@ -1616,14 +1616,14 @@ read_and_display_attr_value (unsigned long attribute, case DW_FORM_ref4: case DW_FORM_ref_udata: if (!do_loc) - printf (" <0x%s>", dwarf_vmatoa ("x", uvalue + cu_offset)); + printf ("%c<0x%s>", delimiter, dwarf_vmatoa ("x", uvalue + cu_offset)); break; case DW_FORM_data4: case DW_FORM_addr: case DW_FORM_sec_offset: if (!do_loc) - printf (" 0x%s", dwarf_vmatoa ("x", uvalue)); + printf ("%c0x%s", delimiter, dwarf_vmatoa ("x", uvalue)); break; case DW_FORM_flag_present: @@ -1633,7 +1633,7 @@ read_and_display_attr_value (unsigned long attribute, case DW_FORM_sdata: case DW_FORM_udata: if (!do_loc) - printf (" %s", dwarf_vmatoa ("d", uvalue)); + printf ("%c%s", delimiter, dwarf_vmatoa ("d", uvalue)); break; case DW_FORM_ref8: @@ -1648,7 +1648,7 @@ read_and_display_attr_value (unsigned long attribute, utmp = uvalue; if (form == DW_FORM_ref8) add64 (& high_bits, & utmp, cu_offset); - printf (" 0x%s", + printf ("%c0x%s", delimiter, dwarf_vmatoa64 (high_bits, utmp, buf, sizeof (buf))); } @@ -1666,7 +1666,7 @@ read_and_display_attr_value (unsigned long attribute, case DW_FORM_string: if (!do_loc) - printf (" %.*s", (int) (end - data), data); + printf ("%c%.*s", delimiter, (int) (end - data), data); data += strnlen ((char *) data, end - data) + 1; break; @@ -1693,7 +1693,7 @@ read_and_display_attr_value (unsigned long attribute, if (do_loc) data = block_start + uvalue; else - data = display_block (block_start, uvalue, end); + data = display_block (block_start, uvalue, end, delimiter); break; case DW_FORM_block1: @@ -1714,7 +1714,7 @@ read_and_display_attr_value (unsigned long attribute, if (do_loc) data = block_start + uvalue; else - data = display_block (block_start, uvalue, end); + data = display_block (block_start, uvalue, end, delimiter); break; case DW_FORM_block2: @@ -1735,7 +1735,7 @@ read_and_display_attr_value (unsigned long attribute, if (do_loc) data = block_start + uvalue; else - data = display_block (block_start, uvalue, end); + data = display_block (block_start, uvalue, end, delimiter); break; case DW_FORM_block4: @@ -1759,12 +1759,12 @@ read_and_display_attr_value (unsigned long attribute, if (do_loc) data = block_start + uvalue; else - data = display_block (block_start, uvalue, end); + data = display_block (block_start, uvalue, end, delimiter); break; case DW_FORM_strp: if (!do_loc) - printf (_(" (indirect string, offset: 0x%s): %s"), + printf (_("%c(indirect string, offset: 0x%s): %s"), delimiter, dwarf_vmatoa ("x", uvalue), fetch_indirect_string (uvalue)); break; @@ -1775,7 +1775,7 @@ read_and_display_attr_value (unsigned long attribute, const char *suffix = strrchr (section->name, '.'); int dwo = (suffix && strcmp (suffix, ".dwo") == 0) ? 1 : 0; - printf (_(" (indexed string: 0x%s): %s"), + printf (_("%c(indexed string: 0x%s): %s"), delimiter, dwarf_vmatoa ("x", uvalue), fetch_indexed_string (uvalue, this_set, offset_size, dwo)); } @@ -1783,7 +1783,7 @@ read_and_display_attr_value (unsigned long attribute, case DW_FORM_GNU_strp_alt: if (!do_loc) - printf (_(" (alt indirect string, offset: 0x%s)"), + printf (_("%c(alt indirect string, offset: 0x%s)"), delimiter, dwarf_vmatoa ("x", uvalue)); break; @@ -1798,7 +1798,7 @@ read_and_display_attr_value (unsigned long attribute, char buf[64]; SAFE_BYTE_GET64 (data, &high_bits, &uvalue, end); - printf (" signature: 0x%s", + printf ("%csignature: 0x%s", delimiter, dwarf_vmatoa64 (high_bits, uvalue, buf, sizeof (buf))); } data += 8; @@ -1806,7 +1806,7 @@ read_and_display_attr_value (unsigned long attribute, case DW_FORM_GNU_addr_index: if (!do_loc) - printf (_(" (addr_index: 0x%s): %s"), + printf (_("%c(addr_index: 0x%s): %s"), delimiter, dwarf_vmatoa ("x", uvalue), fetch_indexed_value (uvalue * pointer_size, pointer_size)); break; @@ -2233,7 +2233,7 @@ read_and_display_attr (unsigned long attribute, data = read_and_display_attr_value (attribute, form, data, end, cu_offset, pointer_size, offset_size, dwarf_version, debug_info_p, - do_loc, section, this_set); + do_loc, section, this_set, ' '); if (!do_loc) printf ("\n"); return data; @@ -4332,7 +4332,7 @@ display_debug_macro (struct dwarf_section *section, = read_and_display_attr_value (0, val, curr, end, 0, 0, offset_size, version, NULL, 0, NULL, - NULL); + NULL, ' '); if (n != nargs - 1) printf (","); }