+2021-03-23 Simon Marchi <simon.marchi@polymtl.ca>
+
+ * target.h (unpush_target): Remove, update all callers
+ to use `inferior::unpush_target` instead.
+ (struct target_unpusher) <operator()>: Just declare.
+ * target.c (unpush_target): Remove.
+ (target_unpusher::operator()): New.
+
2021-03-22 Andrew Burgess <andrew.burgess@embecosm.com>
* dwarf2/read.c (process_psymtab_comp_unit): Replace abort with an
if (pd_active)
pd_deactivate ();
pd_able = 0;
- unpush_target (&aix_thread_ops);
+ current_inferior ()->unpush_target (&aix_thread_ops);
}
/* new_objfile observer callback.
error (("%s"), errbuf);
bsd_kvm_corefile = filename;
- unpush_target (&bsd_kvm_ops);
+ current_inferior ()->unpush_target (&bsd_kvm_ops);
core_kd = temp_kd;
push_target (&bsd_kvm_ops);
if (!bsd_uthread_active)
return;
- unpush_target (&bsd_uthread_ops);
+ current_inferior ()->unpush_target (&bsd_uthread_ops);
}
static void
/* Note that 'this' is dangling after this call. unpush_target
closes the target, and our close implementation deletes
'this'. */
- unpush_target (this);
+ inf->unpush_target (this);
/* Clear the register cache and the frame cache. */
registers_changed ();
continue;
switch_to_inferior_no_thread (inf);
- unpush_target (&exec_ops);
+ inf->unpush_target (&exec_ops);
}
}
}
inf_child_target::maybe_unpush_target ()
{
if (!inf_child_explicitly_opened)
- unpush_target (this);
+ current_inferior ()->unpush_target (this);
}
void
/* NOTE: From this point on, inferior_ptid is null_ptid. */
/* Detach the thread_db target from this inferior. */
- unpush_target (this);
+ inf->unpush_target (this);
}
ptid_t
/* New image, it may or may not end up using thread_db. Assume
not unless we find otherwise. */
delete_thread_db_info (beneath, ptid.pid ());
- unpush_target (this);
+ current_inferior ()->unpush_target (this);
return ptid;
}
target_beneath->mourn_inferior ();
/* Detach the thread_db target from this inferior. */
- unpush_target (this);
+ current_inferior ()->unpush_target (this);
}
struct callback_data
{
m_base_ptid = null_ptid;
target_ops *beneath = this->beneath ();
- unpush_target (this);
+ current_inferior ()->unpush_target (this);
beneath->mourn_inferior ();
}
struct target_ops *beneath = this->beneath ();
/* Do not stop recording, just clean up GDB side. */
- unpush_target (this);
+ current_inferior ()->unpush_target (this);
/* Forward disconnect. */
beneath->disconnect (args, from_tty);
if (record_debug)
fprintf_unfiltered (gdb_stdlog, "Process record: record_full_core_kill\n");
- unpush_target (this);
+ current_inferior ()->unpush_target (this);
}
/* "fetch_registers" method for prec over corefile. */
{
DEBUG ("unpush %s", t->shortname ());
- unpush_target (t);
+ current_inferior ()->unpush_target (t);
}
/* See record.h. */
operation until after we complete those operations which could
error out. */
if (gdbsim_is_open)
- unpush_target (&gdbsim_ops);
+ current_inferior ()->unpush_target (&gdbsim_ops);
len = (7 + 1 /* gdbsim */
+ strlen (" -E little")
if (remote_debug)
fprintf_unfiltered (gdb_stdlog, "gdbsim_detach\n");
- unpush_target (this); /* calls gdbsim_close to do the real work */
+ inf->unpush_target (this); /* calls gdbsim_close to do the real work */
if (from_tty)
printf_filtered ("Ending simulator %s debugging\n", target_shortname);
}
sol_thread_active = 0;
inferior_ptid = ptid_t (main_ph.ptid.pid ());
- unpush_target (this);
+ inf->unpush_target (this);
beneath->detach (inf, from_tty);
}
sol_thread_active = 0;
- unpush_target (this);
+ current_inferior ()->unpush_target (this);
beneath->mourn_inferior ();
}
if (targetdebug)
push_target (the_debug_target);
else
- unpush_target (the_debug_target);
+ current_inferior ()->unpush_target (the_debug_target);
}
static void
/* See target.h. */
-int
-unpush_target (struct target_ops *t)
-{
- return current_inferior ()->unpush_target (t);
-}
-
-/* See target.h. */
-
bool
target_stack::unpush (target_ops *t)
{
static void
unpush_target_and_assert (struct target_ops *target)
{
- if (!unpush_target (target))
+ if (!current_inferior ()->unpush_target (target))
{
fprintf_unfiltered (gdb_stderr,
"pop_all_targets couldn't find target %s\n",
return current_inferior ()->target_is_pushed (t);
}
+void
+target_unpusher::operator() (struct target_ops *ops) const
+{
+ current_inferior ()->unpush_target (ops);
+}
+
/* Default implementation of to_get_thread_local_address. */
static void
/* An overload that deletes the target on failure. */
extern void push_target (target_ops_up &&);
-extern int unpush_target (struct target_ops *);
-
/* A unique_ptr helper to unpush a target. */
struct target_unpusher
{
- void operator() (struct target_ops *ops) const
- {
- unpush_target (ops);
- }
+ void operator() (struct target_ops *ops) const;
};
/* A unique_ptr that unpushes a target on destruction. */
/* Looks semi-reasonable. Toss the old trace file and work on the new. */
- unpush_target (&tfile_ops);
+ current_inferior ()->unpush_target (&tfile_ops);
trace_filename = filename.release ();
trace_fd = scratch_chan;
catch (const gdb_exception &ex)
{
/* Remove the partially set up target. */
- unpush_target (&tfile_ops);
+ current_inferior ()->unpush_target (&tfile_ops);
throw;
}