diff options
author | Simon Marchi <simon.marchi@efficios.com> | 2020-10-24 22:59:29 -0400 |
---|---|---|
committer | Simon Marchi <simon.marchi@polymtl.ca> | 2020-10-25 09:06:09 -0400 |
commit | 3f66685e9e92717af0cafa20480de5548aea7298 (patch) | |
tree | 03f96d39222f97ac4bb7086ba24c5754c54c3c0d | |
parent | a0ff652f4cacc3557795204ae5e73fa9f5d2ea30 (diff) | |
download | gdb-3f66685e9e92717af0cafa20480de5548aea7298.zip gdb-3f66685e9e92717af0cafa20480de5548aea7298.tar.gz gdb-3f66685e9e92717af0cafa20480de5548aea7298.tar.bz2 |
gdb: pass inferior to check_pid_namespace_match
Pass the inferior argument available in thread_db_inferior_created, and
use it to do most things requiring the inferior.
check_pid_namespace_match is not completely decoupled from the current
inferior yet, there are hidden references behind target_can_run, for
example. But I think this is still a good step forward.
gdb/ChangeLog:
* linux-thread-db.c (check_pid_namespace_match): Add inferior
parameter and use it.
(thread_db_inferior_created): Pass inferior argument.
Change-Id: Ib768b14fc61dcf115fe13f776691f2c2f36e0679
-rw-r--r-- | gdb/ChangeLog | 6 | ||||
-rw-r--r-- | gdb/linux-thread-db.c | 6 |
2 files changed, 9 insertions, 3 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 0f2a87b..af9d5ab 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,11 @@ 2020-10-24 Simon Marchi <simon.marchi@efficios.com> + * linux-thread-db.c (check_pid_namespace_match): Add inferior + parameter and use it. + (thread_db_inferior_created): Pass inferior argument. + +2020-10-24 Simon Marchi <simon.marchi@efficios.com> + * aix-thread.c (aix_thread_inferior_created): Add inferior parameter. * bsd-uthread.c (bsd_uthread_inferior_created): Likewise. diff --git a/gdb/linux-thread-db.c b/gdb/linux-thread-db.c index e759ecc..7cbdfa5 100644 --- a/gdb/linux-thread-db.c +++ b/gdb/linux-thread-db.c @@ -1286,7 +1286,7 @@ thread_db_new_objfile (struct objfile *objfile) } static void -check_pid_namespace_match (void) +check_pid_namespace_match (inferior *inf) { /* Check is only relevant for local targets targets. */ if (target_can_run ()) @@ -1296,7 +1296,7 @@ check_pid_namespace_match (void) child's thread list, we'll mistakenly think it has no threads since the thread PID fields won't match the PID we give to libthread_db. */ - if (!linux_ns_same (inferior_ptid.pid (), LINUX_NS_PID)) + if (!linux_ns_same (inf->pid, LINUX_NS_PID)) { warning (_ ("Target and debugger are in different PID " "namespaces; thread lists and other data are " @@ -1312,7 +1312,7 @@ check_pid_namespace_match (void) static void thread_db_inferior_created (inferior *inf) { - check_pid_namespace_match (); + check_pid_namespace_match (inf); check_for_thread_db (); } |