int
target_has_all_memory_1 (void)
{
- struct target_ops *t;
-
- for (t = current_top_target (); t != NULL; t = t->beneath)
+ for (target_ops *t = current_top_target (); t != NULL; t = t->beneath ())
if (t->has_all_memory ())
return 1;
int
target_has_memory_1 (void)
{
- struct target_ops *t;
-
- for (t = current_top_target (); t != NULL; t = t->beneath)
+ for (target_ops *t = current_top_target (); t != NULL; t = t->beneath ())
if (t->has_memory ())
return 1;
int
target_has_stack_1 (void)
{
- struct target_ops *t;
-
- for (t = current_top_target (); t != NULL; t = t->beneath)
+ for (target_ops *t = current_top_target (); t != NULL; t = t->beneath ())
if (t->has_stack ())
return 1;
int
target_has_registers_1 (void)
{
- struct target_ops *t;
-
- for (t = current_top_target (); t != NULL; t = t->beneath)
+ for (target_ops *t = current_top_target (); t != NULL; t = t->beneath ())
if (t->has_registers ())
return 1;
int
target_has_execution_1 (ptid_t the_ptid)
{
- struct target_ops *t;
-
- for (t = current_top_target (); t != NULL; t = t->beneath)
+ for (target_ops *t = current_top_target (); t != NULL; t = t->beneath ())
if (t->has_execution (the_ptid))
return 1;
struct target_ops **cur;
/* Find the proper stratum to install this target in. */
- for (cur = &g_current_top_target; (*cur) != NULL; cur = &(*cur)->beneath)
+ for (cur = &g_current_top_target; (*cur) != NULL; cur = &(*cur)->m_beneath)
{
if ((int) (t->to_stratum) >= (int) (*cur)->to_stratum)
break;
and un-hook it from the stack. */
struct target_ops *tmp = (*cur);
- (*cur) = (*cur)->beneath;
- tmp->beneath = NULL;
+ (*cur) = (*cur)->m_beneath;
+ tmp->m_beneath = NULL;
target_close (tmp);
}
/* We have removed all targets in our stratum, now add the new one. */
- t->beneath = (*cur);
+ t->m_beneath = (*cur);
(*cur) = t;
}
/* Look for the specified target. Note that we assume that a target
can only occur once in the target stack. */
- for (cur = &g_current_top_target; (*cur) != NULL; cur = &(*cur)->beneath)
+ for (cur = &g_current_top_target; (*cur) != NULL; cur = &(*cur)->m_beneath)
{
if ((*cur) == t)
break;
/* Unchain the target. */
tmp = (*cur);
- (*cur) = (*cur)->beneath;
- tmp->beneath = NULL;
+ (*cur) = (*cur)->m_beneath;
+ tmp->m_beneath = NULL;
/* Finally close the target. Note we do this after unchaining, so
any target method calls from within the target_close
int
target_is_pushed (struct target_ops *t)
{
- struct target_ops *cur;
-
- for (cur = current_top_target (); cur != NULL; cur = cur->beneath)
+ for (target_ops *cur = current_top_target ();
+ cur != NULL;
+ cur = cur->beneath ())
if (cur == t)
return 1;
if (ops->has_all_memory ())
break;
- ops = ops->beneath;
+ ops = ops->beneath ();
}
while (ops != NULL);
static void
info_target_command (const char *args, int from_tty)
{
- struct target_ops *t;
int has_all_mem = 0;
if (symfile_objfile != NULL)
printf_unfiltered (_("Symbols from \"%s\".\n"),
objfile_name (symfile_objfile));
- for (t = current_top_target (); t != NULL; t = t->beneath)
+ for (target_ops *t = current_top_target (); t != NULL; t = t->beneath ())
{
if (!t->has_memory ())
continue;
void
target_require_runnable (void)
{
- struct target_ops *t;
-
- for (t = current_top_target (); t != NULL; t = t->beneath)
+ for (target_ops *t = current_top_target (); t != NULL; t = t->beneath ())
{
/* If this target knows how to create a new program, then
assume we will still be able to after killing the current
find_attach_target (void)
{
/* If a target on the current stack can attach, use it. */
- for (target_ops *t = current_top_target (); t != NULL; t = t->beneath)
+ for (target_ops *t = current_top_target (); t != NULL; t = t->beneath ())
{
if (t->can_attach ())
return t;
find_run_target (void)
{
/* If a target on the current stack can run, use it. */
- for (target_ops *t = current_top_target (); t != NULL; t = t->beneath)
+ for (target_ops *t = current_top_target (); t != NULL; t = t->beneath ())
{
if (t->can_create_inferior ())
return t;
if (t == NULL)
t = find_default_run_target (NULL);
- for (; t != NULL; t = t->beneath)
+ for (; t != NULL; t = t->beneath ())
{
if (t->info_proc (args, what))
{
return aspace;
}
+/* See target.h. */
+
+target_ops *
+target_ops::beneath () const
+{
+ return m_beneath;
+}
+
void
target_ops::close ()
{
int
target_can_run ()
{
- struct target_ops *t;
-
- for (t = current_top_target (); t != NULL; t = t->beneath)
+ for (target_ops *t = current_top_target (); t != NULL; t = t->beneath ())
{
if (t->can_run ())
return 1;
int flags, int mode, int warn_if_slow,
int *target_errno)
{
- struct target_ops *t;
-
- for (t = default_fileio_target (); t != NULL; t = t->beneath)
+ for (target_ops *t = default_fileio_target (); t != NULL; t = t->beneath ())
{
int fd = t->fileio_open (inf, filename, flags, mode,
warn_if_slow, target_errno);
target_fileio_unlink (struct inferior *inf, const char *filename,
int *target_errno)
{
- struct target_ops *t;
-
- for (t = default_fileio_target (); t != NULL; t = t->beneath)
+ for (target_ops *t = default_fileio_target (); t != NULL; t = t->beneath ())
{
int ret = t->fileio_unlink (inf, filename, target_errno);
target_fileio_readlink (struct inferior *inf, const char *filename,
int *target_errno)
{
- struct target_ops *t;
-
- for (t = default_fileio_target (); t != NULL; t = t->beneath)
+ for (target_ops *t = default_fileio_target (); t != NULL; t = t->beneath ())
{
gdb::optional<std::string> ret
= t->fileio_readlink (inf, filename, target_errno);
struct target_ops *
find_target_beneath (struct target_ops *t)
{
- return t->beneath;
+ return t->beneath ();
}
/* See target.h. */
struct target_ops *
find_target_at (enum strata stratum)
{
- struct target_ops *t;
-
- for (t = current_top_target (); t != NULL; t = t->beneath)
+ for (target_ops *t = current_top_target (); t != NULL; t = t->beneath ())
if (t->to_stratum == stratum)
return t;
const target_info &
debug_target::info () const
{
- return beneath->info ();
+ return beneath ()->info ();
}
\f
static void
maintenance_print_target_stack (const char *cmd, int from_tty)
{
- struct target_ops *t;
-
printf_filtered (_("The current target stack is:\n"));
- for (t = current_top_target (); t != NULL; t = t->beneath)
+ for (target_ops *t = current_top_target (); t != NULL; t = t->beneath ())
{
if (t->to_stratum == debug_stratum)
continue;