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 ();
/* We have to initialize the terminal settings now, since the code
below might try to restore them. */
- target_terminal_init ();
+ target_terminal::init ();
/* If the process was stopped before we attached, make it continue the next
time the user does a continue. */
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;
&thread_cmd_list);
}
-\f
-
-/* -Wmissing-prototypes */
-extern initialize_file_ftype _initialize_gnu_nat;
-
void
_initialize_gnu_nat (void)
{