diff options
author | Roland McGrath <roland@redhat.com> | 2009-07-02 01:25:21 -0700 |
---|---|---|
committer | Roland McGrath <roland@redhat.com> | 2009-07-02 01:28:25 -0700 |
commit | 958163ed53b227c7dbbe210fc1ae7c28fc112a42 (patch) | |
tree | 87aed7a02a1cef11eec3466b097c4934bba5d9e0 | |
parent | 474fa6ca74501f97ff77fdd792ef5b1c42fd6e54 (diff) | |
download | elfutils-958163ed53b227c7dbbe210fc1ae7c28fc112a42.tar.gz |
pretty up tests
-rw-r--r-- | tests/ChangeLog | 3 | ||||
-rw-r--r-- | tests/Makefile.am | 4 | ||||
-rw-r--r-- | tests/dwarf-print.cc | 5 | ||||
-rw-r--r-- | tests/dwarf_edit.cc | 9 | ||||
-rw-r--r-- | tests/print-die.hh | 44 | ||||
-rwxr-xr-x | tests/run-dwarf-attributes.sh | 2 |
6 files changed, 48 insertions, 19 deletions
diff --git a/tests/ChangeLog b/tests/ChangeLog index cf956c61..d7c99a18 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,7 +1,8 @@ 2009-07-02 Roland McGrath <roland@redhat.com> + * run-dwarf_edit.sh: New file. * dwarf_edit.cc: New file. - * Makefile.am (noinst_PROGRAMS, TESTS): Add it. + * Makefile.am (noinst_PROGRAMS, TESTS, EXTRA_DIST): Add them. (dwarf_edit_SOURCES, dwarf_edit_LDADD): New variables. * dwarf-print.cc (print_die): Templatify and move ... diff --git a/tests/Makefile.am b/tests/Makefile.am index ddd5de7d..41cd9f32 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -91,7 +91,7 @@ TESTS = run-arextract.sh run-arsymtest.sh newfile test-nlist \ run-disasm-x86.sh run-disasm-x86-64.sh \ run-early-offscn.sh run-dwarf-getmacros.sh \ run-dwarfcmp-self.sh run-dwarflint-self.sh run-dwarf-attributes.sh \ - dwarf_edit + run-dwarf_edit.sh # run-show-ciefde.sh if !STANDALONE @@ -126,7 +126,7 @@ EXTRA_DIST = run-arextract.sh run-arsymtest.sh \ run-dwfl-addr-sect.sh run-early-offscn.sh \ run-dwarf-getmacros.sh \ run-dwarfcmp-self.sh run-dwarflint-self.sh \ - run-dwarf-attributes.sh \ + run-dwarf-attributes.sh run-dwarf_edit.sh \ testfile15.bz2 testfile15.debug.bz2 \ testfile16.bz2 testfile16.debug.bz2 \ testfile17.bz2 testfile17.debug.bz2 \ diff --git a/tests/dwarf-print.cc b/tests/dwarf-print.cc index 8d09ba15..36b9415b 100644 --- a/tests/dwarf-print.cc +++ b/tests/dwarf-print.cc @@ -30,11 +30,6 @@ #include <errno.h> #include <error.h> #include <fcntl.h> -#include <clocale> -#include <cstdio> -#include <libintl.h> -#include <ostream> -#include <iomanip> #include "c++/dwarf" diff --git a/tests/dwarf_edit.cc b/tests/dwarf_edit.cc index 35e6b1c2..5510be1c 100644 --- a/tests/dwarf_edit.cc +++ b/tests/dwarf_edit.cc @@ -27,15 +27,6 @@ # include <config.h> #endif -#include <errno.h> -#include <error.h> -#include <fcntl.h> -#include <clocale> -#include <cstdio> -#include <libintl.h> -#include <ostream> -#include <iomanip> - #include "c++/dwarf_edit" using namespace elfutils; diff --git a/tests/print-die.hh b/tests/print-die.hh index c4ff8a25..91d70c99 100644 --- a/tests/print-die.hh +++ b/tests/print-die.hh @@ -1,3 +1,36 @@ +/* Pseudo-XMLish printing for elfutils::dwarf* tests. + Copyright (C) 2009 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by the + Free Software Foundation; version 2 of the License. + + Red Hat elfutils is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License along + with Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#include <cstring> +#include <cstdio> +#include <clocale> +#include <libintl.h> +#include <ostream> +#include <iomanip> + +static bool print_offset; static void print_die_main (int &argc, char **&argv, unsigned int &depth) @@ -13,6 +46,13 @@ print_die_main (int &argc, char **&argv, unsigned int &depth) cout << hex << setiosflags (ios::showbase); + if (argc > 1 && !strcmp (argv[1], "--offsets")) + { + print_offset = true; + --argc; + ++argv; + } + depth = 0; if (argc > 1 && sscanf (argv[1], "--depth=%u", &depth) == 1) { @@ -29,7 +69,9 @@ print_die (const typename file::debug_info_entry &die, string prefix (indent, ' '); const string tag = dwarf::tags::name (die.tag ()); - cout << prefix << "<" << tag << " offset=[" << die.offset () << "]"; + cout << prefix << "<" << tag; + if (print_offset) + cout << " offset=[" << die.offset () << "]"; for (typename file::debug_info_entry::attributes_type::const_iterator i = die.attributes ().begin (); i != die.attributes ().end (); ++i) diff --git a/tests/run-dwarf-attributes.sh b/tests/run-dwarf-attributes.sh index 22c7289d..4aa170ba 100755 --- a/tests/run-dwarf-attributes.sh +++ b/tests/run-dwarf-attributes.sh @@ -27,7 +27,7 @@ testfiles testfile -testrun_compare ./dwarf-print --depth=1 testfile <<\EOF +testrun_compare ./dwarf-print --offsets --depth=1 testfile <<\EOF testfile: <compile_unit offset=[0xb] stmt_list=0 high_pc=0x804845a low_pc=0x804842c name="m.c" comp_dir="/home/drepper/gnu/new-bu/build/ttt" producer="GNU C 2.96 20000731 (Red Hat Linux 7.0)" language=C89>... <compile_unit offset=[0xca] stmt_list=0x4b high_pc=0x8048466 low_pc=0x804845c name="b.c" comp_dir="/home/drepper/gnu/new-bu/build/ttt" producer="GNU C 2.96 20000731 (Red Hat Linux 7.0)" language=C89>... |