/* Interface GDB to the GNU Hurd.
- Copyright (C) 1992-2016 Free Software Foundation, Inc.
+ Copyright (C) 1992-2017 Free Software Foundation, Inc.
This file is part of GDB.
struct inf *inf = cur_inf ();
inf_debug (inf, "tracing self");
if (ptrace (PTRACE_TRACEME) != 0)
- error (_("ptrace (PTRACE_TRACEME) failed!"));
+ trace_start_error_with_name ("ptrace");
}
static void
gnu_create_inferior (struct target_ops *ops,
- char *exec_file, char *allargs, char **env,
+ const char *exec_file, const std::string &allargs,
+ char **env,
int from_tty)
{
struct inf *inf = cur_inf ();
pid = fork_inferior (exec_file, allargs, env, gnu_ptrace_me,
NULL, NULL, NULL, NULL);
+ /* We have something that executes now. We'll be running through
+ the shell at this point (if startup-with-shell is true), but the
+ pid shouldn't change. */
+ add_thread_silent (pid_to_ptid (pid));
+
/* Attach to the now stopped child, which is actually a shell... */
inf_debug (inf, "attaching to child: %d", pid);
thread_change_ptid (inferior_ptid,
ptid_build (inf->pid, inf_pick_first_thread (), 0));
- startup_inferior (START_INFERIOR_TRAPS_EXPECTED);
+ gdb_startup_inferior (pid, START_INFERIOR_TRAPS_EXPECTED);
+
inf->pending_execs = 0;
+ /* Get rid of the old shell threads. */
+ prune_threads ();
inf_validate_procinfo (inf);
inf_update_signal_thread (inf);
return tid_str;
}
-static char *
+static const char *
gnu_pid_to_str (struct target_ops *ops, ptid_t ptid)
{
struct inf *inf = gnu_current_inf;