On Wed, 2013-09-04 at 16:42 +0200, Jan Kratochvil wrote:
On Wed, 04 Sep 2013 16:30:19 +0200, Mark Wielaard wrote:
> Good point, I missed that. It is always good to do less work if at all
> possible. I implemented it slightly differently from your suggestion,
> but I believe it addresses your point. See new patch attached.
This makes address == 0 a special case.
I do not have an overview how elfutils handles that but at least GDB tries to
handle address 0 as general valid address as it is a normal code location on
many embedded targets. (Although for example GNU/Linux-targeted code does not
handle address 0 correctly as it is not much a problem for GNU/Linux targets.)
We can use -1. Which should never match. I'll test the same patch with:
diff --git a/libdw/dwarf_getlocation.c b/libdw/dwarf_getlocation.c
index cb4b483..c9df8f4 100644
--- a/libdw/dwarf_getlocation.c
+++ b/libdw/dwarf_getlocation.c
@@ -678,8 +678,8 @@ getlocations_addr (attr, offset, basep, startp, endp, address,
*startp = *basep + begin;
*endp = *basep + end;
- /* If address is zero we want them all, otherwise only those that match. */
- if (address != 0 && (address < *endp || address >= *startp))
+ /* If address is minus one we want them all, otherwise only matching. */
+ if (address != (Dwarf_Word) -1 && (address < *endp || address >=
*startp))
goto next;
if (getlocation (attr->cu, &block, expr, exprlen, IDX_debug_loc) != 0)
@@ -828,6 +828,6 @@ dwarf_getlocations (attr, offset, basep, startp, endp, expr, exprlen)
return -1;
}
- return getlocations_addr (attr, offset, basep, startp, endp, 0, d,
- expr, exprlen);
+ return getlocations_addr (attr, offset, basep, startp, endp,
+ (Dwarf_Word) -1, d, expr, exprlen);
}
Thanks,
Mark