* [HELP] GDB general way to quickly find a addr in a list of addrs
@ 2010-05-28 2:20 Hui Zhu
2010-05-28 7:51 ` Jan Kratochvil
0 siblings, 1 reply; 5+ messages in thread
From: Hui Zhu @ 2010-05-28 2:20 UTC (permalink / raw)
To: gdb
Hi guys,
Does GDB have a general way to quickly find a number in a list of numbers?
Thanks,
Hui
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [HELP] GDB general way to quickly find a addr in a list of addrs
2010-05-28 2:20 [HELP] GDB general way to quickly find a addr in a list of addrs Hui Zhu
@ 2010-05-28 7:51 ` Jan Kratochvil
2010-05-28 8:38 ` Hui Zhu
2010-06-08 21:06 ` Tom Tromey
0 siblings, 2 replies; 5+ messages in thread
From: Jan Kratochvil @ 2010-05-28 7:51 UTC (permalink / raw)
To: Hui Zhu; +Cc: gdb
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?
addrmap.[ch] for API or the `find' command for CLI.
Jan
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [HELP] GDB general way to quickly find a addr in a list of addrs
2010-05-28 7:51 ` Jan Kratochvil
@ 2010-05-28 8:38 ` Hui Zhu
2010-06-08 21:06 ` Tom Tromey
1 sibling, 0 replies; 5+ messages in thread
From: Hui Zhu @ 2010-05-28 8:38 UTC (permalink / raw)
To: Jan Kratochvil; +Cc: gdb
On Fri, May 28, 2010 at 15:51, Jan Kratochvil <jan.kratochvil@redhat.com> wrote:
> 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?
>
> addrmap.[ch] for API or the `find' command for CLI.
>
>
> Jan
>
It's very cool. Thanks Jan.
Best,
Hui
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [HELP] GDB general way to quickly find a addr in a list of addrs
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
1 sibling, 1 reply; 5+ messages in thread
From: Tom Tromey @ 2010-06-08 21:06 UTC (permalink / raw)
To: Jan Kratochvil; +Cc: Hui Zhu, gdb
>>>>> "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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [HELP] GDB general way to quickly find a addr in a list of addrs
2010-06-08 21:06 ` Tom Tromey
@ 2010-06-25 6:50 ` Hui Zhu
0 siblings, 0 replies; 5+ messages in thread
From: Hui Zhu @ 2010-06-25 6:50 UTC (permalink / raw)
To: tromey; +Cc: Jan Kratochvil, gdb
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
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2010-06-25 6:50 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-05-28 2:20 [HELP] GDB general way to quickly find a addr in a list of addrs 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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).