/* Base/prototype target for default child (native) targets.
- Copyright (C) 1988-2018 Free Software Foundation, Inc.
+ Copyright (C) 1988-2019 Free Software Foundation, Inc.
This file is part of GDB.
#include "inferior.h"
#include <sys/stat.h>
#include "inf-child.h"
-#include "fileio.h"
-#include "agent.h"
-#include "gdb_wait.h"
-#include "filestuff.h"
+#include "gdbsupport/fileio.h"
+#include "gdbsupport/agent.h"
+#include "gdbsupport/gdb_wait.h"
+#include "gdbsupport/filestuff.h"
#include <sys/types.h>
#include <fcntl.h>
#include <unistd.h>
+static const target_info inf_child_target_info = {
+ "native",
+ N_("Native process"),
+ N_("Native process (started by the \"run\" command).")
+};
+
+const target_info &
+inf_child_target::info () const
+{
+ return inf_child_target_info;
+}
+
/* Helper function for child_wait and the derivatives of child_wait.
HOSTSTATUS is the waitstatus from wait() or the equivalent; store our
translation of that in OURSTATUS. */
child_terminal_inferior (this);
}
+void
+inf_child_target::terminal_save_inferior ()
+{
+ child_terminal_save_inferior (this);
+}
+
void
inf_child_target::terminal_ours_for_output ()
{
/* See inf-child.h. */
void
-inf_child_open_target (struct target_ops *target, const char *arg,
- int from_tty)
+inf_child_open_target (const char *arg, int from_tty)
{
+ target_ops *target = get_native_target ();
+
+ /* There's always only ever one native target, and if we get here,
+ it better be an inf-child target. */
+ gdb_assert (dynamic_cast<inf_child_target *> (target) != NULL);
+
target_preopen (from_tty);
push_target (target);
inf_child_explicitly_opened = 1;
printf_filtered ("Done. Use the \"run\" command to start a process.\n");
}
-void
-inf_child_target::open (const char *arg, int from_tty)
-{
- inf_child_open_target (this, arg, from_tty);
-}
-
/* Implement the to_disconnect target_ops method. */
void
return NULL;
}
-bool
-inf_child_target::has_all_memory ()
-{
- return default_child_has_all_memory ();
-}
-
-bool
-inf_child_target::has_memory ()
-{
- return default_child_has_memory ();
-}
-
-bool
-inf_child_target::has_stack ()
-{
- return default_child_has_stack ();
-}
-
-bool
-inf_child_target::has_registers ()
-{
- return default_child_has_registers ();
-}
-
-bool
-inf_child_target::has_execution (ptid_t ptid)
-{
- return default_child_has_execution (ptid);
-}
-
/* Implementation of to_fileio_open. */
int
return agent_loaded_p ();
}
-inf_child_target::inf_child_target ()
+/* See inf-child.h. */
+
+void
+add_inf_child_target (inf_child_target *target)
{
- this->to_stratum = process_stratum;
+ set_native_target (target);
+ add_target (inf_child_target_info, inf_child_open_target);
}