This is the mail archive of the elfutils-devel@sourceware.org mailing list for the elfutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] <dwarf>: Don't swallow last attribute


---
 libdw/ChangeLog |    5 +++++
 libdw/c++/dwarf |   11 ++++++++---
 2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/libdw/ChangeLog b/libdw/ChangeLog
index fc08176..d68075d 100644
--- a/libdw/ChangeLog
+++ b/libdw/ChangeLog
@@ -1,3 +1,8 @@
+2009-03-24  Petr Machata  <pmachata@redhat.com>
+
+	* c++/dwarf (dwarf::debug_info_entry::raw_attributes):
+	Fix iteration over attributes.
+
 2009-02-26  Roland McGrath  <roland@redhat.com>
 =

 	* c++/dwarf (dwarf::attr_value): Add _m_tag private member.
diff --git a/libdw/c++/dwarf b/libdw/c++/dwarf
index 862b9a1..33e7250 100644
--- a/libdw/c++/dwarf
+++ b/libdw/c++/dwarf
@@ -626,7 +626,10 @@ namespace elfutils
 	}
 =

 	inline const_iterator (const debug_info_entry &die, ptrdiff_t offset)
-	  : _m_die (die), _m_offset (offset) {}
+	  : _m_die (die), _m_offset (offset)
+	{
+	  _m_attr.valp =3D NULL;
+	}
 =

       public:
 	inline const_iterator (const const_iterator &i)
@@ -643,7 +646,8 @@ namespace elfutils
 	inline bool operator=3D=3D (const const_iterator &other) const
 	{
 	  return (_m_die._m_die.addr =3D=3D other._m_die._m_die.addr
-		  && _m_offset =3D=3D other._m_offset);
+		  && _m_offset =3D=3D other._m_offset
+		  && !_m_attr.valp =3D=3D !other._m_attr.valp);
 	}
 	inline bool operator!=3D (const const_iterator &other) const
 	{
@@ -659,6 +663,7 @@ namespace elfutils
 	  _m_offset =3D result;
 	  return *this;
 	}
+
 	inline const_iterator operator++ (int) // postfix
 	{
 	  const_iterator prev =3D *this;
@@ -668,7 +673,7 @@ namespace elfutils
 =

 	inline attribute operator* () const
 	{
-	  if (unlikely (_m_offset =3D=3D 1))
+	  if (unlikely (_m_offset =3D=3D 1 && _m_attr.valp =3D=3D NULL))
 	    throw std::runtime_error ("dereferencing end iterator");
 	  return attribute (_m_die, _m_attr);
 	}
-- =

1.6.0.6


--===============6892338112020408598==
Content-Type: application/pgp-signature
MIME-Version: 1.0
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="signature.asc"

LS0tLS1CRUdJTiBQR1AgU0lHTkFUVVJFLS0tLS0KVmVyc2lvbjogR251UEcgdjEuNC45IChHTlUv
TGludXgpCgppRVlFQVJFQ0FBWUZBa25JN0lnQUNna1FUNnRKeTBTVlFQTEJTQUNlTnlsb3hiL3BJ
VEdlUGxyaHBxSDdzTG1QCi9HSUFuMlNYMVFwVk9CTVNjaUtCdXBhRVBIUXkyOXFWCj1aeFlnCi0t
LS0tRU5EIFBHUCBTSUdOQVRVUkUtLS0tLQo=

--===============6892338112020408598==--

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]