X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=gdb%2Fremote.c;h=42c730e48fb9f7d37dfd47e57accc961c3655690;hb=268a13a5a3f7c6b9b6ffc5ac2d1b24eb41f3fbdc;hp=4b3f2907b43806c158e6fda33e7e1a2d97ac40d1;hpb=be6d4f74c77c6f521afc873d226480e001cb99c2;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/remote.c b/gdb/remote.c index 4b3f2907b4..42c730e48f 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -42,12 +42,12 @@ #include "cli/cli-setshow.h" #include "target-descriptions.h" #include "gdb_bfd.h" -#include "filestuff.h" -#include "rsp-low.h" +#include "gdbsupport/filestuff.h" +#include "gdbsupport/rsp-low.h" #include "disasm.h" #include "location.h" -#include "gdb_sys_time.h" +#include "gdbsupport/gdb_sys_time.h" #include "event-loop.h" #include "event-top.h" @@ -68,13 +68,13 @@ #include "tracepoint.h" #include "ax.h" #include "ax-gdb.h" -#include "agent.h" +#include "gdbsupport/agent.h" #include "btrace.h" #include "record-btrace.h" #include -#include "common/scoped_restore.h" -#include "environ.h" -#include "common/byte-vector.h" +#include "gdbsupport/scoped_restore.h" +#include "gdbsupport/environ.h" +#include "gdbsupport/byte-vector.h" #include /* The remote target. */ @@ -96,17 +96,7 @@ struct protocol_feature; struct packet_reg; struct stop_reply; -static void stop_reply_xfree (struct stop_reply *); - -struct stop_reply_deleter -{ - void operator() (stop_reply *r) const - { - stop_reply_xfree (r); - } -}; - -typedef std::unique_ptr stop_reply_up; +typedef std::unique_ptr stop_reply_up; /* Generic configuration support for packets the stub optionally supports. Allows the user to specify the use of the packet as well @@ -472,12 +462,12 @@ public: void mourn_inferior () override; - void pass_signals (int, const unsigned char *) override; + void pass_signals (gdb::array_view) override; int set_syscall_catchpoint (int, bool, int, gdb::array_view) override; - void program_signals (int, const unsigned char *) override; + void program_signals (gdb::array_view) override; bool thread_alive (ptid_t ptid) override; @@ -485,7 +475,7 @@ public: void update_thread_list () override; - const char *pid_to_str (ptid_t) override; + std::string pid_to_str (ptid_t) override; const char *extra_thread_info (struct thread_info *) override; @@ -495,6 +485,9 @@ public: int handle_len, inferior *inf) override; + gdb::byte_vector thread_info_to_thread_handle (struct thread_info *tp) + override; + void stop (ptid_t) override; void interrupt () override; @@ -674,7 +667,7 @@ public: const struct btrace_config *btrace_conf (const struct btrace_target_info *) override; bool augmented_libraries_svr4_read () override; int follow_fork (int, int) override; - void follow_exec (struct inferior *, char *) override; + void follow_exec (struct inferior *, const char *) override; int insert_fork_catchpoint (int) override; int remove_fork_catchpoint (int) override; int insert_vfork_catchpoint (int) override; @@ -774,7 +767,7 @@ public: /* Remote specific methods. */ char *remote_get_noisy_reply (); int remote_query_attached (int pid); - inferior *remote_add_inferior (int fake_pid_p, int pid, int attached, + inferior *remote_add_inferior (bool fake_pid_p, int pid, int attached, int try_open_exec); ptid_t remote_current_thread (ptid_t oldpid); @@ -976,7 +969,8 @@ public: }; /* Per-program-space data key. */ -static const struct program_space_data *remote_pspace_data; +static const struct program_space_key> + remote_pspace_data; /* The variable registered as the control variable used by the remote exec-file commands. While the remote exec-file setting is @@ -1156,12 +1150,12 @@ remote_target::remote_get_noisy_reply () org_to = to; - TRY + try { gdbarch_relocate_instruction (target_gdbarch (), &to, from); relocated = 1; } - CATCH (ex, RETURN_MASK_ALL) + catch (const gdb_exception &ex) { if (ex.error == MEMORY_ERROR) { @@ -1180,7 +1174,6 @@ remote_target::remote_get_noisy_reply () } putpkt ("E01"); } - END_CATCH if (relocated) { @@ -1237,16 +1230,6 @@ remote_target::get_remote_state () return &m_remote_state; } -/* Cleanup routine for the remote module's pspace data. */ - -static void -remote_pspace_data_cleanup (struct program_space *pspace, void *arg) -{ - char *remote_exec_file = (char *) arg; - - xfree (remote_exec_file); -} - /* Fetch the remote exec-file from the current program space. */ static const char * @@ -1254,9 +1237,7 @@ get_remote_exec_file (void) { char *remote_exec_file; - remote_exec_file - = (char *) program_space_data (current_program_space, - remote_pspace_data); + remote_exec_file = remote_pspace_data.get (current_program_space); if (remote_exec_file == NULL) return ""; @@ -1267,13 +1248,12 @@ get_remote_exec_file (void) static void set_pspace_remote_exec_file (struct program_space *pspace, - char *remote_exec_file) + const char *remote_exec_file) { - char *old_file = (char *) program_space_data (pspace, remote_pspace_data); + char *old_file = remote_pspace_data.get (pspace); xfree (old_file); - set_program_space_data (pspace, remote_pspace_data, - xstrdup (remote_exec_file)); + remote_pspace_data.set (pspace, xstrdup (remote_exec_file)); } /* The "set/show remote exec-file" set command hook. */ @@ -2307,9 +2287,11 @@ remote_target::remove_exec_catchpoint (int pid) -static ptid_t magic_null_ptid; -static ptid_t not_sent_ptid; -static ptid_t any_thread_ptid; +/* Take advantage of the fact that the TID field is not used, to tag + special ptids with it set to != 0. */ +static const ptid_t magic_null_ptid (42000, -1, 1); +static const ptid_t not_sent_ptid (42000, -2, 1); +static const ptid_t any_thread_ptid (42000, 0, 1); /* Find out if the stub attached to PID (and hence GDB should offer to detach instead of killing it when bailing out). */ @@ -2360,7 +2342,7 @@ remote_target::remote_query_attached (int pid) if no main executable is open already. */ inferior * -remote_target::remote_add_inferior (int fake_pid_p, int pid, int attached, +remote_target::remote_add_inferior (bool fake_pid_p, int pid, int attached, int try_open_exec) { struct inferior *inf; @@ -2501,7 +2483,7 @@ remote_target::remote_notice_new_inferior (ptid_t currthread, int executing) if (find_inferior_pid (currthread.pid ()) == NULL) { struct remote_state *rs = get_remote_state (); - int fake_pid_p = !remote_multi_process_p (rs); + bool fake_pid_p = !remote_multi_process_p (rs); inf = remote_add_inferior (fake_pid_p, currthread.pid (), -1, 1); @@ -2560,16 +2542,16 @@ record_currthread (struct remote_state *rs, ptid_t currthread) it can simply pass through to the inferior without reporting. */ void -remote_target::pass_signals (int numsigs, const unsigned char *pass_signals) +remote_target::pass_signals (gdb::array_view pass_signals) { if (packet_support (PACKET_QPassSignals) != PACKET_DISABLE) { char *pass_packet, *p; - int count = 0, i; + int count = 0; struct remote_state *rs = get_remote_state (); - gdb_assert (numsigs < 256); - for (i = 0; i < numsigs; i++) + gdb_assert (pass_signals.size () < 256); + for (size_t i = 0; i < pass_signals.size (); i++) { if (pass_signals[i]) count++; @@ -2577,7 +2559,7 @@ remote_target::pass_signals (int numsigs, const unsigned char *pass_signals) pass_packet = (char *) xmalloc (count * 3 + strlen ("QPassSignals:") + 1); strcpy (pass_packet, "QPassSignals:"); p = pass_packet + strlen (pass_packet); - for (i = 0; i < numsigs; i++) + for (size_t i = 0; i < pass_signals.size (); i++) { if (pass_signals[i]) { @@ -2686,16 +2668,16 @@ remote_target::set_syscall_catchpoint (int pid, bool needed, int any_count, signals it should pass through to the inferior when detaching. */ void -remote_target::program_signals (int numsigs, const unsigned char *signals) +remote_target::program_signals (gdb::array_view signals) { if (packet_support (PACKET_QProgramSignals) != PACKET_DISABLE) { char *packet, *p; - int count = 0, i; + int count = 0; struct remote_state *rs = get_remote_state (); - gdb_assert (numsigs < 256); - for (i = 0; i < numsigs; i++) + gdb_assert (signals.size () < 256); + for (size_t i = 0; i < signals.size (); i++) { if (signals[i]) count++; @@ -2703,7 +2685,7 @@ remote_target::program_signals (int numsigs, const unsigned char *signals) packet = (char *) xmalloc (count * 3 + strlen ("QProgramSignals:") + 1); strcpy (packet, "QProgramSignals:"); p = packet + strlen (packet); - for (i = 0; i < numsigs; i++) + for (size_t i = 0; i < signals.size (); i++) { if (signal_pass_state (i)) { @@ -4058,7 +4040,7 @@ remote_target::~remote_target () if (rs->remote_async_inferior_event_token) delete_async_event_handler (&rs->remote_async_inferior_event_token); - remote_notif_state_xfree (rs->notif_state); + delete rs->notif_state; } /* Query the remote side for the text, data and bss offsets. */ @@ -4317,7 +4299,7 @@ void remote_target::add_current_inferior_and_thread (char *wait_status) { struct remote_state *rs = get_remote_state (); - int fake_pid_p = 0; + bool fake_pid_p = false; inferior_ptid = null_ptid; @@ -4327,7 +4309,7 @@ remote_target::add_current_inferior_and_thread (char *wait_status) if (curr_ptid != null_ptid) { if (!remote_multi_process_p (rs)) - fake_pid_p = 1; + fake_pid_p = true; } else { @@ -4336,7 +4318,7 @@ remote_target::add_current_inferior_and_thread (char *wait_status) double duty as both the pid of the target process (if it has such), and as a flag indicating that a target is active. */ curr_ptid = magic_null_ptid; - fake_pid_p = 1; + fake_pid_p = true; } remote_add_inferior (fake_pid_p, curr_ptid.pid (), -1, 1); @@ -4796,7 +4778,7 @@ remote_target::start_remote (int from_tty, int extended_p) gdb_assert (wait_status == NULL); /* Report all signals during attach/startup. */ - pass_signals (0, NULL); + pass_signals ({}); /* If there are already stopped threads, mark them stopped and report their stops before giving the prompt to the user. */ @@ -5547,9 +5529,7 @@ remote_target::open_1 (const char *name, int from_tty, int extended_p) } /* Switch to using the remote target now. */ - push_target (remote); - /* The target stack owns the target now. */ - target_holder.release (); + push_target (std::move (target_holder)); /* Register extra event sources in the event loop. */ rs->remote_async_inferior_event_token @@ -5612,19 +5592,18 @@ remote_target::open_1 (const char *name, int from_tty, int extended_p) function. See cli-dump.c. */ { - TRY + try { remote->start_remote (from_tty, extended_p); } - CATCH (ex, RETURN_MASK_ALL) + catch (const gdb_exception &ex) { /* Pop the partially set up target - unless something else did already before throwing the exception. */ if (ex.error != TARGET_CLOSE_ERROR) remote_unpush_target (); - throw_exception (ex); + throw; } - END_CATCH } remote_btrace_reset (rs); @@ -5772,7 +5751,7 @@ remote_target::follow_fork (int follow_child, int detach_fork) follow-exec-mode is "new". */ void -remote_target::follow_exec (struct inferior *inf, char *execd_pathname) +remote_target::follow_exec (struct inferior *inf, const char *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. */ @@ -5824,12 +5803,10 @@ extended_remote_target::attach (const char *args, int from_tty) if (exec_file) printf_unfiltered (_("Attaching to program: %s, %s\n"), exec_file, - target_pid_to_str (ptid_t (pid))); + target_pid_to_str (ptid_t (pid)).c_str ()); else printf_unfiltered (_("Attaching to %s\n"), - target_pid_to_str (ptid_t (pid))); - - gdb_flush (gdb_stdout); + target_pid_to_str (ptid_t (pid)).c_str ()); } xsnprintf (rs->buf.data (), get_remote_packet_size (), "vAttach;%x", pid); @@ -5848,17 +5825,17 @@ extended_remote_target::attach (const char *args, int from_tty) } else if (strcmp (rs->buf.data (), "OK") != 0) error (_("Attaching to %s failed with: %s"), - target_pid_to_str (ptid_t (pid)), + target_pid_to_str (ptid_t (pid)).c_str (), rs->buf.data ()); break; case PACKET_UNKNOWN: error (_("This target does not support attaching to a process")); default: error (_("Attaching to %s failed"), - target_pid_to_str (ptid_t (pid))); + target_pid_to_str (ptid_t (pid)).c_str ()); } - set_current_inferior (remote_add_inferior (0, pid, 1, 0)); + set_current_inferior (remote_add_inferior (false, pid, 1, 0)); inferior_ptid = ptid_t (pid); @@ -6650,7 +6627,7 @@ remote_target::remote_stop_ns (ptid_t ptid) putpkt (rs->buf); getpkt (&rs->buf, 0); if (strcmp (rs->buf.data (), "OK") != 0) - error (_("Stopping %s failed: %s"), target_pid_to_str (ptid), + error (_("Stopping %s failed: %s"), target_pid_to_str (ptid).c_str (), rs->buf.data ()); } @@ -6817,11 +6794,9 @@ remote_console_output (const char *msg) gdb_flush (gdb_stdtarg); } -DEF_VEC_O(cached_reg_t); - -typedef struct stop_reply +struct stop_reply : public notif_event { - struct notif_event base; + ~stop_reply (); /* The identifier of the thread about this event */ ptid_t ptid; @@ -6840,20 +6815,14 @@ typedef struct stop_reply efficient for those targets that provide critical registers as part of their normal status mechanism (as another roundtrip to fetch them is avoided). */ - VEC(cached_reg_t) *regcache; + std::vector regcache; enum target_stop_reason stop_reason; CORE_ADDR watch_data_address; int core; -} *stop_reply_p; - -static void -stop_reply_xfree (struct stop_reply *r) -{ - notif_event_xfree ((struct notif_event *) r); -} +}; /* Return the length of the stop reply queue. */ @@ -6905,30 +6874,16 @@ remote_notif_stop_can_get_pending_events (remote_target *remote, return 0; } -static void -stop_reply_dtr (struct notif_event *event) +stop_reply::~stop_reply () { - struct stop_reply *r = (struct stop_reply *) event; - cached_reg_t *reg; - int ix; - - for (ix = 0; - VEC_iterate (cached_reg_t, r->regcache, ix, reg); - ix++) - xfree (reg->data); - - VEC_free (cached_reg_t, r->regcache); + for (cached_reg_t ® : regcache) + xfree (reg.data); } -static struct notif_event * -remote_notif_stop_alloc_reply (void) +static notif_event_up +remote_notif_stop_alloc_reply () { - /* We cast to a pointer to the "base class". */ - struct notif_event *r = (struct notif_event *) XNEW (struct stop_reply); - - r->dtr = stop_reply_dtr; - - return r; + return notif_event_up (new struct stop_reply ()); } /* A client of notification Stop. */ @@ -7071,7 +7026,7 @@ remote_target::discard_pending_stop_replies (struct inferior *inf) /* Discard the in-flight notification. */ if (reply != NULL && reply->ptid.pid () == inf->pid) { - stop_reply_xfree (reply); + delete reply; rns->pending_event[notif_client_stop.id] = NULL; } @@ -7130,7 +7085,7 @@ remote_target::remote_notif_remove_queued_reply (ptid_t ptid) if (notif_debug) fprintf_unfiltered (gdb_stdlog, "notif: discard queued event: 'Stop' in %s\n", - target_pid_to_str (ptid)); + target_pid_to_str (ptid).c_str ()); return result; } @@ -7168,7 +7123,7 @@ remote_target::push_stop_reply (struct stop_reply *new_event) if (notif_debug) fprintf_unfiltered (gdb_stdlog, "notif: push 'Stop' %s to queue %d\n", - target_pid_to_str (new_event->ptid), + target_pid_to_str (new_event->ptid).c_str (), int (rs->stop_reply_queue.size ())); mark_async_event_handler (rs->remote_async_inferior_event_token); @@ -7215,7 +7170,7 @@ remote_target::remote_parse_stop_reply (const char *buf, stop_reply *event) event->ws.kind = TARGET_WAITKIND_IGNORE; event->ws.value.integer = 0; event->stop_reason = TARGET_STOPPED_BY_NO_REASON; - event->regcache = NULL; + event->regcache.clear (); event->core = -1; switch (buf[0]) @@ -7340,7 +7295,6 @@ Packet: '%s'\n"), else if (strprefix (p, p1, "exec")) { ULONGEST ignored; - char pathname[PATH_MAX]; int pathlen; /* Determine the length of the execd pathname. */ @@ -7349,11 +7303,13 @@ Packet: '%s'\n"), /* Save the pathname for event reporting and for the next run command. */ - hex2bin (p1, (gdb_byte *) pathname, pathlen); + gdb::unique_xmalloc_ptr pathname + ((char *) xmalloc (pathlen + 1)); + hex2bin (p1, (gdb_byte *) pathname.get (), pathlen); pathname[pathlen] = '\0'; /* This is freed during event handling. */ - event->ws.value.execd_pathname = xstrdup (pathname); + event->ws.value.execd_pathname = pathname.release (); event->ws.kind = TARGET_WAITKIND_EXECD; /* Skip the registers included in this packet, since @@ -7449,7 +7405,7 @@ Packet: '%s'\n"), if (fieldsize < register_size (event->arch, reg->regnum)) warning (_("Remote reply is too short: %s"), buf); - VEC_safe_push (cached_reg_t, event->regcache, &cached_reg); + event->regcache.push_back (cached_reg); } else { @@ -7665,22 +7621,18 @@ remote_target::process_stop_reply (struct stop_reply *stop_reply, && status->kind != TARGET_WAITKIND_NO_RESUMED) { /* Expedited registers. */ - if (stop_reply->regcache) + if (!stop_reply->regcache.empty ()) { struct regcache *regcache = get_thread_arch_regcache (ptid, stop_reply->arch); - cached_reg_t *reg; - int ix; - for (ix = 0; - VEC_iterate (cached_reg_t, stop_reply->regcache, ix, reg); - ix++) - { - regcache->raw_supply (reg->num, reg->data); - xfree (reg->data); - } + for (cached_reg_t ® : stop_reply->regcache) + { + regcache->raw_supply (reg.num, reg.data); + xfree (reg.data); + } - VEC_free (cached_reg_t, stop_reply->regcache); + stop_reply->regcache.clear (); } remote_notice_new_inferior (ptid, 0); @@ -7691,7 +7643,7 @@ remote_target::process_stop_reply (struct stop_reply *stop_reply, remote_thr->vcont_resumed = 0; } - stop_reply_xfree (stop_reply); + delete stop_reply; return ptid; } @@ -9497,6 +9449,20 @@ remote_target::read_frame (gdb::char_vector *buf_p) } } +/* Set this to the maximum number of seconds to wait instead of waiting forever + in target_wait(). If this timer times out, then it generates an error and + the command is aborted. This replaces most of the need for timeouts in the + GDB test suite, and makes it possible to distinguish between a hung target + and one with slow communications. */ + +static int watchdog = 0; +static void +show_watchdog (struct ui_file *file, int from_tty, + struct cmd_list_element *c, const char *value) +{ + fprintf_filtered (file, _("Watchdog timer is %s.\n"), value); +} + /* Read a packet from the remote machine, with error checking, and store it in *BUF. Resize *BUF if necessary to hold the result. If FOREVER, wait forever rather than timing out; this is used (in @@ -9803,11 +9769,11 @@ remote_target::remote_kill_k () { /* Catch errors so the user can quit from gdb even when we aren't on speaking terms with the remote system. */ - TRY + try { putpkt ("k"); } - CATCH (ex, RETURN_MASK_ERROR) + catch (const gdb_exception_error &ex) { if (ex.error == TARGET_CLOSE_ERROR) { @@ -9823,9 +9789,8 @@ remote_target::remote_kill_k () /* Otherwise, something went wrong. We didn't actually kill the target. Just propagate the exception, and let the user or higher layers decide what to do. */ - throw_exception (ex); + throw; } - END_CATCH } void @@ -10401,9 +10366,9 @@ remote_target::remove_watchpoint (CORE_ADDR addr, int len, } -int remote_hw_watchpoint_limit = -1; -int remote_hw_watchpoint_length_limit = -1; -int remote_hw_breakpoint_limit = -1; +static int remote_hw_watchpoint_limit = -1; +static int remote_hw_watchpoint_length_limit = -1; +static int remote_hw_breakpoint_limit = -1; int remote_target::region_ok_for_hw_watchpoint (CORE_ADDR addr, int len) @@ -11434,13 +11399,11 @@ init_remote_threadtests (void) #endif /* 0 */ -/* Convert a thread ID to a string. Returns the string in a static - buffer. */ +/* Convert a thread ID to a string. */ -const char * +std::string remote_target::pid_to_str (ptid_t ptid) { - static char buf[64]; struct remote_state *rs = get_remote_state (); if (ptid == null_ptid) @@ -11459,27 +11422,22 @@ remote_target::pid_to_str (ptid_t ptid) attached to a process, and reporting yes to qAttached, hence no smart special casing here. */ if (!remote_multi_process_p (rs)) - { - xsnprintf (buf, sizeof buf, "Remote target"); - return buf; - } + return "Remote target"; return normal_pid_to_str (ptid); } else { if (magic_null_ptid == ptid) - xsnprintf (buf, sizeof buf, "Thread
"); + return "Thread
"; else if (remote_multi_process_p (rs)) if (ptid.lwp () == 0) return normal_pid_to_str (ptid); else - xsnprintf (buf, sizeof buf, "Thread %d.%ld", - ptid.pid (), ptid.lwp ()); + return string_printf ("Thread %d.%ld", + ptid.pid (), ptid.lwp ()); else - xsnprintf (buf, sizeof buf, "Thread %ld", - ptid.lwp ()); - return buf; + return string_printf ("Thread %ld", ptid.lwp ()); } } @@ -12410,7 +12368,7 @@ public: DISABLE_COPY_AND_ASSIGN (scoped_remote_fd); /* Release ownership of the file descriptor, and return it. */ - int release () noexcept + ATTRIBUTE_UNUSED_RESULT int release () noexcept { int fd = m_fd; m_fd = -1; @@ -13179,20 +13137,19 @@ remote_target::get_trace_status (struct trace_status *ts) putpkt ("qTStatus"); - TRY + try { p = remote_get_noisy_reply (); } - CATCH (ex, RETURN_MASK_ERROR) + catch (const gdb_exception_error &ex) { if (ex.error != TARGET_CLOSE_ERROR) { exception_fprintf (gdb_stderr, ex, "qTStatus: "); return -1; } - throw_exception (ex); + throw; } - END_CATCH result = packet_ok (p, &remote_protocol_packets[PACKET_qTStatus]); @@ -13823,10 +13780,10 @@ remote_target::enable_btrace (ptid_t ptid, const struct btrace_config *conf) { if (rs->buf[0] == 'E' && rs->buf[1] == '.') error (_("Could not enable branch tracing for %s: %s"), - target_pid_to_str (ptid), &rs->buf[2]); + target_pid_to_str (ptid).c_str (), &rs->buf[2]); else error (_("Could not enable branch tracing for %s."), - target_pid_to_str (ptid)); + target_pid_to_str (ptid).c_str ()); } tinfo = XCNEW (struct btrace_target_info); @@ -13834,16 +13791,15 @@ remote_target::enable_btrace (ptid_t ptid, const struct btrace_config *conf) /* If we fail to read the configuration, we lose some information, but the tracing itself is not impacted. */ - TRY + try { btrace_read_config (&tinfo->conf); } - CATCH (err, RETURN_MASK_ERROR) + catch (const gdb_exception_error &err) { if (err.message != NULL) - warning ("%s", err.message); + warning ("%s", err.what ()); } - END_CATCH return tinfo; } @@ -13871,10 +13827,10 @@ remote_target::disable_btrace (struct btrace_target_info *tinfo) { if (rs->buf[0] == 'E' && rs->buf[1] == '.') error (_("Could not disable branch tracing for %s: %s"), - target_pid_to_str (tinfo->ptid), &rs->buf[2]); + target_pid_to_str (tinfo->ptid).c_str (), &rs->buf[2]); else error (_("Could not disable branch tracing for %s."), - target_pid_to_str (tinfo->ptid)); + target_pid_to_str (tinfo->ptid).c_str ()); } xfree (tinfo); @@ -14047,6 +14003,13 @@ remote_target::thread_handle_to_thread_info (const gdb_byte *thread_handle, return NULL; } +gdb::byte_vector +remote_target::thread_info_to_thread_handle (struct thread_info *tp) +{ + remote_thread_info *priv = get_remote_thread_info (tp); + return priv->thread_handle; +} + bool remote_target::can_async_p () { @@ -14302,10 +14265,6 @@ _initialize_remote (void) remote_g_packet_data_handle = gdbarch_data_register_pre_init (remote_g_packet_data_init); - remote_pspace_data - = register_program_space_data_with_cleanup (NULL, - remote_pspace_data_cleanup); - add_target (remote_target_info, remote_target::open); add_target (extended_remote_target_info, extended_remote_target::open); @@ -14791,12 +14750,16 @@ stepping is supported by the target. The default is on."), &setlist, &showlist); + add_setshow_zinteger_cmd ("watchdog", class_maintenance, &watchdog, _("\ +Set watchdog timer."), _("\ +Show watchdog timer."), _("\ +When non-zero, this timeout is used instead of waiting forever for a target\n\ +to finish a low-level step or continue operation. If the specified amount\n\ +of time passes without a response from the target, an error occurs."), + NULL, + show_watchdog, + &setlist, &showlist); + /* Eventually initialize fileio. See fileio.c */ initialize_remote_fileio (remote_set_cmdlist, remote_show_cmdlist); - - /* Take advantage of the fact that the TID field is not used, to tag - special ptids with it set to != 0. */ - magic_null_ptid = ptid_t (42000, -1, 1); - not_sent_ptid = ptid_t (42000, -2, 1); - any_thread_ptid = ptid_t (42000, 0, 1); }