immediately, so queue is not needed for them. */
std::vector<stop_reply_up> stop_reply_queue;
+ /* Contains the stop reply packet when first starting the inferior. */
+ gdb::char_vector first_stop_reply;
+
/* FIXME: cagney/1999-09-23: Even though getpkt was called with
``forever'' still use the normal timeout mechanism. This is
currently used by the ASYNC code to guarantee that target reads
ptid_t select_thread_for_ambiguous_stop_reply
(const struct target_waitstatus &status);
+ void supply_early_registers (regcache *regcache) override;
+
void remote_notice_new_inferior (ptid_t currthread, bool executing);
void print_one_stopped_thread (thread_info *thread);
bool start_remote_1 (int from_tty, int extended_p);
+ void supply_expedited_registers (regcache *regcache,
+ std::vector<cached_reg_t> &expedited_regs);
+
/* The remote state. Don't reference this directly. Use the
get_remote_state method instead. */
remote_state m_remote_state;
return first_resumed_thread->ptid;
}
+/* Supply the contents of EXPEDITED_REGS to REGCACHE. */
+
+void
+remote_target::supply_expedited_registers (regcache *regcache,
+ std::vector<cached_reg_t> &expedited_regs)
+{
+ remote_state *rs = get_remote_state ();
+
+ for (cached_reg_t ® : expedited_regs)
+ {
+ regcache->raw_supply (reg.num, reg.data);
+ rs->last_seen_expedited_registers.insert (reg.num);
+ }
+}
+
/* Called when it is decided that STOP_REPLY holds the info of the
event that is to be returned to the core. This function always
destroys STOP_REPLY. */
regcache *regcache
= get_thread_arch_regcache (find_inferior_ptid (this, ptid), ptid,
stop_reply->arch);
-
- for (cached_reg_t ® : stop_reply->regcache)
- {
- regcache->raw_supply (reg.num, reg.data);
- rs->last_seen_expedited_registers.insert (reg.num);
- }
+ supply_expedited_registers (regcache, stop_reply->regcache);
}
remote_thread_info *remote_thr = get_remote_thread_info (this, ptid);
return ptid;
}
+/* See gdb/process-stratum-target.h. */
+
+void
+remote_target::supply_early_registers (regcache *regcache)
+{
+ remote_state *rs = get_remote_state ();
+
+ if (rs->first_stop_reply.empty ())
+ return;
+
+ notif_event_up reply
+ = remote_notif_parse (this, ¬if_client_stop,
+ rs->first_stop_reply.data ());
+ std::vector<cached_reg_t> &expedited_regs
+ = ((struct stop_reply *) reply.get ())->regcache;
+
+ if (!expedited_regs.empty ())
+ supply_expedited_registers (regcache, expedited_regs);
+
+ rs->first_stop_reply.clear ();
+}
+
/* The non-stop mode version of target_wait. */
ptid_t
char **env, int from_tty)
{
int run_worked;
- char *stop_reply;
struct remote_state *rs = get_remote_state ();
const char *remote_exec_file = get_remote_exec_file ();
/* Now restart the remote server. */
run_worked = extended_remote_run (args) != -1;
- if (!run_worked)
+ if (run_worked)
+ /* vRun's success return is a stop reply. */
+ rs->first_stop_reply = rs->buf;
+ else
{
/* vRun was not supported. Fail if we need it to do what the
user requested. */
extended_remote_restart ();
}
- /* vRun's success return is a stop reply. */
- stop_reply = run_worked ? rs->buf.data () : NULL;
- add_current_inferior_and_thread (stop_reply);
+ add_current_inferior_and_thread (run_worked ? rs->buf.data () : nullptr);
/* Get updated offsets, if the stub uses qOffsets. */
get_offsets ();