From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 57149 invoked by alias); 29 Nov 2017 16:06:08 -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 57127 invoked by uid 89); 29 Nov 2017 16:06:07 -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=-5.7 required=5.0 tests=BAYES_00,GIT_PATCH_1,KAM_LAZY_DOMAIN_SECURITY,KB_WAM_FROM_NAME_SINGLEWORD autolearn=ham version=3.3.2 spammy= X-Spam-Status: No, score=-5.7 required=5.0 tests=BAYES_00,GIT_PATCH_1,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:06 +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 7EF0F30007B4 for ; Wed, 29 Nov 2017 17:06:03 +0100 (CET) Received: by tarox.wildebeest.org (Postfix, from userid 1000) id 56C04400E990; Wed, 29 Nov 2017 17:06:03 +0100 (CET) From: Mark Wielaard To: elfutils-devel@sourceware.org Subject: Various eu-readelf --debug-dump improvements Date: Wed, 29 Nov 2017 16:06:00 -0000 Message-Id: <1511971553-30135-1-git-send-email-mark@klomp.org> X-Mailer: git-send-email 1.8.3.1 X-Spam-Flag: NO X-IsSubscribed: yes X-SW-Source: 2017-q4/txt/msg00077.txt.bz2 While working on the DWARF5 support I found various cases where the eu-readelf --debug-dump could be improved to provide a bit more information that helped debug issues. The following changes are not DWARF5 specific, but improve the --debug-dump output to make a more useful (IMHO). [PATCH 1/5] readelf: Adjust print_ops formatting. This simply makes the DWARF expressions a little more compact and the indenting a bit more consistent. In particular it only uses two space for the operand index (the max I found in the wild was 64, so reserving 4 spaces for possibly 9999 indexes seemed excessive. [PATCH 2/5] readelf: Print abbrev code for DIE with --debug-dump=info. This was really convenient when there seemed something wrong with the DIE information. It is also helpful to see how many DIEs share a particular abbrev. The output is now: [ 29] base_type abbrev: 74 byte_size (data1) 8 encoding (data1) unsigned (7) name (strp) "long unsigned int" So you can easily lookup the corresponding abbrev with --debug-dump=abbrev [ 74] offset: 1019, children: no, tag: base_type attr: byte_size, form: data1, offset: 0x3fb attr: encoding, form: data1, offset: 0x3fd attr: name, form: strp, offset: 0x3ff And note that almost all base_types share the same abbrev code. [PATCH 3/5] readelf: Print actual file for decl_file and call_file. This was very helpful to understand where something was really defined. It simply resolves the file number from the stmt list, so you don't have to do that by hand anymore. New output: [ 4c] typedef abbrev: 26 name (strp) "size_t" decl_file (data1) stddef.h (13) decl_line (data1) 216 decl_column (data1) 23 type (ref4) [ 29] [PATCH 4/5] readelf: Print CU, base address and unresolved .debug_ranges. We helpfully resolve the addresses to actual symbol+offsets whenever possible, but this kind of obscured what the actual encoding was. And it made the output a bit messy because addresses didn't line up. It now also prints out the associated CU and the base address to the range list. CU [ 3582e] base: 0x000000000041de70 [ c370] range 2a, 6a 0x000000000041de9a .. 0x000000000041ded9 range 80, e5 0x000000000041def0 .. 0x000000000041df54 range f8, 11a 0x000000000041df68 .. 0x000000000041df89 [ c3b0] range 91, 9f 0x000000000041df01 .. 0x000000000041df0e range a3, a6 0x000000000041df13 .. 0x000000000041df15 [PATCH 5/5] readelf: Print CU, base address and unresolved .debug_loc. Like the .debug_ranges change, but including location list entries. The new output is (IMHO) a big improvement: CU [ 4a404] base: 0x000000000041f350 <__popcountdi2> [ 3c3e2] range 0, 24 0x000000000041f350 <__popcountdi2>.. 0x000000000041f373 <__popcountdi2+0x23> [ 0] reg5 range 24, 2b 0x000000000041f374 <__popcountdi2+0x24>.. 0x000000000041f37a <__popcountdi2+0x2a> [ 0] reg5 range 2b, 2e 0x000000000041f37b <__popcountdi2+0x2b>.. 0x000000000041f37d <__popcountdi2+0x2d> [ 0] reg0 range 2e, 3e 0x000000000041f37e <__popcountdi2+0x2e>.. 0x000000000041f38d <__popcountdi2+0x3d> [ 0] GNU_entry_value: [ 0] reg5 [ 3] GNU_entry_value: [ 0] reg5 [ 6] lit1 [ 7] shr [ 8] constu 6148914691236517205 [18] and [19] minus [20] stack_value range 3e, 48 0x000000000041f38e <__popcountdi2+0x3e>.. 0x000000000041f397 <__popcountdi2+0x47> [ 0] reg5 range 48, 4b 0x000000000041f398 <__popcountdi2+0x48>.. 0x000000000041f39a <__popcountdi2+0x4a> [ 0] breg0 0 [ 2] constu 1085102592571150095 [12] and [13] stack_value range 4b, 59 0x000000000041f39b <__popcountdi2+0x4b>.. 0x000000000041f3a8 <__popcountdi2+0x58> [ 0] reg0 range 59, 5e 0x000000000041f3a9 <__popcountdi2+0x59>.. 0x000000000041f3ad <__popcountdi2+0x5d> [ 0] breg5 0 [ 2] lit4 [ 3] shr [ 4] breg5 0 [ 6] plus [ 7] constu 1085102592571150095 [17] and [18] stack_value