On Tue, 03 Sep 2013 13:43:29 +0200, Mark Wielaard wrote:
Good point, assuming you meant dwarf_getlocation_addr, that removes
some
duplicate code. Revised patch attached.
You have not addressed my previous note
# Although one would have to hack there prevention of getlocation() for
# non-matching ranges.
Currently you call getlocation->__libdw_intern_expression for every range in
the location list, even if that range does not contain our PC. That is both
CPU expensive and it also "leaks" memory (until cu->dbg gets destroyed) even
more than formerly (formerly only one range got "leaked" on each
dwarf_getlocation call).
My idea was more to create dwarf_getlocations_internal without its last
getlocation call, use that from refactored dwarf_getlocation and create
current public dwarf_getlocations as a wrapper around
dwarf_getlocations_internal with that getlocation call.
But then one may argue it is no longer such a simplification.
And maybe also you do not find it as an issue as location lists are never too
long anyway.
Jan