From: Roland McGrath Date: Wed, 21 Jul 2010 22:35:11 +0000 (-0700) Subject: dwarf_edit vs _GLIBCXX_DEBUG X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=802e66898ab60c57812258fc71eb8be2c602054a;p=thirdparty%2Felfutils.git dwarf_edit vs _GLIBCXX_DEBUG --- diff --git a/libdw/ChangeLog b/libdw/ChangeLog index e3645bb0e..13492f9df 100644 --- a/libdw/ChangeLog +++ b/libdw/ChangeLog @@ -1,3 +1,8 @@ +2010-07-21 Roland McGrath + + * c++/dwarf_ref_maker (dwarf_ref_maker::seen): Add copy constructor + to avoid default copying of uninitialized iterator. + 2010-07-13 Roland McGrath * c++/dwarf_comparator (dwarf_tracker_base): Replace visit method with diff --git a/libdw/c++/dwarf_ref_maker b/libdw/c++/dwarf_ref_maker index cfb6c4a10..f7c7fdbbe 100644 --- a/libdw/c++/dwarf_ref_maker +++ b/libdw/c++/dwarf_ref_maker @@ -1,5 +1,5 @@ /* elfutils::dwarf_ref_maker -- -*- C++ -*- template type specification - 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 @@ -109,6 +109,15 @@ namespace elfutils : _m_known (false), _m_out (), _m_refs () {} + // Copy construction only valid for initial state. + inline seen (const seen &other) + : _m_known (false), _m_out (), _m_refs () + { + if (unlikely (other._m_known) || unlikely (!other._m_refs.empty ())) + throw std::logic_error + ("seen copy constructs only from default-constructed"); + } + inline void resolve () { for (; !_m_refs.empty (); _m_refs.pop_back ())