diff options
| author | Mark Wielaard <mark@klomp.org> | 2018-05-31 14:00:27 +0200 |
|---|---|---|
| committer | Mark Wielaard <mark@klomp.org> | 2018-06-01 13:14:39 +0200 |
| commit | 60d2bfc2ea7250de8e02ef02cae761821dd53de2 (patch) | |
| tree | db93f1ecfd4ff2c69d317025614ec8559015ac52 /tests/low_high_pc.c | |
| parent | 3a5bbc919873fc8adee7345dd7dec585eb4d2547 (diff) | |
| download | platform_external_elfutils-60d2bfc2ea7250de8e02ef02cae761821dd53de2.tar.gz platform_external_elfutils-60d2bfc2ea7250de8e02ef02cae761821dd53de2.tar.bz2 platform_external_elfutils-60d2bfc2ea7250de8e02ef02cae761821dd53de2.zip | |
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>
Diffstat (limited to 'tests/low_high_pc.c')
| -rw-r--r-- | tests/low_high_pc.c | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/tests/low_high_pc.c b/tests/low_high_pc.c index d0f43023..5c6b343c 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, "<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; } |
