summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorRoland McGrath <[email protected]>2009-08-25 23:48:41 -0700
committerRoland McGrath <[email protected]>2009-08-25 23:48:41 -0700
commita24b20783cd22a690c9f05a19a334f5baae7b19c (patch)
treea1e4e97ae649756e8e5abf0dc1b583acfc6f1a2e /tests
parentd9de00a95a6bdeed5a432c4cf045f191c75fa87b (diff)
Share print-die compilation among tests.
Diffstat (limited to 'tests')
-rw-r--r--tests/ChangeLog6
-rw-r--r--tests/Makefile.am4
-rw-r--r--tests/dwarf-print.cc1
-rw-r--r--tests/print-die.cc (renamed from tests/print-die.hh)17
4 files changed, 24 insertions, 4 deletions
diff --git a/tests/ChangeLog b/tests/ChangeLog
index 3a81522a..8f7e9dc2 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,3 +1,9 @@
+2009-08-25 Roland McGrath <[email protected]>
+
+ * print-die.hh: New file with extern decls. Contents moved to ...
+ * print-die.cc: ... here, new file.
+ * Makefile.am (dwarf_print_SOURCES, dwarf_edit_SOURCES): Build it.
+
2009-08-21 Roland McGrath <[email protected]>
* print-die.hh (print_die_main, print_file): Add --silent option.
diff --git a/tests/Makefile.am b/tests/Makefile.am
index b0da862c..ad5a466d 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -195,10 +195,10 @@ endif !STANDALONE
# XXX later the C++ stuff will be in libdw.so directly
libdwpp = ../libdw/libdwpp.a $(libdw)
-dwarf_print_SOURCES = dwarf-print.cc
+dwarf_print_SOURCES = dwarf-print.cc print-die.cc
dwarf_print_LDADD = $(libdwpp) $(libmudflap) -ldl
-dwarf_edit_SOURCES = dwarf_edit.cc
+dwarf_edit_SOURCES = dwarf_edit.cc print-die.cc
dwarf_edit_LDADD = $(libdwpp) $(libmudflap) -ldl
arextract_LDADD = $(libelf) $(libmudflap)
diff --git a/tests/dwarf-print.cc b/tests/dwarf-print.cc
index 36b9415b..698dd0da 100644
--- a/tests/dwarf-print.cc
+++ b/tests/dwarf-print.cc
@@ -30,6 +30,7 @@
#include <errno.h>
#include <error.h>
#include <fcntl.h>
+#include <libintl.h>
#include "c++/dwarf"
diff --git a/tests/print-die.hh b/tests/print-die.cc
index 76f160b4..728eb74a 100644
--- a/tests/print-die.hh
+++ b/tests/print-die.cc
@@ -23,6 +23,10 @@
Network licensing program, please visit www.openinventionnetwork.com
<http://www.openinventionnetwork.com>. */
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
#include <cstring>
#include <cstdio>
#include <cstdlib>
@@ -37,6 +41,9 @@
#include "c++/dwarf_edit"
#include "c++/dwarf_output"
+using namespace elfutils;
+using namespace std;
+
static bool print_offset;
static bool sort_attrs;
static bool elide_refs;
@@ -45,7 +52,7 @@ static bool no_print;
static enum { copy_none, copy_edit, copy_output } make_copy;
-static void
+void
print_die_main (int &argc, char **&argv, unsigned int &depth)
{
/* Set locale. */
@@ -291,7 +298,7 @@ print_file (const file &dw, const unsigned int limit)
}
template<typename file>
-static void
+void
print_file (const char *name, const file &dw, const unsigned int limit)
{
cout << name << ":\n";
@@ -314,3 +321,9 @@ print_file (const char *name, const file &dw, const unsigned int limit)
abort ();
}
}
+
+// Explicit instantiations.
+template void print_file (const char *, const dwarf &,
+ const unsigned int);
+template void print_file (const char *, const dwarf_edit &,
+ const unsigned int);