void packet_command (const char *args, int from_tty);
+ void commit_resumed (ptid_t filter);
+
private: /* data fields */
/* The remote state. Don't reference this directly. Use the
}
if (inf == nullptr)
{
+ gdb_assert(0);
/* Since all inferiors were already bound to a process, add
a new inferior. */
inf = add_inferior_with_spaces ();
+
}
switch_to_inferior_no_thread (inf);
inf->push_target (this);
the inferiors. */
if (!non_stop)
{
- stop_all_threads ();
+ stop_all_threads ("remote connect in all-stop");
/* If all threads of an inferior were already stopped, we
haven't setup the inferior yet. */
void
remote_target::commit_resumed ()
+{
+ this->commit_resumed (minus_one_ptid);
+}
+
+void
+remote_target::commit_resumed (ptid_t filter)
{
/* If connected in all-stop mode, we'd send the remote resume
request directly from remote_resume. Likewise if
(vCont;c). We can still send process-wide wildcards though. */
/* Start by assuming a global wildcard (vCont;c) is possible. */
- bool may_global_wildcard_vcont = true;
+ bool may_global_wildcard_vcont = filter == minus_one_ptid;
/* And assume every process is individually wildcard-able too. */
for (inferior *inf : all_non_exited_inferiors (this))
{
remote_inferior *priv = get_remote_inferior (inf);
- priv->may_wildcard_vcont = true;
+ priv->may_wildcard_vcont = filter == minus_one_ptid || (filter.is_pid () && inf->pid == filter.pid ());
}
/* Check for any pending events (not reported or processed yet) and
bool any_pending_vcont_resume = false;
- for (thread_info *tp : all_non_exited_threads (this))
+ for (thread_info *tp : all_non_exited_threads (this, filter))
{
remote_thread_info *priv = get_remote_thread_info (tp);
struct vcont_builder vcont_builder (this);
/* Threads first. */
- for (thread_info *tp : all_non_exited_threads (this))
+ for (thread_info *tp : all_non_exited_threads (this, filter))
{
remote_thread_info *remote_thr = get_remote_thread_info (tp);
}
if (needs_commit)
- commit_resumed ();
+ commit_resumed (ptid);
else
for (thread_info *tp : all_non_exited_threads (this, ptid))
{
/* We have tried hard enough, and just can't receive the
packet/notification. Give up. */
printf_unfiltered (_("Ignoring packet error, continuing...\n"));
+ gdb_assert(0);
+
+
/* Skip the ack char if we're in no-ack mode. */
if (!rs->noack_mode)
discard_pending_stop_replies (current_inferior ());
/* In 'target remote' mode with one inferior, we close the connection. */
- if (!rs->extended && number_of_live_inferiors (this) <= 1)
+ if (!rs->extended)
{
- remote_unpush_target (this);
- return;
+ // needed to make the test not hang at exit with native-gdbserver, should be investigated
+ if (number_of_live_inferiors (this) <= 1)
+ {
+ remote_unpush_target (this);
+ return;
+ }
+ else
+ pop_all_targets_at_and_above (process_stratum);
}
/* In case we got here due to an error, but we're going to stay
char *p = rs->buf.data ();
int left = get_remote_packet_size () - 1;
+ REMOTE_SCOPED_DEBUG_ENTER_EXIT;
+ remote_debug_printf ("inf=%d, filename=%s", inf != nullptr ? inf->num : -1, filename);
+
if (warn_if_slow)
{
static int warning_issued = 0;