awong-dev/ndk — pull request #99 by danakj (2014-06-02 10:30:57+00:00)
Title: Use a binary search to find the function start/end.

When searching for the funciton start/end in the EHABI table,
make use of std::upper_bound to do a binary search instead of
doing our own linear search.

Our search key is the current |pc|, and we use upper_bound to
find the first index in the table who points to an address
greater than |pc|. This address is the start of the next function.
From there, subtracting one index will give the start of the
current function.

std::upper_bound takes as input a begin and end iterator, and
a value to compare against, which is |pc| for us. We are unable
to use the indices of the table array diretly as the iterators,
as the compare method will need to compare the *iterator vs
the |pc|, but the *iterator would be a raw address in the table
instead of the full lookup of the instruction address from the
data in the table. Thus, we roll a EHABISectionIterator class
to do the iterating over the table for us, and use the default
comparator method to compare *iterator vs |pc|.

Change-Id: I0299ebc5d8a45157274a5a9575af4a14e3d4c0e2