summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libdw/ChangeLog6
-rw-r--r--libdw/c++/dwarf_data8
-rw-r--r--libdw/c++/subr.hh19
3 files changed, 30 insertions, 3 deletions
diff --git a/libdw/ChangeLog b/libdw/ChangeLog
index 13492f9d..3d234088 100644
--- a/libdw/ChangeLog
+++ b/libdw/ChangeLog
@@ -1,3 +1,9 @@
+2010-08-18 Roland McGrath <[email protected]>
+
+ * c++/subr.hh (subr::container_tail_equal): New function.
+ * c++/dwarf_data (dwarf_data::directory_table::operator==): Use it
+ to ignore the compilation directory (first table element).
+
2010-07-21 Roland McGrath <[email protected]>
* c++/dwarf_ref_maker (dwarf_ref_maker::seen): Add copy constructor
diff --git a/libdw/c++/dwarf_data b/libdw/c++/dwarf_data
index 134ff8e3..daf0aa2c 100644
--- a/libdw/c++/dwarf_data
+++ b/libdw/c++/dwarf_data
@@ -1,5 +1,5 @@
/* elfutils::dwarf_data -- internal DWARF data representations in -*- C++ -*-
- Copyright (C) 2009 Red Hat, Inc.
+ Copyright (C) 2009-2010 Red Hat, Inc.
This file is part of Red Hat elfutils.
Red Hat elfutils is free software; you can redistribute it and/or modify
@@ -318,7 +318,11 @@ namespace elfutils
template<typename table>
inline bool operator== (const table &other) const
{
- return size () == other.size () && subr::container_equal (*this, other);
+ /* We ignore the first element, the compilation directory.
+ This is actually part of the CU, not part of the line info.
+ The directory table itself matches regardless. */
+ return (size () == other.size ()
+ && subr::container_tail_equal (*this, other, 1));
}
template<typename table>
inline bool operator!= (const table &other) const
diff --git a/libdw/c++/subr.hh b/libdw/c++/subr.hh
index bd7464d3..fda1f295 100644
--- a/libdw/c++/subr.hh
+++ b/libdw/c++/subr.hh
@@ -282,12 +282,22 @@ namespace elfutils
}
template<typename t1, typename t2, typename pred_type>
- inline bool container_equal (const t1 &a, const t2 &b, pred_type pred)
+ inline bool container_equal (const t1 &a, const t2 &b, pred_type pred,
+ typename t1::size_type skip = 0)
{
typename t1::const_iterator first1 = a.begin ();
typename t1::const_iterator last1 = a.end ();
typename t2::const_iterator first2 = b.begin ();
typename t2::const_iterator last2 = b.end ();
+ while (skip-- > 0)
+ {
+ if (first1 == last1)
+ return first2 == last2;
+ if (first2 == last2)
+ return first1 == last1;
+ ++first1;
+ ++first2;
+ }
return container_equal (first1, last1, first2, last2, pred);
}
@@ -297,6 +307,13 @@ namespace elfutils
return container_equal (a, b, deref_equal_to<t1, t2> ());
}
+ template<typename t1, typename t2>
+ inline bool container_tail_equal (const t1 &a, const t2 &b,
+ typename t1::size_type skip = 0)
+ {
+ return container_equal (a, b, deref_equal_to<t1, t2> (), skip);
+ }
+
template<typename iter>
inline typename iter::difference_type length (iter i, const iter &end)
{