[1/5] gdbserver: Use current_process in handle_qxfer_auxv

Message ID 20230331034432.3037148-2-thiago.bauermann@linaro.org
State New
Headers
Series gdbserver: Follow-up on linux_get_auxv using PID parameter |

Commit Message

Thiago Jung Bauermann March 31, 2023, 3:44 a.m. UTC
  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(-)
  

Patch

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.  */