summaryrefslogtreecommitdiff
path: root/gdbserver
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@efficios.com>2022-11-17 14:25:26 -0500
committerSimon Marchi <simon.marchi@polymtl.ca>2022-11-18 11:21:22 -0500
commitc0cb02a4cf590f3cb64cdcc1b5bf539196333160 (patch)
treee984ffe1fa527ae269d734271646a2f1f2b2d94f /gdbserver
parent4855cbdc3d8fba4f5f6f61865a40d557c4be6d2c (diff)
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
Diffstat (limited to 'gdbserver')
-rw-r--r--gdbserver/proc-service.cc2
1 files changed, 1 insertions, 1 deletions
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;
}