The changes that you requested, and the testcase, are on
@@ -637,7 +637,7 @@ namespace elfutils
inline attribute operator* () const
- if (unlikely (_m_offset == 1))
+ if (unlikely (_m_offset == 1 && _m_attr.valp == NULL))
throw std::runtime_error ("dereferencing end iterator");
return attribute (_m_die, _m_attr);
We don't really need the _m_offset check here, do we?
Why do we need the new dwarf-attributes test program instead of testing the
expected output of dwarf-print? I guess its output is kind of long on any
nontrivial file. Perhaps just tweak dwarf-print with an optional less
verbose mode rather than cut&paste most of it?