From: Samuel Thibault Date: Sat, 30 May 2020 18:44:17 +0000 (+0000) Subject: hurd: fix pushing target on inferior creation X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=078f2fc9c153e6efd1c88b0a34eccc1164f9ae2f;p=binutils-gdb.git hurd: fix pushing target on inferior creation This fixes creating inferiors, which was broken since 5b6d1e4fa ('Multi-target support') gdb/ChangeLog: * gnu-nat.c (gnu_nat_target::create_inferior): Move push_target call before fork_inferior call. Avoid calling it if target_is_pushed returns true. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 67faed176e1..12321b57b03 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2020-05-30 Samuel Thibault + + * gnu-nat.c (gnu_nat_target::create_inferior): Move push_target call + before fork_inferior call. Avoid calling it if target_is_pushed returns + true. + 2020-05-30 Samuel Thibault * gnu-nat.h (gnu_target): New variable declaration. diff --git a/gdb/gnu-nat.c b/gdb/gnu-nat.c index 78e9ab7f717..90732f81296 100644 --- a/gdb/gnu-nat.c +++ b/gdb/gnu-nat.c @@ -2146,6 +2146,9 @@ gnu_nat_target::create_inferior (const char *exec_file, inf_debug (inf, "creating inferior"); + if (!target_is_pushed (this)) + push_target (this); + pid = fork_inferior (exec_file, allargs, env, gnu_ptrace_me, NULL, NULL, NULL, NULL); @@ -2159,8 +2162,6 @@ gnu_nat_target::create_inferior (const char *exec_file, inf_attach (inf, pid); - push_target (this); - inf->pending_execs = 1; inf->nomsg = 1; inf->traced = 1;