aboutsummaryrefslogtreecommitdiff
path: root/gdb/remote.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/remote.c')
-rw-r--r--gdb/remote.c40
1 files changed, 32 insertions, 8 deletions
diff --git a/gdb/remote.c b/gdb/remote.c
index 03ebcc6..49c1c96 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -1264,6 +1264,7 @@ public: /* Remote specific methods. */
int readchar (int timeout);
void remote_serial_write (const char *str, int len);
+ void remote_serial_send_break ();
int putpkt (const char *buf);
int putpkt_binary (const char *buf, int cnt);
@@ -4623,15 +4624,13 @@ remote_target::get_offsets ()
void
remote_target::send_interrupt_sequence ()
{
- struct remote_state *rs = get_remote_state ();
-
if (interrupt_sequence_mode == interrupt_sequence_control_c)
remote_serial_write ("\x03", 1);
else if (interrupt_sequence_mode == interrupt_sequence_break)
- serial_send_break (rs->remote_desc);
+ remote_serial_send_break ();
else if (interrupt_sequence_mode == interrupt_sequence_break_g)
{
- serial_send_break (rs->remote_desc);
+ remote_serial_send_break ();
remote_serial_write ("g", 1);
}
else
@@ -4639,7 +4638,6 @@ remote_target::send_interrupt_sequence ()
interrupt_sequence_mode);
}
-
/* If STOP_REPLY is a T stop reply, look for the "thread" register,
and extract the PTID. Returns NULL_PTID if not found. */
@@ -9859,16 +9857,42 @@ remote_target::remote_serial_write (const char *str, int len)
rs->got_ctrlc_during_io = 0;
- if (serial_write (rs->remote_desc, str, len))
+ try
{
- unpush_and_perror (this, _("Remote communication error. "
- "Target disconnected"));
+ serial_write (rs->remote_desc, str, len);
+ }
+ catch (const gdb_exception_error &ex)
+ {
+ remote_unpush_target (this);
+ throw_error (TARGET_CLOSE_ERROR,
+ _("Remote communication error. "
+ "Target disconnected: %s"),
+ ex.what ());
}
if (rs->got_ctrlc_during_io)
set_quit_flag ();
}
+void
+remote_target::remote_serial_send_break ()
+{
+ struct remote_state *rs = get_remote_state ();
+
+ try
+ {
+ serial_send_break (rs->remote_desc);
+ }
+ catch (const gdb_exception_error &ex)
+ {
+ remote_unpush_target (this);
+ throw_error (TARGET_CLOSE_ERROR,
+ _("Remote communication error. "
+ "Target disconnected: %s"),
+ ex.what ());
+ }
+}
+
/* Return a string representing an escaped version of BUF, of len N.
E.g. \n is converted to \\n, \t to \\t, etc. */