From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 105502 invoked by alias); 31 May 2018 12:16:55 -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 105344 invoked by uid 89); 31 May 2018 12:16:54 -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,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy= 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,RCVD_IN_DNSWL_NONE,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; Thu, 31 May 2018 12:16:52 +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 EF00430008B4; Thu, 31 May 2018 14:16:49 +0200 (CEST) Received: by tarox.wildebeest.org (Postfix, from userid 1000) id C40CB40B9DED; Thu, 31 May 2018 14:16:49 +0200 (CEST) From: Mark Wielaard To: elfutils-devel@sourceware.org Cc: Mark Wielaard Subject: [PATCH] tests: Run run-low_high_pc.sh testcase on split dwarf files. Date: Thu, 31 May 2018 12:16:00 -0000 Message-Id: <1527769007-8409-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/msg00122.txt.bz2 Test that the low high pc attributes can be properly resolved also in split dwarf setups. Signed-off-by: Mark Wielaard --- tests/ChangeLog | 9 +++++++++ tests/low_high_pc.c | 28 ++++++++++++++++++++++++++-- tests/run-low_high_pc.sh | 15 +++++++++++---- 3 files changed, 46 insertions(+), 6 deletions(-) diff --git a/tests/ChangeLog b/tests/ChangeLog index 521df52..c03db54 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,5 +1,14 @@ 2018-05-31 Mark Wielaard + * low_high_pc.c (handle_die): Handle NULL name. Print offset and + name of die. + (main): Check if the cu DIE is a skeleton, then get and handle + the split subdie. + * run-low-high-pc.sh: Run on testfile-splitdwarf-4 and + testfile-splitdwarf-5. Run on all selftest files. + +2018-05-31 Mark Wielaard + * get-units-invalid.c (main): Check dwarf_cuoffset and dwarf_dieoffset. diff --git a/tests/low_high_pc.c b/tests/low_high_pc.c index d0f4302..5c6b343 100644 --- a/tests/low_high_pc.c +++ b/tests/low_high_pc.c @@ -1,5 +1,5 @@ /* Test program for dwarf_lowpc and dwarf_highpc - Copyright (C) 2012 Red Hat, Inc. + Copyright (C) 2012, 2018 Red Hat, Inc. This file is part of elfutils. This file is free software; you can redistribute it and/or modify @@ -55,7 +55,9 @@ handle_die (Dwarf_Die *die, void *arg) const char *name = dwarf_diename (die); if (name == NULL) - fail (off, "", "die without a name"); + name = ""; + + printf ("[%" PRIx64 "] %s\n", off, name); Dwarf_Addr lowpc = 0; Dwarf_Addr highpc = 0; @@ -101,9 +103,31 @@ main (int argc, char *argv[]) a.file = dwarf_diename (a.cu); handle_die (a.cu, &a); dwarf_getfuncs (a.cu, &handle_die, &a, 0); + + uint8_t unit_type; + Dwarf_Die subdie; + if (dwarf_cu_info (a.cu->cu, NULL, &unit_type, NULL, &subdie, + NULL, NULL, NULL) != 0) + { + Dwarf_Off off = dwarf_dieoffset (a.cu); + fail (off, "dwarf_cu_info", dwarf_errmsg (-1)); + } + + if (unit_type == DW_UT_skeleton) + { + const char *name = dwarf_diename (&subdie) ?: ""; + printf ("Following split subdie: %s\n", name); + struct args b = a; + b.cu = &subdie; + handle_die (b.cu, &b); + dwarf_getfuncs (b.cu, &handle_die, &b, 0); + printf ("Done subdie: %s\n", name); + } } dwfl_end (a.dwfl); + printf ("\n"); + return result; } diff --git a/tests/run-low_high_pc.sh b/tests/run-low_high_pc.sh index ab5f2c3..41ec420 100755 --- a/tests/run-low_high_pc.sh +++ b/tests/run-low_high_pc.sh @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 2005 Red Hat, Inc. +# Copyright (C) 2005, 2018 Red Hat, Inc. # This file is part of elfutils. # # This file is free software; you can redistribute it and/or modify @@ -27,8 +27,15 @@ testfiles testfile_low_high_pc testrun ${abs_builddir}/low_high_pc -e ./testfile_low_high_pc testrun ${abs_builddir}/low_high_pc -e ${abs_builddir}/low_high_pc -testrun ${abs_builddir}/low_high_pc -e ${abs_top_builddir}/src/strip -testrun ${abs_builddir}/low_high_pc -e ${abs_top_builddir}/src/strip.o -testrun ${abs_builddir}/low_high_pc -e ${abs_top_builddir}/libelf/libelf.so + +# see tests/testfile-dwarf-45.source +testfiles testfile-splitdwarf-4 testfile-splitdwarf-5 +testfiles testfile-hello4.dwo testfile-hello5.dwo +testfiles testfile-world4.dwo testfile-world5.dwo + +testrun ${abs_builddir}/low_high_pc -e testfile-splitdwarf-4 +testrun ${abs_builddir}/low_high_pc -e testfile-splitdwarf-5 + +testrun_on_self ${abs_builddir}/low_high_pc -e exit 0 -- 1.8.3.1