Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@redhat.com>
To: Jan Kratochvil <jan.kratochvil@redhat.com>
Cc: Hui Zhu <teawater@gmail.com>, gdb@sourceware.org
Subject: Re: [HELP] GDB general way to quickly find a addr in a list of addrs
Date: Tue, 08 Jun 2010 21:06:00 -0000	[thread overview]
Message-ID: <m3pr01i69h.fsf@fleche.redhat.com> (raw)
In-Reply-To: <20100528075105.GA3138@host0.dyn.jankratochvil.net> (Jan	Kratochvil's message of "Fri, 28 May 2010 09:51:05 +0200")

>>>>> "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)    \
   ...

Tom


  parent reply	other threads:[~2010-06-08 21:06 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 [this message]
2010-06-25  6:50     ` Hui Zhu

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=m3pr01i69h.fsf@fleche.redhat.com \
    --to=tromey@redhat.com \
    --cc=gdb@sourceware.org \
    --cc=jan.kratochvil@redhat.com \
    --cc=teawater@gmail.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