hurd: fix pushing target on inferior creation
authorSamuel Thibault <samuel.thibault@ens-lyon.org>
Sat, 30 May 2020 18:44:17 +0000 (18:44 +0000)
committerSamuel Thibault <samuel.thibault@ens-lyon.org>
Sat, 30 May 2020 18:44:17 +0000 (18:44 +0000)
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.

gdb/ChangeLog
gdb/gnu-nat.c

index 67faed176e1d05a2bfa915fde265403defed28f1..12321b57b035ffbce36310b6e2816dede26a8607 100644 (file)
@@ -1,3 +1,9 @@
+2020-05-30  Samuel Thibault  <samuel.thibault@ens-lyon.org>
+
+       * 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  <samuel.thibault@ens-lyon.org>
 
        * gnu-nat.h (gnu_target): New variable declaration.
index 78e9ab7f717b13576b1de55b9ffae879daa6fd91..90732f812961707c84064baff12390b063f753df 100644 (file)
@@ -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;