Module Name: src
Committed By: snj
Date: Wed Feb 4 06:43:02 UTC 2015
Modified Files:
src/sys/lib/libunwind [netbsd-7]: AddressSpace.hpp
Log Message:
Pull up following revision(s) (requested by joerg in ticket #476):
sys/lib/libunwind/AddressSpace.hpp: revision 1.8
Fix binary search when search value is in the last block, but not equal
to the start of the range. PR 49444.
To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.7.2.1 src/sys/lib/libunwind/AddressSpace.hpp
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/lib/libunwind/AddressSpace.hpp
diff -u src/sys/lib/libunwind/AddressSpace.hpp:1.7 src/sys/lib/libunwind/AddressSpace.hpp:1.7.2.1
--- src/sys/lib/libunwind/AddressSpace.hpp:1.7 Sun Jul 20 14:40:58 2014
+++ src/sys/lib/libunwind/AddressSpace.hpp Wed Feb 4 06:43:02 2015
@@ -263,21 +263,19 @@ public:
pint_t base = n->hdr_base;
pint_t first = n->hdr_start;
- pint_t len = n->hdr_entries;
- while (len) {
- pint_t next = first + ((len + 1) / 2) * 8;
+ for (pint_t len = n->hdr_entries; len > 1; ) {
+ pint_t next = first + (len / 2) * 8;
pint_t nextPC = base + (int32_t)get32(next);
if (nextPC == pc) {
first = next;
break;
}
if (nextPC < pc) {
- len -= (len + 1) / 2;
first = next;
- } else if (len == 1)
- break;
- else
- len = (len + 1) / 2;
+ len -= (len / 2);
+ } else {
+ len /= 2;
+ }
}
fdeStart = base + (int32_t)get32(first + 4);
data_base = n->data_base;