mirror of
https://github.com/openharmony/third_party_elfutils.git
synced 2026-07-16 07:44:26 -04:00
tests: Run run-low_high_pc.sh testcase on split dwarf files.
Test that the low high pc attributes can be properly resolved also in split dwarf setups. Signed-off-by: Mark Wielaard <mark@klomp.org>
This commit is contained in:
@@ -1,3 +1,12 @@
|
||||
2018-05-31 Mark Wielaard <mark@klomp.org>
|
||||
|
||||
* 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 <mark@klomp.org>
|
||||
|
||||
* get-units-invalid.c (main): Check dwarf_cuoffset and
|
||||
|
||||
+26
-2
@@ -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, "<no name>", "die without a name");
|
||||
name = "<no 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) ?: "<unknown>";
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user