This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: [HELP] GDB general way to quickly find a addr in a list of addrs
- From: Hui Zhu <teawater at gmail dot com>
- To: tromey at redhat dot com
- Cc: Jan Kratochvil <jan dot kratochvil at redhat dot com>, gdb at sourceware dot org
- Date: Fri, 25 Jun 2010 14:49:47 +0800
- Subject: Re: [HELP] GDB general way to quickly find a addr in a list of addrs
- References: <AANLkTim19pXojeqD1r6SWR5_aGBJiFM7-OR54XJizBvc@mail.gmail.com> <20100528075105.GA3138@host0.dyn.jankratochvil.net> <m3pr01i69h.fsf@fleche.redhat.com>
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