From: Sergio Durigan Junior <sergiodj@redhat.com>
To: Aaron Gamble <agamble@google.com>
Cc: Tom Tromey <tromey@redhat.com>, gdb-patches@sourceware.org
Subject: Re: [patch] info threads sort by name and name regex matching
Date: Wed, 22 Aug 2012 23:30:00 -0000 [thread overview]
Message-ID: <m3boi2ld2u.fsf@redhat.com> (raw)
In-Reply-To: <CAHX8C++jrfC2eedRfNrSJLKz-961p8HFJxodn_8goMDO9VYQVg@mail.gmail.com> (Aaron Gamble's message of "Wed, 22 Aug 2012 15:36:25 -0700")
On Wednesday, August 22 2012, Aaron Gamble wrote:
> On Wed, Aug 22, 2012 at 11:51 AM, Tom Tromey <tromey@redhat.com> wrote:
>> Aaron> With this patch sorting by name will happen always. (Perhaps a switch
>> Aaron> to enable sorting would be better?)
>>
>> Yes, I think so. I think sorting by name makes sense but it isn't
>> perhaps always what you want. Sorting by number has the nice feature
>> that it is stable.
>>
>> Aaron> Regex matching is specified by doing 'info threads r<regex>'. This is
>> Aaron> not ambiguous with previous behavior where parameters to info threads
>> Aaron> were only numbers. (spaces between 'r' and <regex> are ignored)
>>
>> I'm curious why you chose this particular spelling.
>> Other possible approaches would be a subcommand, or a flag like "-r".
>> Either of these is perhaps more in keeping with gdb tradition.
>>
>> I'm interested in other opinions here too.
>>
>> Expect some bikeshedding on this point.
> I picked a single letter for it to be quick and easy to type. I
> suppose it's possible 'info threads' could be expanded to do other
> sorts of matching where different flags would be useful.
>
> How about 'info threads [ -a ] [ id.. | -n <name regex> ]'
>
> -a - Sort alphabetically by name
> -n regex - Match thread names with regex
>
> Of course then we could do sorting based on the name of the function a
> thread is in or other sorts of sorting. So other sorting flags would
> need to be introduced.
Why not `-r regex'? I think it would be more clear.
Other commands (`sharedlibrary', `info variables', etc) take a regex as
their first argument, without requiring a modifier like `-r'. If the
"pipe" patch were already in, this alphabetical sorting would not be
needed... Anyway, just thinking here.
> *snip*
>> Aaron> + threads = xmalloc (sizeof (*threads) * thread_list_size);
>> Aaron> + make_cleanup (free, threads);
>>
>> I think making a VEC here would be better.
>> Then you wouldn't need thread_list_size at all.
>
> Hmm, not sure if this would improve performance at all. A one time
> allocation bounded by the number of threads vs VEC's implementation of
> expanding arrays. I'll wait for others feedback.
I guess Tom did not suggest this because of performance per se, but
rather because if you have to make a list in GDB then it is already a
convention to use VEC for these things.
BTW, I noticed one minor nit in your patch: you do not obey the "TAB
vs. space" rule. Basically, if you have 8 spaces, then you should
convert it to a TAB. Emacs does this for free, but if you're using Vim
you can ask me offlist and I can send you a little function that does
that.
Thanks,
--
Sergio
next prev parent reply other threads:[~2012-08-22 23:30 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-21 21:19 Aaron Gamble
2012-08-22 10:06 ` Abid, Hafiz
2012-08-22 17:15 ` Eli Zaretskii
2012-08-22 18:52 ` Tom Tromey
2012-08-22 22:37 ` Aaron Gamble
2012-08-22 23:30 ` Sergio Durigan Junior [this message]
2012-08-23 16:00 ` Tom Tromey
2012-08-24 1:09 ` Aaron Gamble
2012-08-24 17:58 ` Tom Tromey
2012-08-24 22:23 ` Aaron Gamble
2012-08-24 22:32 ` Sergio Durigan Junior
2012-08-24 23:21 ` Aaron Gamble
2012-08-24 23:28 ` Aaron Gamble
2012-08-25 3:12 ` Sergio Durigan Junior
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=m3boi2ld2u.fsf@redhat.com \
--to=sergiodj@redhat.com \
--cc=agamble@google.com \
--cc=gdb-patches@sourceware.org \
--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