public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: Andrew Burgess <andrew.burgess@embecosm.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] gdb: make iterate_over_threads a template function
Date: Mon, 24 May 2021 07:56:40 -0600	[thread overview]
Message-ID: <87h7isz147.fsf@tromey.com> (raw)
In-Reply-To: <20210522165146.4113176-1-andrew.burgess@embecosm.com> (Andrew Burgess's message of "Sat, 22 May 2021 17:51:46 +0100")

>>>>> "Andrew" == Andrew Burgess <andrew.burgess@embecosm.com> writes:

Andrew> This started off as changing the return type of the callback function
Andrew> that iterate_over_threads takes from int to bool.

Andrew> But then I thought, why not make the whole thing templated, and remove
Andrew> the need to pass void* arguments around.

The usual way to do this in gdb is to have the iteration function accept
a gdb::function_view.  This lets it work with lambdas, etc.

That said, I tend to agree with Simon's response here.  In particular,
so-called "external iteration" is, IMO, usually simpler to read and
understand, and is also more accommodating to special cases.  That may
be a bigger change than you want to make though.

thanks,
Tom

      parent reply	other threads:[~2021-05-24 13:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-22 16:51 Andrew Burgess
2021-05-23  1:08 ` Simon Marchi
2021-05-24 13:56 ` Tom Tromey [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=87h7isz147.fsf@tromey.com \
    --to=tom@tromey.com \
    --cc=andrew.burgess@embecosm.com \
    --cc=gdb-patches@sourceware.org \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).