diff options
| author | Roland McGrath <[email protected]> | 2009-07-03 13:31:24 -0700 |
|---|---|---|
| committer | Roland McGrath <[email protected]> | 2009-07-03 13:31:24 -0700 |
| commit | 92630c663ec280af1b1d854cc5c0ce58955bb965 (patch) | |
| tree | 55df412a91f09c17ea6bc443854c63f974df852c /tests | |
| parent | 0451d0665372bc60e0d9dc5e20cfccf584e4e0dc (diff) | |
C++ warning fiddles. Let dwarf-print/dwarf_edit test copy constructors.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/ChangeLog | 6 | ||||
| -rw-r--r-- | tests/Makefile.am | 2 | ||||
| -rw-r--r-- | tests/print-die.hh | 47 |
3 files changed, 52 insertions, 3 deletions
diff --git a/tests/ChangeLog b/tests/ChangeLog index d7c99a18..af678b69 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,3 +1,9 @@ +2009-07-03 Roland McGrath <[email protected]> + + * Makefile.am (AM_CXXFLAGS): New variable (from ../src/Makefile.am). + + * print-die.hh: Grok --edit/--output options to print a copied object. + 2009-07-02 Roland McGrath <[email protected]> * run-dwarf_edit.sh: New file. diff --git a/tests/Makefile.am b/tests/Makefile.am index 41cd9f32..98fa96e9 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -35,6 +35,8 @@ AM_CFLAGS = -Wall -Werror -Wextra -std=gnu99 \ BUILT_RPATH = \$$ORIGIN/../libasm:\$$ORIGIN/../libdw:\$$ORIGIN/../backends:\$$ORIGIN/../libelf endif +AM_CXXFLAGS = $(AM_CFLAGS:gnu99=gnu++0x) + AM_LDFLAGS = if !STANDALONE diff --git a/tests/print-die.hh b/tests/print-die.hh index 3f4cd9d2..29e000c7 100644 --- a/tests/print-die.hh +++ b/tests/print-die.hh @@ -25,14 +25,20 @@ #include <cstring> #include <cstdio> +#include <cstdlib> #include <clocale> #include <libintl.h> #include <ostream> #include <iomanip> #include <tr1/unordered_map> +#include "c++/dwarf_edit" +#include "c++/dwarf_output" + static bool print_offset; +static enum { copy_none, copy_edit, copy_output } make_copy; + static void print_die_main (int &argc, char **&argv, unsigned int &depth) { @@ -54,6 +60,19 @@ print_die_main (int &argc, char **&argv, unsigned int &depth) ++argv; } + if (argc > 1 && !strcmp (argv[1], "--edit")) + { + make_copy = copy_edit; + --argc; + ++argv; + } + else if (argc > 1 && !strcmp (argv[1], "--output")) + { + make_copy = copy_output; + --argc; + ++argv; + } + depth = 0; if (argc > 1 && sscanf (argv[1], "--depth=%u", &depth) == 1) { @@ -154,11 +173,33 @@ print_cu (const typename file::compile_unit &cu, const unsigned int limit) template<typename file> static void -print_file (const char *name, const file &dw, const unsigned int limit) +print_file (const file &dw, const unsigned int limit) { - cout << name << ":\n"; - for (typename file::compile_units::const_iterator i = dw.compile_units ().begin (); i != dw.compile_units ().end (); ++i) print_cu<file> (*i, limit); } + +template<typename file> +static void +print_file (const char *name, const file &dw, const unsigned int limit) +{ + cout << name << ":\n"; + + switch (make_copy) + { + case copy_none: + print_file (dw, limit); + break; + case copy_edit: + print_file (dwarf_edit (dw), limit); + break; +#if 0 // XXX + case copy_output: + print_file (dwarf_output (dw), limit); + break; +#endif + default: + abort (); + } +} |
