const struct btrace_config *btrace_conf (const struct btrace_target_info *) override;
bool augmented_libraries_svr4_read () override;
void follow_fork (bool, bool) override;
- void follow_exec (struct inferior *, const char *) override;
+ void follow_exec (inferior *, ptid_t, const char *) override;
int insert_fork_catchpoint (int) override;
int remove_fork_catchpoint (int) override;
int insert_vfork_catchpoint (int) override;
int stop_reply_queue_length ();
void check_pending_events_prevent_wildcard_vcont
- (int *may_global_wildcard_vcont);
+ (bool *may_global_wildcard_vcont);
void discard_pending_stop_replies_in_queue ();
struct stop_reply *remote_notif_remove_queued_reply (ptid_t ptid);
name, title);
/* set/show TITLE-packet {auto,on,off} */
cmd_name = xstrprintf ("%s-packet", title);
- add_setshow_auto_boolean_cmd (cmd_name, class_obscure,
- &config->detect, set_doc,
- show_doc, NULL, /* help_doc */
- NULL,
- show_remote_protocol_packet_cmd,
- &remote_set_cmdlist, &remote_show_cmdlist);
+ set_show_commands cmds
+ = add_setshow_auto_boolean_cmd (cmd_name, class_obscure,
+ &config->detect, set_doc,
+ show_doc, NULL, /* help_doc */
+ NULL,
+ show_remote_protocol_packet_cmd,
+ &remote_set_cmdlist, &remote_show_cmdlist);
+
/* The command code copies the documentation strings. */
xfree (set_doc);
xfree (show_doc);
+
/* set/show remote NAME-packet {auto,on,off} -- legacy. */
if (legacy)
{
char *legacy_name;
legacy_name = xstrprintf ("%s-packet", name);
- add_alias_cmd (legacy_name, cmd_name, class_obscure, 0,
+ add_alias_cmd (legacy_name, cmds.set, class_obscure, 0,
&remote_set_cmdlist);
- add_alias_cmd (legacy_name, cmd_name, class_obscure, 0,
+ add_alias_cmd (legacy_name, cmds.show, class_obscure, 0,
&remote_show_cmdlist);
}
}
Ctrl-C before we're connected and synced up can't interrupt the
target. Instead, it offers to drop the (potentially wedged)
connection. */
- rs->starting_up = 1;
+ rs->starting_up = true;
QUIT;
/* We're connected, but not running. Drop out before we
call start_remote. */
- rs->starting_up = 0;
+ rs->starting_up = false;
return;
}
else
/* We're connected, but not running. Drop out before we
call start_remote. */
- rs->starting_up = 0;
+ rs->starting_up = false;
return;
}
target, our symbols have been relocated, and we're merged the
target's tracepoints with ours. We're done with basic start
up. */
- rs->starting_up = 0;
+ rs->starting_up = false;
/* Maybe breakpoints are global and need to be inserted now. */
if (breakpoints_should_be_inserted_now ())
}
/* Target follow-exec function for remote targets. Save EXECD_PATHNAME
- in the program space of the new inferior. On entry and at return the
- current inferior is the exec'ing inferior. INF is the new exec'd
- inferior, which may be the same as the exec'ing inferior unless
- follow-exec-mode is "new". */
+ in the program space of the new inferior. */
void
-remote_target::follow_exec (struct inferior *inf, const char *execd_pathname)
+remote_target::follow_exec (inferior *follow_inf, ptid_t ptid,
+ const char *execd_pathname)
{
+ process_stratum_target::follow_exec (follow_inf, ptid, execd_pathname);
+
/* We know that this is a target file name, so if it has the "target:"
prefix we strip it off before saving it in the program space. */
if (is_target_filename (execd_pathname))
execd_pathname += strlen (TARGET_SYSROOT_PREFIX);
- set_pspace_remote_exec_file (inf->pspace, execd_pathname);
+ set_pspace_remote_exec_file (follow_inf->pspace, execd_pathname);
}
/* Same as remote_detach, but don't send the "D" packet; just disconnect. */
void
remote_target::commit_resumed ()
{
- int any_process_wildcard;
- int may_global_wildcard_vcont;
-
/* If connected in all-stop mode, we'd send the remote resume
request directly from remote_resume. Likewise if
reverse-debugging, as there are no defined vCont actions for
(vCont;c). We can still send process-wide wildcards though. */
/* Start by assuming a global wildcard (vCont;c) is possible. */
- may_global_wildcard_vcont = 1;
+ bool may_global_wildcard_vcont = true;
/* And assume every process is individually wildcard-able too. */
for (inferior *inf : all_non_exited_inferiors (this))
/* And if we can't wildcard a process, we can't wildcard
everything either. */
- may_global_wildcard_vcont = 0;
+ may_global_wildcard_vcont = false;
continue;
}
can't do a global wildcard, as that would resume the fork
child. */
if (is_pending_fork_parent_thread (tp))
- may_global_wildcard_vcont = 0;
+ may_global_wildcard_vcont = false;
}
/* We didn't have any resumed thread pending a vCont resume, so nothing to
/* Now check whether we can send any process-wide wildcard. This is
to avoid sending a global wildcard in the case nothing is
supposed to be resumed. */
- any_process_wildcard = 0;
+ bool any_process_wildcard = false;
for (inferior *inf : all_non_exited_inferiors (this))
{
if (get_remote_inferior (inf)->may_wildcard_vcont)
{
- any_process_wildcard = 1;
+ any_process_wildcard = true;
break;
}
}
context->remove_thread (event->ws.value.related_pid);
}
-/* Check whether any event pending in the vStopped queue would prevent
- a global or process wildcard vCont action. Clear
- *may_global_wildcard if we can't do a global wildcard (vCont;c),
- and clear the event inferior's may_wildcard_vcont flag if we can't
- do a process-wide wildcard resume (vCont;c:pPID.-1). */
+/* Check whether any event pending in the vStopped queue would prevent a
+ global or process wildcard vCont action. Set *may_global_wildcard to
+ false if we can't do a global wildcard (vCont;c), and clear the event
+ inferior's may_wildcard_vcont flag if we can't do a process-wide
+ wildcard resume (vCont;c:pPID.-1). */
void
remote_target::check_pending_events_prevent_wildcard_vcont
- (int *may_global_wildcard)
+ (bool *may_global_wildcard)
{
struct notif_client *notif = ¬if_client_stop;
if (event->ws.kind == TARGET_WAITKIND_FORKED
|| event->ws.kind == TARGET_WAITKIND_VFORKED)
- *may_global_wildcard = 0;
+ *may_global_wildcard = false;
/* This may be the first time we heard about this process.
Regardless, we must not do a global wildcard resume, otherwise
we'd resume this process too. */
- *may_global_wildcard = 0;
+ *may_global_wildcard = false;
if (event->ptid != null_ptid)
{
inferior *inf = find_inferior_ptid (this, event->ptid);
remote_target::select_thread_for_ambiguous_stop_reply
(const struct target_waitstatus *status)
{
+ REMOTE_SCOPED_DEBUG_ENTER_EXIT;
+
/* Some stop events apply to all threads in an inferior, while others
only apply to a single thread. */
bool process_wide_stop
= (status->kind == TARGET_WAITKIND_EXITED
|| status->kind == TARGET_WAITKIND_SIGNALLED);
+ remote_debug_printf ("process_wide_stop = %d", process_wide_stop);
+
thread_info *first_resumed_thread = nullptr;
bool ambiguous = false;
ambiguous = true;
}
+ remote_debug_printf ("first resumed thread is %s",
+ pid_to_str (first_resumed_thread->ptid).c_str ());
+ remote_debug_printf ("is this guess ambiguous? = %d", ambiguous);
+
gdb_assert (first_resumed_thread != nullptr);
/* Warn if the remote target is sending ambiguous stop replies. */
{
int repeat;
- csum += c;
+ csum += c;
c = readchar (remote_timeout);
csum += c;
repeat = c - ' ' + 3; /* Compute repeat count. */
{
struct remote_state *rs = get_remote_state ();
char *reply;
- struct bp_location *loc;
struct tracepoint *tp = (struct tracepoint *) bp;
size_t size = get_remote_packet_size ();
{
tp->hit_count = 0;
tp->traceframe_usage = 0;
- for (loc = tp->loc; loc; loc = loc->next)
+ for (bp_location *loc : tp->locations ())
{
/* If the tracepoint was never downloaded, don't go asking for
any status. */
{
remote_target *remote = get_current_remote_target ();
- if (remote != NULL) /* Have a remote connection. */
- remote->remote_check_symbols ();
+ /* First, check whether the current inferior's process target is a remote
+ target. */
+ if (remote == nullptr)
+ return;
+
+ /* When we are attaching or handling a fork child and the shared library
+ subsystem reads the list of loaded libraries, we receive new objfile
+ events in between each found library. The libraries are read in an
+ undefined order, so if we gave the remote side a chance to look up
+ symbols between each objfile, we might give it an inconsistent picture
+ of the inferior. It could appear that a library A appears loaded but
+ a library B does not, even though library A requires library B. That
+ would present a state that couldn't normally exist in the inferior.
+
+ So, skip these events, we'll give the remote a chance to look up symbols
+ once all the loaded libraries and their symbols are known to GDB. */
+ if (current_inferior ()->in_initial_library_scan)
+ return;
+
+ remote->remote_check_symbols ();
}
/* Pull all the tracepoints defined on the target and create local
void
_initialize_remote ()
{
- struct cmd_list_element *cmd;
- const char *cmd_name;
-
/* architecture specific data */
remote_g_packet_data_handle =
gdbarch_data_register_pre_init (remote_g_packet_data_init);
Remote protocol specific variables.\n\
Configure various remote-protocol specific variables such as\n\
the packets being used."),
- &remote_set_cmdlist, "set remote ",
+ &remote_set_cmdlist,
0 /* allow-unknown */, &setlist);
add_prefix_cmd ("remote", class_maintenance, show_remote_cmd, _("\
Remote protocol specific variables.\n\
Configure various remote-protocol specific variables such as\n\
the packets being used."),
- &remote_show_cmdlist, "show remote ",
+ &remote_show_cmdlist,
0 /* allow-unknown */, &showlist);
add_cmd ("compare-sections", class_obscure, compare_sections_command, _("\
terminating `#' character and checksum."),
&maintenancelist);
- add_setshow_boolean_cmd ("remotebreak", no_class, &remote_break, _("\
+ set_show_commands remotebreak_cmds
+ = add_setshow_boolean_cmd ("remotebreak", no_class, &remote_break, _("\
Set whether to send break if interrupted."), _("\
Show whether to send break if interrupted."), _("\
If set, a break, instead of a cntrl-c, is sent to the remote target."),
- set_remotebreak, show_remotebreak,
- &setlist, &showlist);
- cmd_name = "remotebreak";
- cmd = lookup_cmd (&cmd_name, setlist, "", NULL, -1, 1);
- deprecate_cmd (cmd, "set remote interrupt-sequence");
- cmd_name = "remotebreak"; /* needed because lookup_cmd updates the pointer */
- cmd = lookup_cmd (&cmd_name, showlist, "", NULL, -1, 1);
- deprecate_cmd (cmd, "show remote interrupt-sequence");
+ set_remotebreak, show_remotebreak,
+ &setlist, &showlist);
+ deprecate_cmd (remotebreak_cmds.set, "set remote interrupt-sequence");
+ deprecate_cmd (remotebreak_cmds.show, "show remote interrupt-sequence");
add_setshow_enum_cmd ("interrupt-sequence", class_support,
interrupt_sequence_modes, &interrupt_sequence_mode,
add_basic_prefix_cmd ("remote", class_files, _("\
Manipulate files on the remote system.\n\
Transfer files to and from the remote target system."),
- &remote_cmdlist, "remote ",
+ &remote_cmdlist,
0 /* allow-unknown */, &cmdlist);
add_cmd ("put", class_files, remote_put_command,