[PATCH v2 26/47] gdb: use the pid from inferior in setup_inferior

Tankut Baris Aktemur
2024-12-13T16:18:35Z

This is a step to reduce the dependency on the global inferior_ptid
variable.
---
gdb/infcmd.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index 5c0e3f51162803d2aa4e4ca0b41475d616deda29..27473123c1a0b2702b81d0b28c41931b4e39dd52 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -2501,7 +2501,7 @@ setup_inferior (int from_tty)
/* If no exec file is yet known, try to determine it from the
process itself. */
if (current_program_space->exec_filename () == nullptr)
- exec_file_locate_attach (inferior_ptid.pid (), 1, from_tty);
+ exec_file_locate_attach (inferior->pid, 1, from_tty);
else
{
reopen_exec_file ();
@@ -2509,7 +2509,7 @@ setup_inferior (int from_tty)
}

/* Take any necessary post-attaching actions for this platform. */
- target_post_attach (inferior_ptid.pid ());
+ target_post_attach (inferior->pid);

post_create_inferior (from_tty);
}