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: use current_process in ps_getpid
Date: Fri, 18 Nov 2022 16:21:46 +0000 (GMT)	[thread overview]
Message-ID: <20221118162146.C95E9385841C@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=c0cb02a4cf590f3cb64cdcc1b5bf539196333160

commit c0cb02a4cf590f3cb64cdcc1b5bf539196333160
Author: Simon Marchi <simon.marchi@efficios.com>
Date:   Thu Nov 17 14:25:26 2022 -0500

    gdbserver: use current_process in ps_getpid
    
    The following patch ("gdbserver: switch to right process in
    find_one_thread") makes it so find_one_thread calls into libthread_db
    with a current process but no current thread.  This tripped on ps_getpid
    using current_thread in order to get the process' pid.  Get the pid from
    `current_process ()` instead, which removes the need to have a current
    thread.  Eventually, it would be good to get it from the
    gdb_ps_prochandle_t structure, to avoid the need for a current process
    as well.
    
    Reviewed-By: Andrew Burgess <aburgess@redhat.com>
    Change-Id: I9d2fae266419199a2fbc2fde0a5104c6e0dbd2d5

Diff:
---
 gdbserver/proc-service.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gdbserver/proc-service.cc b/gdbserver/proc-service.cc
index a49e2b25a47..f86c0e99923 100644
--- a/gdbserver/proc-service.cc
+++ b/gdbserver/proc-service.cc
@@ -158,5 +158,5 @@ ps_lsetfpregs (gdb_ps_prochandle_t ph, lwpid_t lwpid, const prfpregset_t *fpregs
 pid_t
 ps_getpid (gdb_ps_prochandle_t ph)
 {
-  return pid_of (current_thread);
+  return current_process ()->pid;
 }

                 reply	other threads:[~2022-11-18 16:21 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=20221118162146.C95E9385841C@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: 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).