Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-7]: src/sys/lib/libunwind Pull up following revision(s) (requeste...



details:   https://anonhg.NetBSD.org/src/rev/78f28d2b91f6
branches:  netbsd-7
changeset: 798938:78f28d2b91f6
user:      snj <snj%NetBSD.org@localhost>
date:      Wed Feb 04 06:43:02 2015 +0000

description:
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.

diffstat:

 sys/lib/libunwind/AddressSpace.hpp |  14 ++++++--------
 1 files changed, 6 insertions(+), 8 deletions(-)

diffs (31 lines):

diff -r f5a190bde3b3 -r 78f28d2b91f6 sys/lib/libunwind/AddressSpace.hpp
--- a/sys/lib/libunwind/AddressSpace.hpp        Wed Feb 04 06:36:44 2015 +0000
+++ b/sys/lib/libunwind/AddressSpace.hpp        Wed Feb 04 06:43:02 2015 +0000
@@ -263,21 +263,19 @@
 
     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;



Home | Main Index | Thread Index | Old Index