public inbox for gdb-cvs@sourceware.org help / color / mirror / Atom feed
From: Simon Marchi <simark@sourceware.org> To: gdb-cvs@sourceware.org Subject: [binutils-gdb] gdbserver/linux: take condition out of callback in find_lwp_pid Date: Fri, 18 Nov 2022 16:09:21 +0000 (GMT) [thread overview] Message-ID: <20221118160921.EF11D385841C@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=d4895ba2df3bbf38d64fce314f5933d05eb8990a commit d4895ba2df3bbf38d64fce314f5933d05eb8990a Author: Simon Marchi <simon.marchi@polymtl.ca> Date: Fri Nov 18 11:09:11 2022 -0500 gdbserver/linux: take condition out of callback in find_lwp_pid Just a small optimization, it's not necessary to recompute lwp at each iteration. While at it, change the variable type to long, as ptid_t::lwp returns a long. Reviewed-By: Andrew Burgess <aburgess@redhat.com> Change-Id: I181670ce1f90b59cb09ea4899367750be2ad9105 Diff: --- gdbserver/linux-low.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gdbserver/linux-low.cc b/gdbserver/linux-low.cc index 0cbfeb99086..a896b37528b 100644 --- a/gdbserver/linux-low.cc +++ b/gdbserver/linux-low.cc @@ -1731,9 +1731,9 @@ linux_process_target::status_pending_p_callback (thread_info *thread, struct lwp_info * find_lwp_pid (ptid_t ptid) { - thread_info *thread = find_thread ([&] (thread_info *thr_arg) + long lwp = ptid.lwp () != 0 ? ptid.lwp () : ptid.pid (); + thread_info *thread = find_thread ([lwp] (thread_info *thr_arg) { - int lwp = ptid.lwp () != 0 ? ptid.lwp () : ptid.pid (); return thr_arg->id.lwp () == lwp; });
reply other threads:[~2022-11-18 16:09 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20221118160921.EF11D385841C@sourceware.org \ --to=simark@sourceware.org \ --cc=gdb-cvs@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: linkBe 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).