From mboxrd@z Thu Jan 1 00:00:00 1970 Content-Type: multipart/mixed; boundary="===============8180722908924050223==" MIME-Version: 1.0 From: Petr Machata To: elfutils-devel@lists.fedorahosted.org Subject: Re: [PATCH 2/2] Add C++ iterators Date: Thu, 16 Apr 2015 15:52:03 +0200 Message-ID: <87oamomb98.fsf@redhat.com> In-Reply-To: 1429190967.31971.60.camel@bordewijk.wildebeest.org --===============8180722908924050223== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Mark Wielaard writes: > Is that a common use case? I would have imagined that you would iterate > over just the Dwarf_Dies of one particular unit separately or given a That would be along these lines: for (die_tree_iterator it (uit), end (++uit); it !=3D end; ++it) ; > particular Dwarf_Die would like it to iterate over just the die_tree > under that DIE. Given the current design of the die_tree_iterator how > would one do that? This is not implemented, though I admit it would be a useful feature. At this point however I would very much like to keep the scope of the patch as it is now. > Also I think that we really should provide an easy way to walk the > logical DIE tree. Which means resolving DW_TAG_imported_unit DIEs and > just continue with the children of the imported unit at that point. > There should of course also be an option to walk the "raw" DIE tree. But > it feels wrong to let the user do logical walks on their own, checking > for imported_unit tags, walking the imported_unit children tree, keep > their own parent stack, etc. I agree, this would be tremendously useful--we discussed this recently on this list after all. But it should be implemented in C libdw, and only then (optionally) reused in the C++ wrappers. > That of course does mean the current internal tracking using just a > Dwarf_Off is not enough, because resolving imported_units might cross > Dwarfs. One option would be to build the logical iterator on top of the raw iterator, and track import history in a vector of raw iterators. That's essentially what dwgrep does. Thanks, Petr --===============8180722908924050223==--