2009-07-03 Roland McGrath <roland@redhat.com>
+ * Makefile.am (AM_CXXFLAGS): New variable (from ../src/Makefile.am).
+
* c++/dwarf: Fix range_list canonicalizing comparisons.
* c++/dwarf_edit: Fix copy construction using a ref-maker.
INCLUDES = -I. -I$(srcdir) -I$(srcdir)/../libelf -I.. -I$(srcdir)/../lib
VERSION = 1
+AM_CXXFLAGS = $(AM_CFLAGS:gnu99=gnu++0x)
+
COMPILE.os = $(filter-out -fprofile-arcs, $(filter-out -ftest-coverage, \
$(COMPILE)))
template<typename pair>
struct any : public std::unary_function<pair, bool>
{
- inline bool operator () (const pair &x)
+ inline bool operator () (const pair &)
{
return true;
}
// This object is created to start a walk and destroyed to finish one.
struct walk
{
- inline walk (dwarf_tracker_base *, const cu1 &a, const cu2 &b)
+ inline walk (dwarf_tracker_base *, const cu1 &, const cu2 &)
{
}
inline ~walk ()
// This object is created in pre-order and destroyed in post-order.
struct step
{
- inline step (dwarf_tracker_base *, const die1 &a, const die2 &b)
+ inline step (dwarf_tracker_base *, const die1 &, const die2 &)
{
}
inline ~step ()
}
};
- inline void visit (const typename dwarf1::debug_info_entry &a,
- const typename dwarf2::debug_info_entry &b)
+ inline void visit (const typename dwarf1::debug_info_entry &,
+ const typename dwarf2::debug_info_entry &)
{
}
- inline void mismatch (const cu1 &it1, const cu1 &end1,
- const cu2 &it2, const cu2 &end2)
+ inline void mismatch (const cu1 &, const cu1 &, // at, end
+ const cu2 &, const cu2 &)
{
}
- inline void mismatch (const die1 &it1, const die1 &end1,
- const die2 &it2, const die2 &end2)
+ inline void mismatch (const die1 &, const die1 &, // at, end
+ const die2 &, const die2 &)
{
}
- inline void mismatch (const attr1 &it1, const attr1 &end1,
- const attr2 &it2, const attr2 &end2)
+ inline void mismatch (const attr1 &, const attr1 &, // at, end
+ const attr2 &, const attr2 &)
{
}
struct right_context_type {};
// Return the lhs context of an arbitrary DIE.
- inline const left_context_type left_context (const die1 &die)
+ inline const left_context_type left_context (const die1 &)
{
return left_context_type ();
}
// Return the rhs context of an arbitrary DIE.
- inline const right_context_type right_context (const die2 &die)
+ inline const right_context_type right_context (const die2 &)
{
return right_context_type ();
}
- inline bool context_quick_mismatch (const left_context_type &a,
- const right_context_type &b)
+ inline bool context_quick_mismatch (const left_context_type &,
+ const right_context_type &)
{
return true;
}
- inline bool context_match (const left_context_type &a,
- const right_context_type &b)
+ inline bool context_match (const left_context_type &,
+ const right_context_type &)
{
return false;
}
#define _ELFUTILS_DWARF_DATA 1
#include "dwarf"
+#include <cassert>
#include <bitset>
-#include <typeinfo>
/* This contains common classes/templates used by dwarf_output and dwarf_edit.
inline value_string () {}
template<typename string, typename arg_type>
- inline value_string (const string &s, arg_type &arg)
+ inline value_string (const string &s, arg_type &)
: std::string (s)
{}
{}
template<typename arg_type>
- inline value_flag (bool t, arg_type &arg)
+ inline value_flag (bool t, arg_type &)
: flag (t)
{}
};
{}
template<typename arg_type>
- inline value_address (::Dwarf_Addr x, arg_type &arg)
+ inline value_address (::Dwarf_Addr x, arg_type &)
: addr (x)
{}
};
inline value_rangelistptr () {}
template<typename list, typename arg_type>
- inline value_rangelistptr (const list &other, arg_type &arg)
+ inline value_rangelistptr (const list &other, arg_type &)
: range_list (other)
{}
};
inline value_lineptr () {}
template<typename table, typename arg_type>
- inline value_lineptr (const table &other, arg_type &arg)
+ inline value_lineptr (const table &other, arg_type &)
: impl::line_info_table (other)
{}
};
{}
template<typename arg_type>
- inline value_constant (::Dwarf_Word x, arg_type &arg)
+ inline value_constant (::Dwarf_Word x, arg_type &)
: word (x)
{}
};
inline value_constant_block () {}
template<typename block, typename arg_type>
- inline value_constant_block (const block &b, arg_type &arg)
+ inline value_constant_block (const block &b, arg_type &)
: std::vector<uint8_t> (b.begin (), b.end ())
{}
};
inline value_dwarf_constant () {}
template<typename constant, typename arg_type>
- inline value_dwarf_constant (const constant &other, arg_type &arg)
+ inline value_dwarf_constant (const constant &other, arg_type &)
: dwarf_enum (other)
{}
};
inline value_source_file () {}
template<typename file, typename arg_type>
- inline value_source_file (const file &other, arg_type &arg)
+ inline value_source_file (const file &other, arg_type &)
: source_file (other)
{}
};
{}
template<typename arg_type>
- inline value_source_line (unsigned int m, arg_type &arg)
+ inline value_source_line (unsigned int m, arg_type &)
: n (m)
{}
};
inline value_location () {}
template<typename loc, typename arg_type>
- inline value_location (const loc &other, arg_type &arg)
+ inline value_location (const loc &other, arg_type &)
: location_attr (other)
{}
};
#include "dwarf_data"
#include "dwarf_ref_maker"
+#include <type_traits>
+
+
/* Read the comments for elfutils::dwarf first.
The elfutils::dwarf_edit class is template-compatible with the logical
template<typename die_type, typename arg_type>
inline void set (const die_type &die, arg_type &arg)
{
+ /* Clear the old containers first so in exceptions we can't leave
+ the tag changed but the old containers intact. */
_m_attributes.clear ();
_m_children.clear ();
_m_tag = die.tag ();
- _m_attributes.swap (attributes_type (die.attributes (), arg));
- _m_children.swap (children_type (die.children (), arg));
+ _m_attributes = std::move (attributes_type (die.attributes (), arg));
+ _m_children = std::move (children_type (die.children (), arg));
}
public:
// Share the _m_seen maps with the prototype tracker,
// but start a fresh walk from the given starting point.
- inline dwarf_ref_tracker (const dwarf_ref_tracker &proto,
- reference_match &matched,
+ inline dwarf_ref_tracker (const dwarf_ref_tracker &proto, reference_match &,
const left_context_type &lhs, const die1 &a,
const right_context_type &rhs, const die2 &b)
: _m_left (tracker1 (proto._m_left, lhs, a)),
/* Throw
*/
void
-dwarf::throw_libdw (::Dwarf *dw)
+dwarf::throw_libdw (::Dwarf *)
{
throw std::runtime_error (::dwarf_errmsg (-1));
}
2009-07-03 Roland McGrath <roland@redhat.com>
+ * Makefile.am (AM_CXXFLAGS): Drop -Wno-unused-parameter.
+
* dwarfcmp.cc (open_file): Exit 77 for no DWARF under -T.
2009-07-02 Roland McGrath <roland@redhat.com>
-I$(srcdir)/../libdw -I$(srcdir)/../libdwfl \
-I$(srcdir)/../libasm -I$(srcdir)/../lib -I..
-AM_CXXFLAGS = $(AM_CFLAGS:gnu99=gnu++0x) \
- -Wno-unused-parameter
+AM_CXXFLAGS = $(AM_CFLAGS:gnu99=gnu++0x)
AM_LDFLAGS = -Wl,-rpath-link,../libelf:../libdw
/* Handle program arguments. */
static error_t
-parse_opt (int key, char *arg,
- struct argp_state *state __attribute__ ((unused)))
+parse_opt (int key, char *, struct argp_state *)
{
switch (key)
{
+2009-07-03 Roland McGrath <roland@redhat.com>
+
+ * 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 <roland@redhat.com>
* run-dwarf_edit.sh: New file.
BUILT_RPATH = \$$ORIGIN/../libasm:\$$ORIGIN/../libdw:\$$ORIGIN/../backends:\$$ORIGIN/../libelf
endif
+AM_CXXFLAGS = $(AM_CFLAGS:gnu99=gnu++0x)
+
AM_LDFLAGS =
if !STANDALONE
#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)
{
++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)
{
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 ();
+ }
+}