1 /* Main code for remote server for GDB.
2 Copyright (C) 1989, 1993, 1994, 1995, 1997, 1998, 1999, 2000, 2002, 2003,
3 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
5 This file is part of GDB.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 Boston, MA 02110-1301, USA. */
34 unsigned long cont_thread
;
35 unsigned long general_thread
;
36 unsigned long step_thread
;
37 unsigned long thread_from_wait
;
38 unsigned long old_thread_from_wait
;
39 int extended_protocol
;
42 /* Enable miscellaneous debugging output. The name is historical - it
43 was originally used to debug LinuxThreads support. */
46 int pass_signals
[TARGET_SIGNAL_LAST
];
50 /* The PID of the originally created or attached inferior. Used to
51 send signals to the process when GDB sends us an asynchronous interrupt
52 (user hitting Control-C in the client), and to wait for the child to exit
53 when no longer debugging it. */
55 unsigned long signal_pid
;
58 /* A file descriptor for the controlling terminal. */
61 /* TERMINAL_FD's original foreground group. */
62 pid_t old_foreground_pgrp
;
64 /* Hand back terminal ownership to the original foreground group. */
67 restore_old_foreground_pgrp (void)
69 tcsetpgrp (terminal_fd
, old_foreground_pgrp
);
74 start_inferior (char *argv
[], char *statusptr
)
77 signal (SIGTTOU
, SIG_DFL
);
78 signal (SIGTTIN
, SIG_DFL
);
81 signal_pid
= create_inferior (argv
[0], argv
);
83 fprintf (stderr
, "Process %s created; pid = %ld\n", argv
[0],
88 signal (SIGTTOU
, SIG_IGN
);
89 signal (SIGTTIN
, SIG_IGN
);
90 terminal_fd
= fileno (stderr
);
91 old_foreground_pgrp
= tcgetpgrp (terminal_fd
);
92 tcsetpgrp (terminal_fd
, signal_pid
);
93 atexit (restore_old_foreground_pgrp
);
96 /* Wait till we are at 1st instruction in program, return signal number. */
97 return mywait (statusptr
, 0);
101 attach_inferior (int pid
, char *statusptr
, int *sigptr
)
103 /* myattach should return -1 if attaching is unsupported,
104 0 if it succeeded, and call error() otherwise. */
106 if (myattach (pid
) != 0)
109 fprintf (stderr
, "Attached; pid = %d\n", pid
);
112 /* FIXME - It may be that we should get the SIGNAL_PID from the
113 attach function, so that it can be the main thread instead of
114 whichever we were told to attach to. */
117 *sigptr
= mywait (statusptr
, 0);
119 /* GDB knows to ignore the first SIGSTOP after attaching to a running
120 process using the "attach" command, but this is different; it's
121 just using "target remote". Pretend it's just starting up. */
122 if (*statusptr
== 'T' && *sigptr
== TARGET_SIGNAL_STOP
)
123 *sigptr
= TARGET_SIGNAL_TRAP
;
128 extern int remote_debug
;
130 /* Decode a qXfer read request. Return 0 if everything looks OK,
134 decode_xfer_read (char *buf
, char **annex
, CORE_ADDR
*ofs
, unsigned int *len
)
136 /* Extract and NUL-terminate the annex. */
138 while (*buf
&& *buf
!= ':')
144 /* After the read marker and annex, qXfer looks like a
145 traditional 'm' packet. */
146 decode_m_packet (buf
, ofs
, len
);
151 /* Write the response to a successful qXfer read. Returns the
152 length of the (binary) data stored in BUF, corresponding
153 to as much of DATA/LEN as we could fit. IS_MORE controls
154 the first character of the response. */
156 write_qxfer_response (char *buf
, const void *data
, int len
, int is_more
)
165 return remote_escape_output (data
, len
, (unsigned char *) buf
+ 1, &out_len
,
169 /* Handle all of the extended 'Q' packets. */
171 handle_general_set (char *own_buf
)
173 if (strncmp ("QPassSignals:", own_buf
, strlen ("QPassSignals:")) == 0)
175 int numsigs
= (int) TARGET_SIGNAL_LAST
, i
;
176 const char *p
= own_buf
+ strlen ("QPassSignals:");
179 p
= decode_address_to_semicolon (&cursig
, p
);
180 for (i
= 0; i
< numsigs
; i
++)
186 /* Keep looping, to clear the remaining signals. */
189 p
= decode_address_to_semicolon (&cursig
, p
);
194 strcpy (own_buf
, "OK");
198 /* Otherwise we didn't know what packet it was. Say we didn't
204 get_features_xml (const char *annex
)
206 static int features_supported
= -1;
207 static char *document
;
210 extern const char *const xml_builtin
[][2];
213 /* Look for the annex. */
214 for (i
= 0; xml_builtin
[i
][0] != NULL
; i
++)
215 if (strcmp (annex
, xml_builtin
[i
][0]) == 0)
218 if (xml_builtin
[i
][0] != NULL
)
219 return xml_builtin
[i
][1];
222 if (strcmp (annex
, "target.xml") != 0)
225 if (features_supported
== -1)
227 const char *arch
= NULL
;
228 if (the_target
->arch_string
!= NULL
)
229 arch
= (*the_target
->arch_string
) ();
232 features_supported
= 0;
235 features_supported
= 1;
236 document
= malloc (64 + strlen (arch
));
237 snprintf (document
, 64 + strlen (arch
),
238 "<target><architecture>%s</architecture></target>",
247 monitor_show_help (void)
249 monitor_output ("The following monitor commands are supported:\n");
250 monitor_output (" set debug <0|1>\n");
251 monitor_output (" Enable general debugging messages\n");
252 monitor_output (" set remote-debug <0|1>\n");
253 monitor_output (" Enable remote protocol debugging messages\n");
256 /* Handle all of the extended 'q' packets. */
258 handle_query (char *own_buf
, int packet_len
, int *new_packet_len_p
)
260 static struct inferior_list_entry
*thread_ptr
;
262 /* Reply the current thread id. */
263 if (strcmp ("qC", own_buf
) == 0)
265 thread_ptr
= all_threads
.head
;
266 sprintf (own_buf
, "QC%x",
267 thread_to_gdb_id ((struct thread_info
*)thread_ptr
));
271 if (strcmp ("qSymbol::", own_buf
) == 0)
273 if (the_target
->look_up_symbols
!= NULL
)
274 (*the_target
->look_up_symbols
) ();
276 strcpy (own_buf
, "OK");
280 if (strcmp ("qfThreadInfo", own_buf
) == 0)
282 thread_ptr
= all_threads
.head
;
283 sprintf (own_buf
, "m%x", thread_to_gdb_id ((struct thread_info
*)thread_ptr
));
284 thread_ptr
= thread_ptr
->next
;
288 if (strcmp ("qsThreadInfo", own_buf
) == 0)
290 if (thread_ptr
!= NULL
)
292 sprintf (own_buf
, "m%x", thread_to_gdb_id ((struct thread_info
*)thread_ptr
));
293 thread_ptr
= thread_ptr
->next
;
298 sprintf (own_buf
, "l");
303 if (the_target
->read_offsets
!= NULL
304 && strcmp ("qOffsets", own_buf
) == 0)
306 CORE_ADDR text
, data
;
308 if (the_target
->read_offsets (&text
, &data
))
309 sprintf (own_buf
, "Text=%lX;Data=%lX;Bss=%lX",
310 (long)text
, (long)data
, (long)data
);
317 if (the_target
->qxfer_spu
!= NULL
318 && strncmp ("qXfer:spu:read:", own_buf
, 15) == 0)
324 unsigned char *spu_buf
;
326 strcpy (own_buf
, "E00");
327 if (decode_xfer_read (own_buf
+ 15, &annex
, &ofs
, &len
) < 0)
329 if (len
> PBUFSIZ
- 2)
331 spu_buf
= malloc (len
+ 1);
335 n
= (*the_target
->qxfer_spu
) (annex
, spu_buf
, NULL
, ofs
, len
+ 1);
339 *new_packet_len_p
= write_qxfer_response
340 (own_buf
, spu_buf
, len
, 1);
342 *new_packet_len_p
= write_qxfer_response
343 (own_buf
, spu_buf
, n
, 0);
349 if (the_target
->qxfer_spu
!= NULL
350 && strncmp ("qXfer:spu:write:", own_buf
, 16) == 0)
356 unsigned char *spu_buf
;
358 strcpy (own_buf
, "E00");
359 spu_buf
= malloc (packet_len
- 15);
362 if (decode_xfer_write (own_buf
+ 16, packet_len
- 16, &annex
,
363 &ofs
, &len
, spu_buf
) < 0)
369 n
= (*the_target
->qxfer_spu
)
370 (annex
, NULL
, (unsigned const char *)spu_buf
, ofs
, len
);
374 sprintf (own_buf
, "%x", n
);
380 if (the_target
->read_auxv
!= NULL
381 && strncmp ("qXfer:auxv:read:", own_buf
, 16) == 0)
389 /* Reject any annex; grab the offset and length. */
390 if (decode_xfer_read (own_buf
+ 16, &annex
, &ofs
, &len
) < 0
393 strcpy (own_buf
, "E00");
397 /* Read one extra byte, as an indicator of whether there is
399 if (len
> PBUFSIZ
- 2)
401 data
= malloc (len
+ 1);
402 n
= (*the_target
->read_auxv
) (ofs
, data
, len
+ 1);
406 *new_packet_len_p
= write_qxfer_response (own_buf
, data
, len
, 1);
408 *new_packet_len_p
= write_qxfer_response (own_buf
, data
, n
, 0);
415 if (strncmp ("qXfer:features:read:", own_buf
, 20) == 0)
418 unsigned int len
, total_len
;
419 const char *document
;
422 /* Check for support. */
423 document
= get_features_xml ("target.xml");
424 if (document
== NULL
)
430 /* Grab the annex, offset, and length. */
431 if (decode_xfer_read (own_buf
+ 20, &annex
, &ofs
, &len
) < 0)
433 strcpy (own_buf
, "E00");
437 /* Now grab the correct annex. */
438 document
= get_features_xml (annex
);
439 if (document
== NULL
)
441 strcpy (own_buf
, "E00");
445 total_len
= strlen (document
);
446 if (len
> PBUFSIZ
- 2)
451 else if (len
< total_len
- ofs
)
452 *new_packet_len_p
= write_qxfer_response (own_buf
, document
+ ofs
,
455 *new_packet_len_p
= write_qxfer_response (own_buf
, document
+ ofs
,
461 /* Protocol features query. */
462 if (strncmp ("qSupported", own_buf
, 10) == 0
463 && (own_buf
[10] == ':' || own_buf
[10] == '\0'))
465 sprintf (own_buf
, "PacketSize=%x;QPassSignals+", PBUFSIZ
- 1);
467 if (the_target
->read_auxv
!= NULL
)
468 strcat (own_buf
, ";qXfer:auxv:read+");
470 if (the_target
->qxfer_spu
!= NULL
)
471 strcat (own_buf
, ";qXfer:spu:read+;qXfer:spu:write+");
473 if (get_features_xml ("target.xml") != NULL
)
474 strcat (own_buf
, ";qXfer:features:read+");
479 /* Thread-local storage support. */
480 if (the_target
->get_tls_address
!= NULL
481 && strncmp ("qGetTLSAddr:", own_buf
, 12) == 0)
483 char *p
= own_buf
+ 12;
484 CORE_ADDR parts
[3], address
= 0;
487 for (i
= 0; i
< 3; i
++)
495 p2
= strchr (p
, ',');
507 decode_address (&parts
[i
], p
, len
);
511 if (p
!= NULL
|| i
< 3)
515 struct thread_info
*thread
= gdb_id_to_thread (parts
[0]);
520 err
= the_target
->get_tls_address (thread
, parts
[1], parts
[2],
526 sprintf (own_buf
, "%llx", address
);
535 /* Otherwise, pretend we do not understand this packet. */
538 /* Handle "monitor" commands. */
539 if (strncmp ("qRcmd,", own_buf
, 6) == 0)
541 char *mon
= malloc (PBUFSIZ
);
542 int len
= strlen (own_buf
+ 6);
544 if ((len
% 1) != 0 || unhexify (mon
, own_buf
+ 6, len
/ 2) != len
/ 2)
554 if (strcmp (mon
, "set debug 1") == 0)
557 monitor_output ("Debug output enabled.\n");
559 else if (strcmp (mon
, "set debug 0") == 0)
562 monitor_output ("Debug output disabled.\n");
564 else if (strcmp (mon
, "set remote-debug 1") == 0)
567 monitor_output ("Protocol debug output enabled.\n");
569 else if (strcmp (mon
, "set remote-debug 0") == 0)
572 monitor_output ("Protocol debug output disabled.\n");
574 else if (strcmp (mon
, "help") == 0)
575 monitor_show_help ();
578 monitor_output ("Unknown monitor command.\n\n");
579 monitor_show_help ();
587 /* Otherwise we didn't know what packet it was. Say we didn't
592 /* Parse vCont packets. */
594 handle_v_cont (char *own_buf
, char *status
, int *signal
)
598 struct thread_resume
*resume_info
, default_action
;
600 /* Count the number of semicolons in the packet. There should be one
609 /* Allocate room for one extra action, for the default remain-stopped
610 behavior; if no default action is in the list, we'll need the extra
612 resume_info
= malloc ((n
+ 1) * sizeof (resume_info
[0]));
614 default_action
.thread
= -1;
615 default_action
.leave_stopped
= 1;
616 default_action
.step
= 0;
617 default_action
.sig
= 0;
625 resume_info
[i
].leave_stopped
= 0;
627 if (p
[0] == 's' || p
[0] == 'S')
628 resume_info
[i
].step
= 1;
629 else if (p
[0] == 'c' || p
[0] == 'C')
630 resume_info
[i
].step
= 0;
634 if (p
[0] == 'S' || p
[0] == 'C')
637 sig
= strtol (p
+ 1, &q
, 16);
642 if (!target_signal_to_host_p (sig
))
644 resume_info
[i
].sig
= target_signal_to_host (sig
);
648 resume_info
[i
].sig
= 0;
654 resume_info
[i
].thread
= -1;
655 default_action
= resume_info
[i
];
657 /* Note: we don't increment i here, we'll overwrite this entry
658 the next time through. */
660 else if (p
[0] == ':')
662 unsigned int gdb_id
= strtoul (p
+ 1, &q
, 16);
663 unsigned long thread_id
;
668 if (p
[0] != ';' && p
[0] != 0)
671 thread_id
= gdb_id_to_thread_id (gdb_id
);
673 resume_info
[i
].thread
= thread_id
;
681 resume_info
[i
] = default_action
;
683 /* Still used in occasional places in the backend. */
684 if (n
== 1 && resume_info
[0].thread
!= -1)
685 cont_thread
= resume_info
[0].thread
;
688 set_desired_inferior (0);
690 (*the_target
->resume
) (resume_info
);
694 *signal
= mywait (status
, 1);
695 prepare_resume_reply (own_buf
, *status
, *signal
);
699 /* No other way to report an error... */
700 strcpy (own_buf
, "");
705 /* Handle all of the extended 'v' packets. */
707 handle_v_requests (char *own_buf
, char *status
, int *signal
)
709 if (strncmp (own_buf
, "vCont;", 6) == 0)
711 handle_v_cont (own_buf
, status
, signal
);
715 if (strncmp (own_buf
, "vCont?", 6) == 0)
717 strcpy (own_buf
, "vCont;c;C;s;S");
721 /* Otherwise we didn't know what packet it was. Say we didn't
728 myresume (int step
, int sig
)
730 struct thread_resume resume_info
[2];
733 if (step
|| sig
|| (cont_thread
!= 0 && cont_thread
!= -1))
735 resume_info
[0].thread
736 = ((struct inferior_list_entry
*) current_inferior
)->id
;
737 resume_info
[0].step
= step
;
738 resume_info
[0].sig
= sig
;
739 resume_info
[0].leave_stopped
= 0;
742 resume_info
[n
].thread
= -1;
743 resume_info
[n
].step
= 0;
744 resume_info
[n
].sig
= 0;
745 resume_info
[n
].leave_stopped
= (cont_thread
!= 0 && cont_thread
!= -1);
747 (*the_target
->resume
) (resume_info
);
753 gdbserver_version (void)
755 printf ("GNU gdbserver %s\n"
756 "Copyright (C) 2006 Free Software Foundation, Inc.\n"
757 "gdbserver is free software, covered by the GNU General Public License.\n"
758 "This gdbserver was configured as \"%s\"\n",
763 gdbserver_usage (void)
765 printf ("Usage:\tgdbserver COMM PROG [ARGS ...]\n"
766 "\tgdbserver COMM --attach PID\n"
768 "COMM may either be a tty device (for serial debugging), or \n"
769 "HOST:PORT to listen for a TCP connection.\n");
773 main (int argc
, char *argv
[])
775 char ch
, status
, *own_buf
;
776 unsigned char *mem_buf
;
785 if (argc
>= 2 && strcmp (argv
[1], "--version") == 0)
787 gdbserver_version ();
791 if (argc
>= 2 && strcmp (argv
[1], "--help") == 0)
797 if (setjmp (toplevel
))
799 fprintf (stderr
, "Exiting\n");
806 if (argc
>= 3 && strcmp (argv
[2], "--attach") == 0)
809 && argv
[3][0] != '\0'
810 && (pid
= strtoul (argv
[3], &arg_end
, 10)) != 0
819 if (argc
< 3 || bad_attach
)
827 own_buf
= malloc (PBUFSIZ
);
828 mem_buf
= malloc (PBUFSIZ
);
832 /* Wait till we are at first instruction in program. */
833 signal
= start_inferior (&argv
[2], &status
);
835 /* We are now stopped at the first instruction of the target process */
839 switch (attach_inferior (pid
, &status
, &signal
))
842 error ("Attaching not supported on this target");
850 if (setjmp (toplevel
))
852 fprintf (stderr
, "Killing inferior\n");
859 remote_open (argv
[1]);
867 int new_packet_len
= -1;
869 packet_len
= getpkt (own_buf
);
878 handle_query (own_buf
, packet_len
, &new_packet_len
);
881 handle_general_set (own_buf
);
884 fprintf (stderr
, "Detaching from inferior\n");
885 if (detach_inferior () != 0)
896 /* If we are attached, then we can exit. Otherwise, we
897 need to hang around doing nothing, until the child
907 extended_protocol
= 1;
908 prepare_resume_reply (own_buf
, status
, signal
);
912 /* We can not use the extended protocol if we are
913 attached, because we can not restart the running
914 program. So return unrecognized. */
919 prepare_resume_reply (own_buf
, status
, signal
);
922 if (own_buf
[1] == 'c' || own_buf
[1] == 'g' || own_buf
[1] == 's')
924 unsigned long gdb_id
, thread_id
;
926 gdb_id
= strtoul (&own_buf
[2], NULL
, 16);
927 thread_id
= gdb_id_to_thread_id (gdb_id
);
934 if (own_buf
[1] == 'g')
936 general_thread
= thread_id
;
937 set_desired_inferior (1);
939 else if (own_buf
[1] == 'c')
940 cont_thread
= thread_id
;
941 else if (own_buf
[1] == 's')
942 step_thread
= thread_id
;
948 /* Silently ignore it so that gdb can extend the protocol
949 without compatibility headaches. */
954 set_desired_inferior (1);
955 registers_to_string (own_buf
);
958 set_desired_inferior (1);
959 registers_from_string (&own_buf
[1]);
963 decode_m_packet (&own_buf
[1], &mem_addr
, &len
);
964 if (read_inferior_memory (mem_addr
, mem_buf
, len
) == 0)
965 convert_int_to_ascii (mem_buf
, own_buf
, len
);
970 decode_M_packet (&own_buf
[1], &mem_addr
, &len
, mem_buf
);
971 if (write_inferior_memory (mem_addr
, mem_buf
, len
) == 0)
977 if (decode_X_packet (&own_buf
[1], packet_len
- 1,
978 &mem_addr
, &len
, mem_buf
) < 0
979 || write_inferior_memory (mem_addr
, mem_buf
, len
) != 0)
985 convert_ascii_to_int (own_buf
+ 1, &sig
, 1);
986 if (target_signal_to_host_p (sig
))
987 signal
= target_signal_to_host (sig
);
990 set_desired_inferior (0);
991 myresume (0, signal
);
992 signal
= mywait (&status
, 1);
993 prepare_resume_reply (own_buf
, status
, signal
);
996 convert_ascii_to_int (own_buf
+ 1, &sig
, 1);
997 if (target_signal_to_host_p (sig
))
998 signal
= target_signal_to_host (sig
);
1001 set_desired_inferior (0);
1002 myresume (1, signal
);
1003 signal
= mywait (&status
, 1);
1004 prepare_resume_reply (own_buf
, status
, signal
);
1007 set_desired_inferior (0);
1009 signal
= mywait (&status
, 1);
1010 prepare_resume_reply (own_buf
, status
, signal
);
1013 set_desired_inferior (0);
1015 signal
= mywait (&status
, 1);
1016 prepare_resume_reply (own_buf
, status
, signal
);
1022 CORE_ADDR addr
= strtoul (&own_buf
[3], &lenptr
, 16);
1023 int len
= strtol (lenptr
+ 1, &dataptr
, 16);
1024 char type
= own_buf
[1];
1026 if (the_target
->insert_watchpoint
== NULL
1027 || (type
< '2' || type
> '4'))
1029 /* No watchpoint support or not a watchpoint command;
1030 unrecognized either way. */
1037 res
= (*the_target
->insert_watchpoint
) (type
, addr
, len
);
1044 write_enn (own_buf
);
1052 CORE_ADDR addr
= strtoul (&own_buf
[3], &lenptr
, 16);
1053 int len
= strtol (lenptr
+ 1, &dataptr
, 16);
1054 char type
= own_buf
[1];
1056 if (the_target
->remove_watchpoint
== NULL
1057 || (type
< '2' || type
> '4'))
1059 /* No watchpoint support or not a watchpoint command;
1060 unrecognized either way. */
1067 res
= (*the_target
->remove_watchpoint
) (type
, addr
, len
);
1074 write_enn (own_buf
);
1079 fprintf (stderr
, "Killing inferior\n");
1081 /* When using the extended protocol, we start up a new
1082 debugging session. The traditional protocol will
1084 if (extended_protocol
)
1087 fprintf (stderr
, "GDBserver restarting\n");
1089 /* Wait till we are at 1st instruction in prog. */
1090 signal
= start_inferior (&argv
[2], &status
);
1101 unsigned long gdb_id
, thread_id
;
1103 gdb_id
= strtoul (&own_buf
[1], NULL
, 16);
1104 thread_id
= gdb_id_to_thread_id (gdb_id
);
1107 write_enn (own_buf
);
1111 if (mythread_alive (thread_id
))
1114 write_enn (own_buf
);
1118 /* Restarting the inferior is only supported in the
1119 extended protocol. */
1120 if (extended_protocol
)
1124 fprintf (stderr
, "GDBserver restarting\n");
1126 /* Wait till we are at 1st instruction in prog. */
1127 signal
= start_inferior (&argv
[2], &status
);
1133 /* It is a request we don't understand. Respond with an
1134 empty packet so that gdb knows that we don't support this
1140 /* Extended (long) request. */
1141 handle_v_requests (own_buf
, &status
, &signal
);
1144 /* It is a request we don't understand. Respond with an
1145 empty packet so that gdb knows that we don't support this
1151 if (new_packet_len
!= -1)
1152 putpkt_binary (own_buf
, new_packet_len
);
1158 "\nChild exited with status %d\n", signal
);
1160 fprintf (stderr
, "\nChild terminated with signal = 0x%x (%s)\n",
1161 target_signal_to_host (signal
),
1162 target_signal_to_name (signal
));
1163 if (status
== 'W' || status
== 'X')
1165 if (extended_protocol
)
1167 fprintf (stderr
, "Killing inferior\n");
1170 fprintf (stderr
, "GDBserver restarting\n");
1172 /* Wait till we are at 1st instruction in prog. */
1173 signal
= start_inferior (&argv
[2], &status
);
1179 fprintf (stderr
, "GDBserver exiting\n");
1185 /* We come here when getpkt fails.
1187 For the extended remote protocol we exit (and this is the only
1188 way we gracefully exit!).
1190 For the traditional remote protocol close the connection,
1191 and re-open it at the top of the loop. */
1192 if (extended_protocol
)
1199 fprintf (stderr
, "Remote side has terminated connection. "
1200 "GDBserver will reopen the connection.\n");