From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31528 invoked by alias); 16 Apr 2018 09:56:13 -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 27684 invoked by uid 89); 16 Apr 2018 09:55:49 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Checked: by ClamAV 0.99.4 on sourceware.org X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_PASS autolearn=ham version=3.3.2 spammy=di, col, bh, Statement X-Spam-Status: No, score=-26.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_PASS 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; Mon, 16 Apr 2018 09:55:46 +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 E7CAE302BB23; Mon, 16 Apr 2018 11:55:43 +0200 (CEST) Received: by tarox.wildebeest.org (Postfix, from userid 1000) id BF752413CEBB; Mon, 16 Apr 2018 11:55:43 +0200 (CEST) From: Mark Wielaard To: elfutils-devel@sourceware.org Cc: Mark Wielaard Subject: [COMMITTED] tests: Test readelf --debug-dump=[decoded]line with min_inst_len > 1. Date: Mon, 16 Apr 2018 09:56:00 -0000 Message-Id: <1523872541-22837-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: 2018-q2/txt/msg00012.txt.bz2 This testcase tests the fix for the readelf --debug-dump=line bug fixed in commit 40b1f18 "readelf: Fix advance_pc to use op_addr_advance, not just op_advance." This tests both the --debug-dump=line (readelf) implementation and the --debug-dump=decodedline (libdw) implementation. The first fails without the bug fix. The second was already correct. Signed-off-by: Mark Wielaard --- tests/ChangeLog | 6 +++ tests/Makefile.am | 1 + tests/run-readelf-line.sh | 89 +++++++++++++++++++++++++++++++++++++ tests/testfile-ppc64-min-instr.bz2 | Bin 0 -> 3106 bytes 4 files changed, 96 insertions(+) create mode 100755 tests/testfile-ppc64-min-instr.bz2 diff --git a/tests/ChangeLog b/tests/ChangeLog index c9403fb..27e5bd8 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,3 +1,9 @@ +2018-04-16 Mark Wielaard + + * testfile-ppc64-min-instr.bz2: New testfile. + * run-readelf-line.sh: Run against testfile-ppc64-min-instr.bz2. + * Makefile.am (EXTRA_DIST): Add testfile-ppc64-min-instr.bz2. + 2018-04-11 Mark Wielaard * run-addrcfi.sh: Adjust expected rule for aarch64 sp. diff --git a/tests/Makefile.am b/tests/Makefile.am index a8cc2df..16abfb0 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -230,6 +230,7 @@ EXTRA_DIST = run-arextract.sh run-arsymtest.sh run-ar.sh \ run-readelf-macro.sh testfilemacro.bz2 \ run-readelf-loc.sh testfileloc.bz2 \ run-readelf-aranges.sh run-readelf-line.sh testfilefoobarbaz.bz2 \ + testfile-ppc64-min-instr.bz2 \ run-readelf-z.sh \ run-readelf-dwz-multi.sh libtestfile_multi_shared.so.bz2 \ testfile_multi.dwz.bz2 testfile_multi_main.bz2 \ diff --git a/tests/run-readelf-line.sh b/tests/run-readelf-line.sh index 32bcf9d..f93bf47 100755 --- a/tests/run-readelf-line.sh +++ b/tests/run-readelf-line.sh @@ -256,4 +256,93 @@ DWARF section [30] '.debug_line' at offset 0x15f6: EOF +# A .debug_line table with mininum instruction length > 1. +# +# = hello.c +# #include +# +# int +# main (int argc, char **argv) +# { +# printf ("Hello, %s\n", (argc > 0 +# ? argv[1]: "World")); +# return 0; +# } +# +# clang version 5.0.1 (tags/RELEASE_501/final) +# Target: powerpc64-unknown-linux-gnu +# clang -g -O2 -o testfile-ppc64-min-instr hello.c +testfiles testfile-ppc64-min-instr + +testrun_compare ${abs_top_builddir}/src/readelf --debug-dump=line testfile-ppc64-min-instr <<\EOF + +DWARF section [29] '.debug_line' at offset 0xdf6: + +Table at offset 0: + + Length: 69 + DWARF version: 2 + Prologue length: 30 + Minimum instruction length: 4 + Maximum operations per instruction: 1 + Initial value if 'is_stmt': 1 + Line base: -5 + Line range: 14 + Opcode base: 13 + +Opcodes: + [ 1] 0 arguments + [ 2] 1 argument + [ 3] 1 argument + [ 4] 1 argument + [ 5] 1 argument + [ 6] 0 arguments + [ 7] 0 arguments + [ 8] 0 arguments + [ 9] 1 argument + [10] 0 arguments + [11] 0 arguments + [12] 1 argument + +Directory table: + +File name table: + Entry Dir Time Size Name + 1 0 0 0 hello.c + +Line number statements: + [ 28] extended opcode 2: set address to 0x100005a4
+ [ 33] special opcode 22: address+0 = 0x100005a4
, line+4 = 5 + [ 34] set column to 27 + [ 36] set prologue end flag + [ 37] special opcode 19: address+0 = 0x100005a4
, line+1 = 6 + [ 38] set column to 8 + [ 3a] special opcode 47: address+8 = 0x100005ac , line+1 = 7 + [ 3b] set 'is_stmt' to 0 + [ 3c] advance line by constant -7 to 0 + [ 3e] special opcode 32: address+4 = 0x100005b0 , line+0 = 0 + [ 3f] set column to 3 + [ 41] set 'is_stmt' to 1 + [ 42] special opcode 108: address+24 = 0x100005c8 , line+6 = 6 + [ 43] special opcode 76: address+16 = 0x100005d8 , line+2 = 8 + [ 44] advance address by 32 to 0x100005f8 + [ 46] extended opcode 1: end of sequence +EOF + +testrun_compare ${abs_top_builddir}/src/readelf --debug-dump=decodedline testfile-ppc64-min-instr <<\EOF + +DWARF section [29] '.debug_line' at offset 0xdf6: + + CU [b] hello.c + line:col SBPE* disc isa op address (Statement Block Prologue Epilogue *End) + /home/fedora/mjw/hello.c (mtime: 0, length: 0) + 5:0 S 0 0 0 0x00000000100005a4
+ 6:27 S P 0 0 0 0x00000000100005a4
+ 7:8 S 0 0 0 0x00000000100005ac + 0:8 0 0 0 0x00000000100005b0 + 6:3 S 0 0 0 0x00000000100005c8 + 8:3 S 0 0 0 0x00000000100005d8 + 8:3 S * 0 0 0 0x00000000100005f7 + +EOF exit 0 diff --git a/tests/testfile-ppc64-min-instr.bz2 b/tests/testfile-ppc64-min-instr.bz2 new file mode 100755 index 0000000000000000000000000000000000000000..85bef57be5819daecec07592b3e5044c4ef4953f GIT binary patch literal 3106 zcmV+-4BhiWT4*^jL0KkKS;;**`~VC1fB*mg|NsC0|NZ~(|Mma>-~aw?{(tr1M_2Y_ z?O*@-Yfs<`eY6n!%fgerx`=_>Z0ij7b<`@Un=?3QgwZF6o`PwV#MJbkqD_+^(UIth z;7?TjO;6Q5Of-)u%_r(@Bh(sbBh+msfMjN-)CM5Qpvb_QGb2zm7=Xk9q7Vs!n+Y;{ z6AeVhrV@EglPJlM(?G%-Q$TqkqeIjKK+ruv05s4527np>000Jus0ON^lT#$xrZqh# z(3vuAO)#58WXXiWVrbJQ3FT^PHBTm^ z(@j&&MD&>qK+&hD4^g4D8fa)~pa2;F0MHo*LqVVb00001pa1{>G!OtZ$O9u0k)Qz3 z1160$4FCWD00x6hjEw*q4K!$C00u)qXlNP$(U1THiV%%Psp;vcW<&^W4MR;dWC5q7 z28|kejj5sPG#Y3Dqd>@M>M{nJ15AK4(?);*)6@WH00Ff$_%#${Dx(eoR(}>E)ue&SXnE`*qwRuClYU#^#@EMkm^L1CL~#`lkGyULCsX*I1IhRFO6NQ0+s^vM<%{p{4#;;@ksW5^?L7?cBA*dXmip*XP}EdD4d0F? zFACF#yTjkV*Y+(gb0Qo$x$2(ySID)l=i7i^eCpUwrM!*@< zf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