lkml.org 
[lkml]   [2017]   [Jun]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [RFC PATCH 10/10] x86/unwind: add undwarf unwinder
    On Thu, Jun 01, 2017 at 07:26:51AM -0500, Josh Poimboeuf wrote:
    > On Thu, Jun 01, 2017 at 01:05:39PM +0200, Peter Zijlstra wrote:
    > > On Thu, Jun 01, 2017 at 12:44:16AM -0500, Josh Poimboeuf wrote:
    > >
    > > > +static struct undwarf *__undwarf_lookup(struct undwarf *undwarf,
    > > > + unsigned int num, unsigned long ip)
    > > > +{
    > > > + struct undwarf *first = undwarf;
    > > > + struct undwarf *last = undwarf + num - 1;
    > > > + struct undwarf *mid;
    > > > + unsigned long u_ip;
    > > > +
    > > > + while (first <= last) {
    > > > + mid = first + ((last - first) / 2);
    > > > + u_ip = undwarf_ip(mid);
    > > > +
    > > > + if (ip >= u_ip) {
    > > > + if (ip < u_ip + mid->len)
    > > > + return mid;
    > > > + first = mid + 1;
    > > > + } else
    > > > + last = mid - 1;
    > > > + }
    > > > +
    > > > + return NULL;
    > > > +}
    > >
    > > That's a bog standard binary search thing, don't we have a helper for
    > > that someplace?
    >
    > I wasn't able to find one...

    Yeah, I looked too and couldn't find it either. A well.

    \
     
     \ /
      Last update: 2017-06-01 15:11    [W:2.344 / U:0.196 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site