Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Hui Zhu <teawater@gmail.com>
To: tromey@redhat.com
Cc: Jan Kratochvil <jan.kratochvil@redhat.com>, gdb@sourceware.org
Subject: Re: [HELP] GDB general way to quickly find a addr in a list of addrs
Date: Fri, 25 Jun 2010 06:50:00 -0000	[thread overview]
Message-ID: <AANLkTikCqr48aBQlDBgtrSfU9qPnoaOGN1j8DsUvA6bv@mail.gmail.com> (raw)
In-Reply-To: <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


      reply	other threads:[~2010-06-25  6:50 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-28  2:20 Hui Zhu
2010-05-28  7:51 ` Jan Kratochvil
2010-05-28  8:38   ` Hui Zhu
2010-06-08 21:06   ` Tom Tromey
2010-06-25  6:50     ` Hui Zhu [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AANLkTikCqr48aBQlDBgtrSfU9qPnoaOGN1j8DsUvA6bv@mail.gmail.com \
    --to=teawater@gmail.com \
    --cc=gdb@sourceware.org \
    --cc=jan.kratochvil@redhat.com \
    --cc=tromey@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox