This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [HELP] GDB general way to quickly find a addr in a list of addrs


On Wed, Jun 9, 2010 at 05:06, Tom Tromey <tromey@redhat.com> wrote:
>>>>>> "Jan" == Jan Kratochvil <jan.kratochvil@redhat.com> writes:
>
>>> On Fri, 28 May 2010 04:19:59 +0200, Hui Zhu wrote:
>>> Does GDB have a general way to quickly find a number in a list of numbers?
>
> Jan> addrmap.[ch] for API or the `find' command for CLI.
>
> VEC also has a binary search built-in, under a funny name:
>
> /* Find the first index in the vector not less than the object.
> ? unsigned VEC_T_lower_bound (VEC(T) *v, const T val,
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? int (*lessthan) (const T, const T)); // Integer
> ? unsigned VEC_T_lower_bound (VEC(T) *v, const T val,
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? int (*lessthan) (const T, const T)); // Pointer
> ? unsigned VEC_T_lower_bound (VEC(T) *v, const T *val,
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? int (*lessthan) (const T*, const T*)); // Object
>
> ? Find the first position in which VAL could be inserted without
> ? changing the ordering of V. ?LESSTHAN is a function that returns
> ? true if the first argument is strictly less than the second. ?*/
>
> #define VEC_lower_bound(T,V,O,LT) ? ?\
> ? ...
>
Thanks Tom.

Hui


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]