From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 58116 invoked by alias); 29 Nov 2017 16:06:24 -0000 Mailing-List: contact elfutils-devel-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Post: List-Help: List-Subscribe: Sender: elfutils-devel-owner@sourceware.org Received: (qmail 57947 invoked by uid 89); 29 Nov 2017 16:06:23 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Checked: by ClamAV 0.99.2 on sourceware.org X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.7 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,KAM_LAZY_DOMAIN_SECURITY,KB_WAM_FROM_NAME_SINGLEWORD autolearn=ham version=3.3.2 spammy=4705, abbreviation, 15312 X-Spam-Status: No, score=-25.7 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,KAM_LAZY_DOMAIN_SECURITY,KB_WAM_FROM_NAME_SINGLEWORD autolearn=ham version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on sourceware.org X-Spam-Level: X-HELO: gnu.wildebeest.org Received: from wildebeest.demon.nl (HELO gnu.wildebeest.org) (212.238.236.112) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 29 Nov 2017 16:06:16 +0000 Received: from tarox.wildebeest.org (tarox.wildebeest.org [172.31.17.39]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by gnu.wildebeest.org (Postfix) with ESMTPSA id 2F77A31AC0D8; Wed, 29 Nov 2017 17:06:14 +0100 (CET) Received: by tarox.wildebeest.org (Postfix, from userid 1000) id 2A253413C06B; Wed, 29 Nov 2017 17:06:14 +0100 (CET) From: Mark Wielaard To: elfutils-devel@sourceware.org Cc: Mark Wielaard Subject: [PATCH 2/5] readelf: Print abbrev code for DIE with --debug-dump=info. Date: Wed, 29 Nov 2017 16:06:00 -0000 Message-Id: <1511971553-30135-3-git-send-email-mark@klomp.org> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1511971553-30135-1-git-send-email-mark@klomp.org> References: <1511971553-30135-1-git-send-email-mark@klomp.org> X-Spam-Flag: NO X-IsSubscribed: yes X-SW-Source: 2017-q4/txt/msg00079.txt.bz2 If there is anything wrong with a DIE it is useful to know what the abbrev code was so you can lookup the abbrev description. Signed-off-by: Mark Wielaard --- src/ChangeLog | 4 +++ src/readelf.c | 9 ++++--- tests/ChangeLog | 5 ++++ tests/run-readelf-dwz-multi.sh | 60 ++++++++++++++++++++--------------------- tests/run-readelf-zdebug-rel.sh | 22 +++++++-------- 5 files changed, 56 insertions(+), 44 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index b88c319..e7e598d 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,9 @@ 2017-11-29 Mark Wielaard + * readelf.c (print_debug_units): Print abbrev code after DIE tag. + +2017-11-29 Mark Wielaard + * readelf.c (print_ops): Use only2 space for index. re-indent +5 for DW_OP_GNU_entry_value. diff --git a/src/readelf.c b/src/readelf.c index 2faa1d5..e9887c4 100644 --- a/src/readelf.c +++ b/src/readelf.c @@ -6371,9 +6371,12 @@ print_debug_units (Dwfl_Module *dwflmod, } if (!silent) - printf (" [%6" PRIx64 "] %*s%s\n", - (uint64_t) offset, (int) (level * 2), "", - dwarf_tag_name (tag)); + { + unsigned int code = dwarf_getabbrevcode (dies[level].abbrev); + printf (" [%6" PRIx64 "] %*s%-20s abbrev: %u\n", + (uint64_t) offset, (int) (level * 2), "", + dwarf_tag_name (tag), code); + } /* Print the attribute values. */ args.level = level; diff --git a/tests/ChangeLog b/tests/ChangeLog index 9633cd1..f522a69 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,5 +1,10 @@ 2017-11-29 Mark Wielaard + * run-readelf-dwz-multi.sh: Add expected abbrev codes. + * run-readelf-zdebug-rel.sh: Likewise. + +2017-11-29 Mark Wielaard + * run-readelf-dwz-multi.sh: Adjust expected ops index spaces. * run-readelf-loc.sh: Likewise. * run-readelf-zdebug-rel.sh: Likewise. diff --git a/tests/run-readelf-dwz-multi.sh b/tests/run-readelf-dwz-multi.sh index 139b8c1..21456fd 100755 --- a/tests/run-readelf-dwz-multi.sh +++ b/tests/run-readelf-dwz-multi.sh @@ -84,7 +84,7 @@ DWARF section [28] '.debug_info' at offset 0x1078: [Offset] Compilation unit at offset 0: Version: 4, Abbreviation section offset: 0, Address size: 8, Offset size: 4 - [ b] compile_unit + [ b] compile_unit abbrev: 6 producer (strp) "GNU C 4.7.0 20120507 (Red Hat 4.7.0-5) -mtune=generic -march=x86-64 -g" language (data1) C89 (1) name (strp) "main.c" @@ -92,12 +92,12 @@ DWARF section [28] '.debug_info' at offset 0x1078: low_pc (addr) 0x00000000004006ac
high_pc (udata) 44 (0x00000000004006d8) stmt_list (sec_offset) 0 - [ 26] imported_unit + [ 26] imported_unit abbrev: 5 import (GNU_ref_alt) [ b] - [ 2b] pointer_type + [ 2b] pointer_type abbrev: 1 byte_size (data1) 8 type (GNU_ref_alt) [ 53] - [ 31] subprogram + [ 31] subprogram abbrev: 3 external (flag_present) yes name (strp) "main" decl_file (data1) 1 @@ -110,28 +110,28 @@ DWARF section [28] '.debug_info' at offset 0x1078: [ 0] call_frame_cfa GNU_all_tail_call_sites (flag_present) yes sibling (ref_udata) [ 6e] - [ 48] formal_parameter + [ 48] formal_parameter abbrev: 8 name (strp) "argc" decl_file (data1) 1 decl_line (data1) 3 type (GNU_ref_alt) [ 3e] location (exprloc) [ 0] fbreg -36 - [ 56] formal_parameter + [ 56] formal_parameter abbrev: 4 name (strp) "argv" decl_file (data1) 1 decl_line (data1) 3 type (ref_udata) [ 6e] location (exprloc) [ 0] fbreg -48 - [ 61] variable + [ 61] variable abbrev: 7 name (string) "b" decl_file (data1) 1 decl_line (data1) 5 type (GNU_ref_alt) [ 5a] location (exprloc) [ 0] fbreg -32 - [ 6e] pointer_type + [ 6e] pointer_type abbrev: 2 byte_size (data1) 8 type (ref_udata) [ 2b] EOF @@ -145,7 +145,7 @@ DWARF section [28] '.debug_info' at offset 0x1078: [Offset] Compilation unit at offset 0: Version: 4, Abbreviation section offset: 0, Address size: 8, Offset size: 4 - [ b] compile_unit + [ b] compile_unit abbrev: 6 producer (strp) "GNU C 4.7.0 20120507 (Red Hat 4.7.0-5) -mtune=generic -march=x86-64 -g" language (data1) C89 (1) name (strp) "main.c" @@ -153,12 +153,12 @@ DWARF section [28] '.debug_info' at offset 0x1078: low_pc (addr) 0x00000000004006ac
high_pc (udata) 44 (0x00000000004006d8) stmt_list (sec_offset) 0 - [ 26] imported_unit + [ 26] imported_unit abbrev: 5 import (GNU_ref_alt) [ b] - [ 2b] pointer_type + [ 2b] pointer_type abbrev: 1 byte_size (data1) 8 type (GNU_ref_alt) [ 53] - [ 31] subprogram + [ 31] subprogram abbrev: 3 external (flag_present) yes name (strp) "main" decl_file (data1) 1 @@ -171,28 +171,28 @@ DWARF section [28] '.debug_info' at offset 0x1078: [ 0] call_frame_cfa GNU_all_tail_call_sites (flag_present) yes sibling (ref_udata) [ 6e] - [ 48] formal_parameter + [ 48] formal_parameter abbrev: 8 name (strp) "argc" decl_file (data1) 1 decl_line (data1) 3 type (GNU_ref_alt) [ 3e] location (exprloc) [ 0] fbreg -36 - [ 56] formal_parameter + [ 56] formal_parameter abbrev: 4 name (strp) "argv" decl_file (data1) 1 decl_line (data1) 3 type (ref_udata) [ 6e] location (exprloc) [ 0] fbreg -48 - [ 61] variable + [ 61] variable abbrev: 7 name (string) "b" decl_file (data1) 1 decl_line (data1) 5 type (GNU_ref_alt) [ 5a] location (exprloc) [ 0] fbreg -32 - [ 6e] pointer_type + [ 6e] pointer_type abbrev: 2 byte_size (data1) 8 type (ref_udata) [ 2b] EOF @@ -205,7 +205,7 @@ DWARF section [25] '.debug_info' at offset 0x106c: [Offset] Compilation unit at offset 0: Version: 4, Abbreviation section offset: 0, Address size: 8, Offset size: 4 - [ b] compile_unit + [ b] compile_unit abbrev: 3 producer (strp) "GNU C 4.7.0 20120507 (Red Hat 4.7.0-5) -fpreprocessed -mtune=generic -march=x86-64 -g -fPIC" language (data1) C89 (1) name (strp) "shared.c" @@ -213,9 +213,9 @@ DWARF section [25] '.debug_info' at offset 0x106c: low_pc (addr) +0x0000000000000670 high_pc (udata) 23 (+0x0000000000000687) stmt_list (sec_offset) 0 - [ 26] imported_unit + [ 26] imported_unit abbrev: 2 import (GNU_ref_alt) [ b] - [ 2b] subprogram + [ 2b] subprogram abbrev: 1 external (flag_present) yes name (strp) "call_foo" decl_file (data1) 1 @@ -227,7 +227,7 @@ DWARF section [25] '.debug_info' at offset 0x106c: frame_base (exprloc) [ 0] call_frame_cfa GNU_all_call_sites (flag_present) yes - [ 41] formal_parameter + [ 41] formal_parameter abbrev: 4 name (string) "fb" decl_file (data1) 1 decl_line (data1) 3 @@ -245,7 +245,7 @@ DWARF section [25] '.debug_info' at offset 0x106c: [Offset] Compilation unit at offset 0: Version: 4, Abbreviation section offset: 0, Address size: 8, Offset size: 4 - [ b] compile_unit + [ b] compile_unit abbrev: 3 producer (strp) "GNU C 4.7.0 20120507 (Red Hat 4.7.0-5) -fpreprocessed -mtune=generic -march=x86-64 -g -fPIC" language (data1) C89 (1) name (strp) "shared.c" @@ -253,9 +253,9 @@ DWARF section [25] '.debug_info' at offset 0x106c: low_pc (addr) +0x0000000000000670 high_pc (udata) 23 (+0x0000000000000687) stmt_list (sec_offset) 0 - [ 26] imported_unit + [ 26] imported_unit abbrev: 2 import (GNU_ref_alt) [ b] - [ 2b] subprogram + [ 2b] subprogram abbrev: 1 external (flag_present) yes name (strp) "call_foo" decl_file (data1) 1 @@ -267,7 +267,7 @@ DWARF section [25] '.debug_info' at offset 0x106c: frame_base (exprloc) [ 0] call_frame_cfa GNU_all_call_sites (flag_present) yes - [ 41] formal_parameter + [ 41] formal_parameter abbrev: 4 name (string) "fb" decl_file (data1) 1 decl_line (data1) 3 @@ -284,7 +284,7 @@ DWARF section [28] '.debug_info' at offset 0x1088: [Offset] Compilation unit at offset 0: Version: 4, Abbreviation section offset: 0, Address size: 8, Offset size: 4 - [ b] compile_unit + [ b] compile_unit abbrev: 5 producer (GNU_strp_alt) "GNU C 4.7.2 20121109 (Red Hat 4.7.2-8) -mtune=generic -march=x86-64 -g" language (data1) C89 (1) name (GNU_strp_alt) "main.c" @@ -292,9 +292,9 @@ DWARF section [28] '.debug_info' at offset 0x1088: low_pc (addr) 0x00000000004004ec
high_pc (udata) 18 (0x00000000004004fe) stmt_list (sec_offset) 0 - [ 26] imported_unit + [ 26] imported_unit abbrev: 2 import (GNU_ref_alt) [ b] - [ 2b] subprogram + [ 2b] subprogram abbrev: 4 external (flag_present) yes name (GNU_strp_alt) "main" decl_file (data1) 1 @@ -306,21 +306,21 @@ DWARF section [28] '.debug_info' at offset 0x1088: frame_base (exprloc) [ 0] call_frame_cfa GNU_all_call_sites (flag_present) yes - [ 41] formal_parameter + [ 41] formal_parameter abbrev: 1 name (GNU_strp_alt) "argc" decl_file (data1) 1 decl_line (data1) 8 type (GNU_ref_alt) [ 30] location (exprloc) [ 0] fbreg -36 - [ 4f] formal_parameter + [ 4f] formal_parameter abbrev: 1 name (GNU_strp_alt) "argv" decl_file (data1) 1 decl_line (data1) 8 type (GNU_ref_alt) [ 41] location (exprloc) [ 0] fbreg -48 - [ 5d] variable + [ 5d] variable abbrev: 3 name (string) "fbb" decl_file (data1) 1 decl_line (data1) 10 diff --git a/tests/run-readelf-zdebug-rel.sh b/tests/run-readelf-zdebug-rel.sh index 082971e..93201ae 100755 --- a/tests/run-readelf-zdebug-rel.sh +++ b/tests/run-readelf-zdebug-rel.sh @@ -51,7 +51,7 @@ DWARF section [ 4] '.debug_info' at offset 0x58: [Offset] Compilation unit at offset 0: Version: 4, Abbreviation section offset: 0, Address size: 8, Offset size: 4 - [ b] compile_unit + [ b] compile_unit abbrev: 1 producer (strp) "GNU C11 5.3.1 20151207 (Red Hat 5.3.1-2) -mtune=generic -march=x86-64 -g -Og" language (data1) C99 (12) name (strp) "testfile-zdebug-rel.c" @@ -59,7 +59,7 @@ DWARF section [ 4] '.debug_info' at offset 0x58: low_pc (addr) 000000000000000000 high_pc (data8) 24 (0x0000000000000018) stmt_list (sec_offset) 0 - [ 2d] subprogram + [ 2d] subprogram abbrev: 2 external (flag_present) yes name (strp) "main" decl_file (data1) 1 @@ -72,47 +72,47 @@ DWARF section [ 4] '.debug_info' at offset 0x58: [ 0] call_frame_cfa GNU_all_call_sites (flag_present) yes sibling (ref4) [ 80] - [ 4e] formal_parameter + [ 4e] formal_parameter abbrev: 3 name (strp) "argc" decl_file (data1) 1 decl_line (data1) 4 type (ref4) [ 80] location (sec_offset) location list [ 0] - [ 5d] formal_parameter + [ 5d] formal_parameter abbrev: 4 name (strp) "argv" decl_file (data1) 1 decl_line (data1) 4 type (ref4) [ 87] location (exprloc) [ 0] reg4 - [ 6a] variable + [ 6a] variable abbrev: 5 name (string) "a" decl_file (data1) 1 decl_line (data1) 6 type (ref4) [ 9a] const_value (sdata) -9 - [ 74] variable + [ 74] variable abbrev: 6 name (string) "b" decl_file (data1) 1 decl_line (data1) 7 type (ref4) [ 9a] location (exprloc) [ 0] reg5 - [ 80] base_type + [ 80] base_type abbrev: 7 byte_size (data1) 4 encoding (data1) signed (5) name (string) "int" - [ 87] pointer_type + [ 87] pointer_type abbrev: 8 byte_size (data1) 8 type (ref4) [ 8d] - [ 8d] pointer_type + [ 8d] pointer_type abbrev: 8 byte_size (data1) 8 type (ref4) [ 93] - [ 93] base_type + [ 93] base_type abbrev: 9 byte_size (data1) 1 encoding (data1) signed_char (6) name (strp) "char" - [ 9a] base_type + [ 9a] base_type abbrev: 9 byte_size (data1) 8 encoding (data1) unsigned (7) name (strp) "long unsigned int" -- 1.8.3.1