#include <unordered_map>
#include "target-connection.h"
#include "valprint.h"
+#include "cli/cli-decode.h"
static void generic_tls_error (void) ATTRIBUTE_NORETURN;
static void
open_target (const char *args, int from_tty, struct cmd_list_element *command)
{
- auto *ti = static_cast<target_info *> (get_cmd_context (command));
+ auto *ti = static_cast<target_info *> (command->context ());
target_open_ftype *func = target_factories[ti];
if (targetdebug)
Remaining arguments are interpreted by the target protocol. For more\n\
information on the arguments for a particular protocol, type\n\
`help target ' followed by the protocol name."),
- &targetlist, "target ", 0, &cmdlist);
+ &targetlist, 0, &cmdlist);
c = add_cmd (t.shortname, no_class, t.doc, &targetlist);
- set_cmd_context (c, (void *) &t);
+ c->set_context ((void *) &t);
set_cmd_sfunc (c, open_target);
if (completer != NULL)
set_cmd_completer (c, completer);
see PR cli/15104. */
c = add_cmd (alias, no_class, tinfo.doc, &targetlist);
set_cmd_sfunc (c, open_target);
- set_cmd_context (c, (void *) &tinfo);
+ c->set_context ((void *) &tinfo);
alt = xstrprintf ("target %s", tinfo.shortname);
deprecate_cmd (c, alt);
}
m_stack[stratum] = NULL;
if (m_top == stratum)
- m_top = t->beneath ()->stratum ();
+ m_top = this->find_beneath (t)->stratum ();
/* Finally close the target, if there are no inferiors
referencing this target still. Note we do this after unchaining,
current_inferior ()->top_target ()->commit_resumed ();
}
+/* See target.h. */
+
+bool
+target_has_pending_events ()
+{
+ return current_inferior ()->top_target ()->has_pending_events ();
+}
+
void
target_pass_signals (gdb::array_view<const unsigned char> pass_signals)
{
current_inferior ()->top_target ()->program_signals (program_signals);
}
-static bool
+static void
default_follow_fork (struct target_ops *self, bool follow_child,
bool detach_fork)
{
_("could not find a target to follow fork"));
}
-/* Look through the list of possible targets for a target that can
- follow forks. */
+/* See target.h. */
-bool
+void
target_follow_fork (bool follow_child, bool detach_fork)
{
target_ops *target = current_inferior ()->top_target ();
return target->follow_fork (follow_child, detach_fork);
}
-/* Target wrapper for follow exec hook. */
+/* See target.h. */
void
-target_follow_exec (struct inferior *inf, const char *execd_pathname)
+target_follow_exec (inferior *follow_inf, ptid_t ptid,
+ const char *execd_pathname)
{
- current_inferior ()->top_target ()->follow_exec (inf, execd_pathname);
+ current_inferior ()->top_target ()->follow_exec (follow_inf, ptid,
+ execd_pathname);
}
static void
void
target_close (struct target_ops *targ)
{
- gdb_assert (!current_inferior ()->target_is_pushed (targ));
+ for (inferior *inf : all_inferiors ())
+ gdb_assert (!inf->target_is_pushed (targ));
fileio_handles_invalidate_target (targ);