From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gnu.wildebeest.org (wildebeest.demon.nl [212.238.236.112]) by sourceware.org (Postfix) with ESMTPS id 86E7E3861865 for ; Mon, 2 Aug 2021 22:42:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 86E7E3861865 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=klomp.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=klomp.org Received: from tarox.wildebeest.org (83-87-18-245.cable.dynamic.v4.ziggo.nl [83.87.18.245]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by gnu.wildebeest.org (Postfix) with ESMTPSA id 97A8A30291A9; Tue, 3 Aug 2021 00:42:12 +0200 (CEST) Received: by tarox.wildebeest.org (Postfix, from userid 1000) id 4AB0F413CC81; Tue, 3 Aug 2021 00:42:12 +0200 (CEST) From: Mark Wielaard To: debugedit@sourceware.org Cc: Mark Wielaard Subject: [PATCHv2] tests: Handle zero directory entry in .debug_line DWARF5 debugedit.at Date: Tue, 3 Aug 2021 00:42:03 +0200 Message-Id: <20210802224203.12650-1-mark@klomp.org> X-Mailer: git-send-email 2.18.4 In-Reply-To: <20210730163311.6147-1-mark@klomp.org> References: <20210730163311.6147-1-mark@klomp.org> X-Spam-Status: No, score=-10.3 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: debugedit@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: debugedit development mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Aug 2021 22:42:21 -0000 We were skipping the zero directory entry, because it was always the same as the directory entry at position one. But that isn't true anymore with gcc 11.2.1. There the zero dir entry is unique. Fix the debugedit.at .debug_line testcases using DWARF5 to also include dir entry zero. Also add a configure check to make sure -gdwarf-5 also generates version 5 .debug_line tables. Depending on whether binutils gas supports generating version 5 line tables gcc might still generate version 3 line tables even with -gdwarf-5. * configure.ac: Add DWARF_5_DEBUGLINE check * tests/atlocal.in: Add DWARF_5_DEBUGLINE substitution * tests/debugedit.at: skip .debug_line DWARF5 tests if DWARF_5_DEBUGLINE is no. Update tests to include directory zero. Signed-off-by: Mark Wielaard --- configure.ac | 14 ++++++++++++++ tests/atlocal.in | 1 + tests/debugedit.at | 18 ++++++++++++------ 3 files changed, 27 insertions(+), 6 deletions(-) diff --git a/configure.ac b/configure.ac index e5c9230..6a53365 100644 --- a/configure.ac +++ b/configure.ac @@ -87,6 +87,20 @@ CFLAGS="$save_CFLAGS" GDWARF_5_FLAG=$ac_cv_gdwarf_5 AC_SUBST([GDWARF_5_FLAG]) +AC_CACHE_CHECK([whether -gdwarf-5 produced DWARF5 .debug_line], ac_cv_dwarf_5_debugline, [dnl +save_CFLAGS="$CFLAGS" +CFLAGS="-gdwarf-5" +AC_COMPILE_IFELSE([AC_LANG_SOURCE([[int i=0;]],[[/* empty main */]])], + [if $READELF --debug-dump=line conftest.o 2>&1 | \ + grep "DWARF Version:" 2>&1 | grep "5" > /dev/null 2>&1; \ + then ac_cv_dwarf_5_debugline=yes; \ + else ac_cv_dwarf_5_debugline=no; fi], + ac_cv_dwarf_5_debugline=no) +CFLAGS="$save_CFLAGS" +]) +DWARF_5_DEBUGLINE=$ac_cv_dwarf_5_debugline +AC_SUBST([DWARF_5_DEBUGLINE]) + AC_CACHE_CHECK([whether gcc supports -gz=none], ac_cv_gz_none, [dnl save_CFLAGS="$CFLAGS" CFLAGS="-gz=none" diff --git a/tests/atlocal.in b/tests/atlocal.in index 8399f8d..d916301 100644 --- a/tests/atlocal.in +++ b/tests/atlocal.in @@ -13,3 +13,4 @@ READELF="@READELF@" GDWARF_5_FLAG=@GDWARF_5_FLAG@ GZ_NONE_FLAG=@GZ_NONE_FLAG@ +DWARF_5_DEBUGLINE=@DWARF_5_DEBUGLINE@ diff --git a/tests/debugedit.at b/tests/debugedit.at index 0311d26..725e68e 100644 --- a/tests/debugedit.at +++ b/tests/debugedit.at @@ -488,10 +488,12 @@ AT_CLEANUP AT_SETUP([debugedit .debug_line objects DWARF5]) AT_KEYWORDS([debuginfo] [debugedit]) AT_SKIP_IF([test "$GDWARF_5_FLAG" = "no"]) +AT_SKIP_IF([test "$DWARF_5_DEBUGLINE" = "no"]) DEBUGEDIT_SETUP([-gdwarf-5]) AT_DATA([expout], [foo/bar/baz +foo/bar/baz/subdir_bar foo/bar/baz/subdir_headers ]) @@ -500,8 +502,8 @@ AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./subdir_bar/bar.o]]) AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./baz.o]]) AT_CHECK([[ $READELF --debug-dump=line foo.o subdir_bar/bar.o baz.o \ - | grep -A5 "The Directory Table" | grep "^ [123]" \ - | cut -f2- -d/ | grep ^foo/ | sort + | grep -A5 "The Directory Table" | grep "^ [0123]" \ + | cut -f2- -d/ | grep ^foo/ | sort -u ]],[0],[expout]) AT_CLEANUP @@ -535,18 +537,20 @@ AT_CLEANUP AT_SETUP([debugedit .debug_line partial DWARF5]) AT_KEYWORDS([debuginfo] [debugedit]) AT_SKIP_IF([test "$GDWARF_5_FLAG" = "no"]) +AT_SKIP_IF([test "$DWARF_5_DEBUGLINE" = "no"]) DEBUGEDIT_SETUP([-gdwarf-5]) AT_DATA([expout], [foo/bar/baz +foo/bar/baz/subdir_bar foo/bar/baz/subdir_headers ]) AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./foobarbaz.part.o]]) AT_CHECK([[ $READELF --debug-dump=line ./foobarbaz.part.o \ - | grep -A5 "The Directory Table" | grep "^ [123]" \ - | cut -f2- -d/ | grep ^foo/ | sort + | grep -A5 "The Directory Table" | grep "^ [0123]" \ + | cut -f2- -d/ | grep ^foo/ | sort -u ]],[0],[expout]) AT_CLEANUP @@ -580,18 +584,20 @@ AT_CLEANUP AT_SETUP([debugedit .debug_line exe DWARF5]) AT_KEYWORDS([debuginfo] [debugedit]) AT_SKIP_IF([test "$GDWARF_5_FLAG" = "no"]) +AT_SKIP_IF([test "$DWARF_5_DEBUGLINE" = "no"]) DEBUGEDIT_SETUP([-gdwarf-5]) AT_DATA([expout], [foo/bar/baz +foo/bar/baz/subdir_bar foo/bar/baz/subdir_headers ]) AT_CHECK([[debugedit -b $(pwd) -d /foo/bar/baz ./foobarbaz.exe]]) AT_CHECK([[ $READELF --debug-dump=line ./foobarbaz.exe \ - | grep -A5 "The Directory Table" | grep "^ [123]" \ - | cut -f2- -d/ | grep ^foo/ | sort + | grep -A5 "The Directory Table" | grep "^ [0123]" \ + | cut -f2- -d/ | grep ^foo/ | sort -u ]],[0],[expout]) AT_CLEANUP -- 2.18.4