public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Thiago Jung Bauermann <thiago.bauermann@linaro.org>
To: gdb-patches@sourceware.org
Cc: Thiago Jung Bauermann <thiago.bauermann@linaro.org>,
	Pedro Alves <pedro@palves.net>
Subject: [PATCH 1/5] gdbserver: Use current_process in handle_qxfer_auxv
Date: Fri, 31 Mar 2023 03:44:28 +0000	[thread overview]
Message-ID: <20230331034432.3037148-2-thiago.bauermann@linaro.org> (raw)
In-Reply-To: <20230331034432.3037148-1-thiago.bauermann@linaro.org>

Commit 43e5fbd8b788 ("gdbserver: Add PID parameter to linux_get_auxv and
linux_get_hwcap") changed the functions for reading auxv from using
current_thread to accepting a PID argument.  Pedro then suggested: "Since
we're removing the thread dependency, I think that check should be replaced
by current_process() == NULL instead".

This patch implements his suggestion.

Suggested-by: Pedro Alves <pedro@palves.net>
---
 gdbserver/server.cc | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/gdbserver/server.cc b/gdbserver/server.cc
index 949849b63a2d..b6786baafadd 100644
--- a/gdbserver/server.cc
+++ b/gdbserver/server.cc
@@ -1445,11 +1445,10 @@ handle_qxfer_auxv (const char *annex,
   if (!the_target->supports_read_auxv () || writebuf != NULL)
     return -2;
 
-  if (annex[0] != '\0' || current_thread == NULL)
+  if (annex[0] != '\0' || current_process () == nullptr)
     return -1;
 
-  return the_target->read_auxv (current_thread->id.pid (), offset, readbuf,
-				len);
+  return the_target->read_auxv (current_process ()->pid, offset, readbuf, len);
 }
 
 /* Handle qXfer:exec-file:read.  */

  reply	other threads:[~2023-03-31  3:44 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-31  3:44 [PATCH 0/5] gdbserver: Follow-up on linux_get_auxv using PID parameter Thiago Jung Bauermann
2023-03-31  3:44 ` Thiago Jung Bauermann [this message]
2023-03-31  3:44 ` [PATCH 2/5] gdbserver: Use the PID of the current process instead of the current thread Thiago Jung Bauermann
2023-03-31  3:44 ` [PATCH 3/5] gdbserver/linux: Read auxv from any thread of the process Thiago Jung Bauermann
2023-03-31  3:44 ` [PATCH 4/5] gdb/linux-nat: " Thiago Jung Bauermann
2023-03-31  3:44 ` [PATCH 5/5] gdb/testsuite: Add test that reads auxv in a multi-threaded inferior Thiago Jung Bauermann
2023-04-04 14:00   ` Alexandra Petlanova Hajkova
2023-04-04 15:19 ` [PATCH 0/5] gdbserver: Follow-up on linux_get_auxv using PID parameter Simon Marchi

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=20230331034432.3037148-2-thiago.bauermann@linaro.org \
    --to=thiago.bauermann@linaro.org \
    --cc=gdb-patches@sourceware.org \
    --cc=pedro@palves.net \
    /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).