From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7540 invoked by alias); 8 Jun 2010 21:06:30 -0000 Received: (qmail 7515 invoked by uid 22791); 8 Jun 2010 21:06:29 -0000 X-SWARE-Spam-Status: No, hits=-5.8 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 08 Jun 2010 21:06:23 +0000 Received: from int-mx05.intmail.prod.int.phx2.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.18]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o58L6JTk009175 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 8 Jun 2010 17:06:19 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx05.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o58L6JZM029810; Tue, 8 Jun 2010 17:06:19 -0400 Received: from opsy.redhat.com (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id o58L6ImF014332; Tue, 8 Jun 2010 17:06:18 -0400 Received: by opsy.redhat.com (Postfix, from userid 500) id 33FD43785F0; Tue, 8 Jun 2010 15:06:18 -0600 (MDT) From: Tom Tromey To: Jan Kratochvil Cc: Hui Zhu , gdb@sourceware.org Subject: Re: [HELP] GDB general way to quickly find a addr in a list of addrs References: <20100528075105.GA3138@host0.dyn.jankratochvil.net> Reply-To: tromey@redhat.com Date: Tue, 08 Jun 2010 21:06:00 -0000 In-Reply-To: <20100528075105.GA3138@host0.dyn.jankratochvil.net> (Jan Kratochvil's message of "Fri, 28 May 2010 09:51:05 +0200") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2010-06/txt/msg00030.txt.bz2 >>>>> "Jan" == Jan Kratochvil 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