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);
}
}
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);
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,