#include "gdbsupport/byte-vector.h"
#include "terminal.h"
#include <unordered_map>
+#include "target-connection.h"
static void generic_tls_error (void) ATTRIBUTE_NORETURN;
static ptid_t default_get_ada_task_ptid (struct target_ops *self,
long lwp, long tid);
-static int default_follow_fork (struct target_ops *self, int follow_child,
- int detach_fork);
-
static void default_mourn_inferior (struct target_ops *self);
static int default_search_memory (struct target_ops *ops,
{
t->decref ();
if (t->refcount () == 0)
- target_close (t);
+ {
+ if (t->stratum () == process_stratum)
+ connection_list_remove (as_process_stratum_target (t));
+ target_close (t);
+ }
}
/* See target.h. */
strata stratum = t->stratum ();
+ if (stratum == process_stratum)
+ connection_list_add (as_process_stratum_target (t));
+
/* If there's already a target at this stratum, remove it. */
if (m_stack[stratum] != NULL)
/* We only set the internal executing state here. The user/frontend
running state is set at a higher level. This also clears the
thread's stop_pc as side effect. */
- set_executing (curr_target, ptid, 1);
+ set_executing (curr_target, ptid, true);
clear_inline_frame_state (curr_target, ptid);
}
current_top_target ()->program_signals (program_signals);
}
-static int
-default_follow_fork (struct target_ops *self, int follow_child,
- int detach_fork)
+static bool
+default_follow_fork (struct target_ops *self, bool follow_child,
+ bool detach_fork)
{
/* Some target returned a fork event, but did not know how to follow it. */
internal_error (__FILE__, __LINE__,
/* Look through the list of possible targets for a target that can
follow forks. */
-int
-target_follow_fork (int follow_child, int detach_fork)
+bool
+target_follow_fork (bool follow_child, bool detach_fork)
{
return current_top_target ()->follow_fork (follow_child, detach_fork);
}
&& target_always_non_stop_p ()));
}
+/* See target.h. */
+
+bool
+exists_non_stop_target ()
+{
+ if (target_is_non_stop_p ())
+ return true;
+
+ scoped_restore_current_thread restore_thread;
+
+ for (inferior *inf : all_inferiors ())
+ {
+ switch_to_inferior_no_thread (inf);
+ if (target_is_non_stop_p ())
+ return true;
+ }
+
+ return false;
+}
+
/* Controls if targets can report that they always run in non-stop
mode. This is just for maintainers to use when debugging gdb. */
enum auto_boolean target_non_stop_enabled = AUTO_BOOLEAN_AUTO;
update_observer_mode ();
}
+void _initialize_target ();
+
void
_initialize_target ()
{