| OLD | NEW |
| 1 /* Remote utility routines for the remote server for GDB. | 1 /* Remote utility routines for the remote server for GDB. |
| 2 Copyright (C) 1986, 1989, 1993-2012 Free Software Foundation, Inc. | 2 Copyright (C) 1986, 1989, 1993-2012 Free Software Foundation, Inc. |
| 3 | 3 |
| 4 This file is part of GDB. | 4 This file is part of GDB. |
| 5 | 5 |
| 6 This program is free software; you can redistribute it and/or modify | 6 This program is free software; you can redistribute it and/or modify |
| 7 it under the terms of the GNU General Public License as published by | 7 it under the terms of the GNU General Public License as published by |
| 8 the Free Software Foundation; either version 3 of the License, or | 8 the Free Software Foundation; either version 3 of the License, or |
| 9 (at your option) any later version. | 9 (at your option) any later version. |
| 10 | 10 |
| 11 This program is distributed in the hope that it will be useful, | 11 This program is distributed in the hope that it will be useful, |
| 12 but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 GNU General Public License for more details. | 14 GNU General Public License for more details. |
| 15 | 15 |
| 16 You should have received a copy of the GNU General Public License | 16 You should have received a copy of the GNU General Public License |
| 17 along with this program. If not, see <http://www.gnu.org/licenses/>. */ | 17 along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
| 18 | 18 |
| 19 #include "server.h" | 19 #include "server.h" |
| 20 #include "terminal.h" | 20 #include "terminal.h" |
| 21 #include "target.h" | 21 #include "target.h" |
| 22 #include "gdbthread.h" |
| 22 #include <stdio.h> | 23 #include <stdio.h> |
| 23 #include <string.h> | 24 #include <string.h> |
| 24 #if HAVE_SYS_IOCTL_H | 25 #if HAVE_SYS_IOCTL_H |
| 25 #include <sys/ioctl.h> | 26 #include <sys/ioctl.h> |
| 26 #endif | 27 #endif |
| 27 #if HAVE_SYS_FILE_H | 28 #if HAVE_SYS_FILE_H |
| 28 #include <sys/file.h> | 29 #include <sys/file.h> |
| 29 #endif | 30 #endif |
| 30 #if HAVE_NETINET_IN_H | 31 #if HAVE_NETINET_IN_H |
| 31 #include <netinet/in.h> | 32 #include <netinet/in.h> |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 struct sym_cache | 99 struct sym_cache |
| 99 { | 100 { |
| 100 char *name; | 101 char *name; |
| 101 CORE_ADDR addr; | 102 CORE_ADDR addr; |
| 102 struct sym_cache *next; | 103 struct sym_cache *next; |
| 103 }; | 104 }; |
| 104 | 105 |
| 105 int remote_debug = 0; | 106 int remote_debug = 0; |
| 106 struct ui_file *gdb_stdlog; | 107 struct ui_file *gdb_stdlog; |
| 107 | 108 |
| 109 static int remote_is_stdio = 0; |
| 110 |
| 108 static gdb_fildes_t remote_desc = INVALID_DESCRIPTOR; | 111 static gdb_fildes_t remote_desc = INVALID_DESCRIPTOR; |
| 109 static gdb_fildes_t listen_desc = INVALID_DESCRIPTOR; | 112 static gdb_fildes_t listen_desc = INVALID_DESCRIPTOR; |
| 110 | 113 |
| 111 /* FIXME headerize? */ | 114 /* FIXME headerize? */ |
| 112 extern int using_threads; | 115 extern int using_threads; |
| 113 extern int debug_threads; | 116 extern int debug_threads; |
| 114 | 117 |
| 115 /* If true, then GDB has requested noack mode. */ | 118 /* If true, then GDB has requested noack mode. */ |
| 116 int noack_mode = 0; | 119 int noack_mode = 0; |
| 117 /* If true, then we tell GDB to use noack mode by default. */ | 120 /* If true, then we tell GDB to use noack mode by default. */ |
| 118 int transport_is_reliable = 0; | 121 int transport_is_reliable = 0; |
| 119 | 122 |
| 120 #ifdef USE_WIN32API | 123 #ifdef USE_WIN32API |
| 121 # define read(fd, buf, len) recv (fd, (char *) buf, len, 0) | 124 # define read(fd, buf, len) recv (fd, (char *) buf, len, 0) |
| 122 # define write(fd, buf, len) send (fd, (char *) buf, len, 0) | 125 # define write(fd, buf, len) send (fd, (char *) buf, len, 0) |
| 123 #endif | 126 #endif |
| 124 | 127 |
| 125 int | 128 int |
| 126 gdb_connected (void) | 129 gdb_connected (void) |
| 127 { | 130 { |
| 128 return remote_desc != INVALID_DESCRIPTOR; | 131 return remote_desc != INVALID_DESCRIPTOR; |
| 129 } | 132 } |
| 130 | 133 |
| 134 /* Return true if the remote connection is over stdio. */ |
| 135 |
| 136 int |
| 137 remote_connection_is_stdio (void) |
| 138 { |
| 139 return remote_is_stdio; |
| 140 } |
| 141 |
| 131 static void | 142 static void |
| 132 enable_async_notification (int fd) | 143 enable_async_notification (int fd) |
| 133 { | 144 { |
| 134 #if defined(F_SETFL) && defined (FASYNC) | 145 #if defined(F_SETFL) && defined (FASYNC) |
| 135 int save_fcntl_flags; | 146 int save_fcntl_flags; |
| 136 | 147 |
| 137 save_fcntl_flags = fcntl (fd, F_GETFL, 0); | 148 save_fcntl_flags = fcntl (fd, F_GETFL, 0); |
| 138 fcntl (fd, F_SETFL, save_fcntl_flags | FASYNC); | 149 fcntl (fd, F_SETFL, save_fcntl_flags | FASYNC); |
| 139 #if defined (F_SETOWN) | 150 #if defined (F_SETOWN) |
| 140 fcntl (fd, F_SETOWN, getpid ()); | 151 fcntl (fd, F_SETOWN, getpid ()); |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 { | 224 { |
| 214 char *port_str; | 225 char *port_str; |
| 215 #ifdef USE_WIN32API | 226 #ifdef USE_WIN32API |
| 216 static int winsock_initialized; | 227 static int winsock_initialized; |
| 217 #endif | 228 #endif |
| 218 int port; | 229 int port; |
| 219 struct sockaddr_in sockaddr; | 230 struct sockaddr_in sockaddr; |
| 220 socklen_t tmp; | 231 socklen_t tmp; |
| 221 char *port_end; | 232 char *port_end; |
| 222 | 233 |
| 234 remote_is_stdio = 0; |
| 235 if (strcmp (name, STDIO_CONNECTION_NAME) == 0) |
| 236 { |
| 237 /* We need to record fact that we're using stdio sooner than the |
| 238 call to remote_open so start_inferior knows the connection is |
| 239 via stdio. */ |
| 240 remote_is_stdio = 1; |
| 241 transport_is_reliable = 1; |
| 242 return; |
| 243 } |
| 244 |
| 223 port_str = strchr (name, ':'); | 245 port_str = strchr (name, ':'); |
| 224 if (port_str == NULL) | 246 if (port_str == NULL) |
| 225 { | 247 { |
| 226 transport_is_reliable = 0; | 248 transport_is_reliable = 0; |
| 227 return; | 249 return; |
| 228 } | 250 } |
| 229 | 251 |
| 230 port = strtoul (port_str + 1, &port_end, 10); | 252 port = strtoul (port_str + 1, &port_end, 10); |
| 231 if (port_str[1] == '\0' || *port_end != '\0') | 253 if (port_str[1] == '\0' || *port_end != '\0') |
| 232 fatal ("Bad port argument: %s", name); | 254 fatal ("Bad port argument: %s", name); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 263 | 285 |
| 264 /* Open a connection to a remote debugger. | 286 /* Open a connection to a remote debugger. |
| 265 NAME is the filename used for communication. */ | 287 NAME is the filename used for communication. */ |
| 266 | 288 |
| 267 void | 289 void |
| 268 remote_open (char *name) | 290 remote_open (char *name) |
| 269 { | 291 { |
| 270 char *port_str; | 292 char *port_str; |
| 271 | 293 |
| 272 port_str = strchr (name, ':'); | 294 port_str = strchr (name, ':'); |
| 295 #ifdef USE_WIN32API |
| 273 if (port_str == NULL) | 296 if (port_str == NULL) |
| 297 error ("Only <host>:<port> is supported on this platform."); |
| 298 #endif |
| 299 |
| 300 if (strcmp (name, STDIO_CONNECTION_NAME) == 0) |
| 274 { | 301 { |
| 275 #ifdef USE_WIN32API | 302 fprintf (stderr, "Remote debugging using stdio\n"); |
| 276 error ("Only <host>:<port> is supported on this platform."); | 303 |
| 277 #else | 304 /* Use stdin as the handle of the connection. |
| 305 » We only select on reads, for example. */ |
| 306 remote_desc = fileno (stdin); |
| 307 |
| 308 enable_async_notification (remote_desc); |
| 309 |
| 310 /* Register the event loop handler. */ |
| 311 add_file_handler (remote_desc, handle_serial_event, NULL); |
| 312 } |
| 313 #ifndef USE_WIN32API |
| 314 else if (port_str == NULL) |
| 315 { |
| 278 struct stat statbuf; | 316 struct stat statbuf; |
| 279 | 317 |
| 280 if (stat (name, &statbuf) == 0 | 318 if (stat (name, &statbuf) == 0 |
| 281 && (S_ISCHR (statbuf.st_mode) || S_ISFIFO (statbuf.st_mode))) | 319 && (S_ISCHR (statbuf.st_mode) || S_ISFIFO (statbuf.st_mode))) |
| 282 remote_desc = open (name, O_RDWR); | 320 remote_desc = open (name, O_RDWR); |
| 283 else | 321 else |
| 284 { | 322 { |
| 285 errno = EINVAL; | 323 errno = EINVAL; |
| 286 remote_desc = -1; | 324 remote_desc = -1; |
| 287 } | 325 } |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 332 ioctl (remote_desc, TIOCSETP, &sg); | 370 ioctl (remote_desc, TIOCSETP, &sg); |
| 333 } | 371 } |
| 334 #endif | 372 #endif |
| 335 | 373 |
| 336 fprintf (stderr, "Remote debugging using %s\n", name); | 374 fprintf (stderr, "Remote debugging using %s\n", name); |
| 337 | 375 |
| 338 enable_async_notification (remote_desc); | 376 enable_async_notification (remote_desc); |
| 339 | 377 |
| 340 /* Register the event loop handler. */ | 378 /* Register the event loop handler. */ |
| 341 add_file_handler (remote_desc, handle_serial_event, NULL); | 379 add_file_handler (remote_desc, handle_serial_event, NULL); |
| 380 } |
| 342 #endif /* USE_WIN32API */ | 381 #endif /* USE_WIN32API */ |
| 343 } | |
| 344 else | 382 else |
| 345 { | 383 { |
| 346 int port; | 384 int port; |
| 347 socklen_t len; | 385 socklen_t len; |
| 348 struct sockaddr_in sockaddr; | 386 struct sockaddr_in sockaddr; |
| 349 | 387 |
| 350 len = sizeof (sockaddr); | 388 len = sizeof (sockaddr); |
| 351 if (getsockname (listen_desc, | 389 if (getsockname (listen_desc, |
| 352 (struct sockaddr *) &sockaddr, &len) < 0 | 390 (struct sockaddr *) &sockaddr, &len) < 0 |
| 353 || len < sizeof (sockaddr)) | 391 || len < sizeof (sockaddr)) |
| 354 perror_with_name ("Can't determine port"); | 392 perror_with_name ("Can't determine port"); |
| 355 port = ntohs (sockaddr.sin_port); | 393 port = ntohs (sockaddr.sin_port); |
| 356 | 394 |
| 357 fprintf (stderr, "Listening on port %d\n", port); | 395 fprintf (stderr, "Listening on port %d\n", port); |
| 358 fflush (stderr); | 396 fflush (stderr); |
| 359 | 397 |
| 360 /* Register the event loop handler. */ | 398 /* Register the event loop handler. */ |
| 361 add_file_handler (listen_desc, handle_accept_event, NULL); | 399 add_file_handler (listen_desc, handle_accept_event, NULL); |
| 362 } | 400 } |
| 363 } | 401 } |
| 364 | 402 |
| 365 void | 403 void |
| 366 remote_close (void) | 404 remote_close (void) |
| 367 { | 405 { |
| 368 delete_file_handler (remote_desc); | 406 delete_file_handler (remote_desc); |
| 369 | 407 |
| 370 #ifdef USE_WIN32API | 408 #ifdef USE_WIN32API |
| 371 closesocket (remote_desc); | 409 closesocket (remote_desc); |
| 372 #else | 410 #else |
| 373 close (remote_desc); | 411 if (! remote_connection_is_stdio ()) |
| 412 close (remote_desc); |
| 374 #endif | 413 #endif |
| 375 remote_desc = INVALID_DESCRIPTOR; | 414 remote_desc = INVALID_DESCRIPTOR; |
| 376 | 415 |
| 377 reset_readchar (); | 416 reset_readchar (); |
| 378 } | 417 } |
| 379 | 418 |
| 380 /* Convert hex digit A to a number. */ | 419 /* Convert hex digit A to a number. */ |
| 381 | 420 |
| 382 static int | 421 static int |
| 383 fromhex (int a) | 422 fromhex (int a) |
| (...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 722 | 761 |
| 723 /* Since the stub is not sending a process id, then default to | 762 /* Since the stub is not sending a process id, then default to |
| 724 what's in the current inferior. */ | 763 what's in the current inferior. */ |
| 725 pid = ptid_get_pid (((struct inferior_list_entry *) current_inferior)->id); | 764 pid = ptid_get_pid (((struct inferior_list_entry *) current_inferior)->id); |
| 726 | 765 |
| 727 if (obuf) | 766 if (obuf) |
| 728 *obuf = pp; | 767 *obuf = pp; |
| 729 return ptid_build (pid, tid, 0); | 768 return ptid_build (pid, tid, 0); |
| 730 } | 769 } |
| 731 | 770 |
| 771 /* Write COUNT bytes in BUF to the client. |
| 772 The result is the number of bytes written or -1 if error. |
| 773 This may return less than COUNT. */ |
| 774 |
| 775 static int |
| 776 write_prim (const void *buf, int count) |
| 777 { |
| 778 if (remote_connection_is_stdio ()) |
| 779 return write (fileno (stdout), buf, count); |
| 780 else |
| 781 return write (remote_desc, buf, count); |
| 782 } |
| 783 |
| 784 /* Read COUNT bytes from the client and store in BUF. |
| 785 The result is the number of bytes read or -1 if error. |
| 786 This may return less than COUNT. */ |
| 787 |
| 788 static int |
| 789 read_prim (void *buf, int count) |
| 790 { |
| 791 if (remote_connection_is_stdio ()) |
| 792 return read (fileno (stdin), buf, count); |
| 793 else |
| 794 return read (remote_desc, buf, count); |
| 795 } |
| 796 |
| 732 /* Send a packet to the remote machine, with error checking. | 797 /* Send a packet to the remote machine, with error checking. |
| 733 The data of the packet is in BUF, and the length of the | 798 The data of the packet is in BUF, and the length of the |
| 734 packet is in CNT. Returns >= 0 on success, -1 otherwise. */ | 799 packet is in CNT. Returns >= 0 on success, -1 otherwise. */ |
| 735 | 800 |
| 736 static int | 801 static int |
| 737 putpkt_binary_1 (char *buf, int cnt, int is_notif) | 802 putpkt_binary_1 (char *buf, int cnt, int is_notif) |
| 738 { | 803 { |
| 739 int i; | 804 int i; |
| 740 unsigned char csum = 0; | 805 unsigned char csum = 0; |
| 741 char *buf2; | 806 char *buf2; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 759 *p++ = '#'; | 824 *p++ = '#'; |
| 760 *p++ = tohex ((csum >> 4) & 0xf); | 825 *p++ = tohex ((csum >> 4) & 0xf); |
| 761 *p++ = tohex (csum & 0xf); | 826 *p++ = tohex (csum & 0xf); |
| 762 | 827 |
| 763 *p = '\0'; | 828 *p = '\0'; |
| 764 | 829 |
| 765 /* Send it over and over until we get a positive ack. */ | 830 /* Send it over and over until we get a positive ack. */ |
| 766 | 831 |
| 767 do | 832 do |
| 768 { | 833 { |
| 769 if (write (remote_desc, buf2, p - buf2) != p - buf2) | 834 if (write_prim (buf2, p - buf2) != p - buf2) |
| 770 { | 835 { |
| 771 perror ("putpkt(write)"); | 836 perror ("putpkt(write)"); |
| 772 free (buf2); | 837 free (buf2); |
| 773 return -1; | 838 return -1; |
| 774 } | 839 } |
| 775 | 840 |
| 776 if (noack_mode || is_notif) | 841 if (noack_mode || is_notif) |
| 777 { | 842 { |
| 778 /* Don't expect an ack then. */ | 843 /* Don't expect an ack then. */ |
| 779 if (remote_debug) | 844 if (remote_debug) |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 854 /* Protect against spurious interrupts. This has been observed to | 919 /* Protect against spurious interrupts. This has been observed to |
| 855 be a problem under NetBSD 1.4 and 1.5. */ | 920 be a problem under NetBSD 1.4 and 1.5. */ |
| 856 | 921 |
| 857 FD_ZERO (&readset); | 922 FD_ZERO (&readset); |
| 858 FD_SET (remote_desc, &readset); | 923 FD_SET (remote_desc, &readset); |
| 859 if (select (remote_desc + 1, &readset, 0, 0, &immediate) > 0) | 924 if (select (remote_desc + 1, &readset, 0, 0, &immediate) > 0) |
| 860 { | 925 { |
| 861 int cc; | 926 int cc; |
| 862 char c = 0; | 927 char c = 0; |
| 863 | 928 |
| 864 cc = read (remote_desc, &c, 1); | 929 cc = read_prim (&c, 1); |
| 865 | 930 |
| 866 if (cc != 1 || c != '\003' || current_inferior == NULL) | 931 if (cc != 1 || c != '\003' || current_inferior == NULL) |
| 867 { | 932 { |
| 868 fprintf (stderr, "input_interrupt, count = %d c = %d ('%c')\n", | 933 fprintf (stderr, "input_interrupt, count = %d c = %d ('%c')\n", |
| 869 cc, c, c); | 934 cc, c, c); |
| 870 return; | 935 return; |
| 871 } | 936 } |
| 872 | 937 |
| 873 (*the_target->request_interrupt) (); | 938 (*the_target->request_interrupt) (); |
| 874 } | 939 } |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 982 | 1047 |
| 983 /* Returns next char from remote GDB. -1 if error. */ | 1048 /* Returns next char from remote GDB. -1 if error. */ |
| 984 | 1049 |
| 985 static int | 1050 static int |
| 986 readchar (void) | 1051 readchar (void) |
| 987 { | 1052 { |
| 988 int ch; | 1053 int ch; |
| 989 | 1054 |
| 990 if (readchar_bufcnt == 0) | 1055 if (readchar_bufcnt == 0) |
| 991 { | 1056 { |
| 992 readchar_bufcnt = read (remote_desc, readchar_buf, | 1057 readchar_bufcnt = read_prim (readchar_buf, sizeof (readchar_buf)); |
| 993 » » » sizeof (readchar_buf)); | |
| 994 | 1058 |
| 995 if (readchar_bufcnt <= 0) | 1059 if (readchar_bufcnt <= 0) |
| 996 { | 1060 { |
| 997 if (readchar_bufcnt == 0) | 1061 if (readchar_bufcnt == 0) |
| 998 fprintf (stderr, "readchar: Got EOF\n"); | 1062 fprintf (stderr, "readchar: Got EOF\n"); |
| 999 else | 1063 else |
| 1000 perror ("readchar"); | 1064 perror ("readchar"); |
| 1001 | 1065 |
| 1002 return -1; | 1066 return -1; |
| 1003 } | 1067 } |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1105 fprintf (stderr, | 1169 fprintf (stderr, |
| 1106 "Bad checksum, sentsum=0x%x, csum=0x%x, " | 1170 "Bad checksum, sentsum=0x%x, csum=0x%x, " |
| 1107 "buf=%s [no-ack-mode, Bad medium?]\n", | 1171 "buf=%s [no-ack-mode, Bad medium?]\n", |
| 1108 (c1 << 4) + c2, csum, buf); | 1172 (c1 << 4) + c2, csum, buf); |
| 1109 /* Not much we can do, GDB wasn't expecting an ack/nac. */ | 1173 /* Not much we can do, GDB wasn't expecting an ack/nac. */ |
| 1110 break; | 1174 break; |
| 1111 } | 1175 } |
| 1112 | 1176 |
| 1113 fprintf (stderr, "Bad checksum, sentsum=0x%x, csum=0x%x, buf=%s\n", | 1177 fprintf (stderr, "Bad checksum, sentsum=0x%x, csum=0x%x, buf=%s\n", |
| 1114 (c1 << 4) + c2, csum, buf); | 1178 (c1 << 4) + c2, csum, buf); |
| 1115 if (write (remote_desc, "-", 1) != 1) | 1179 if (write_prim ("-", 1) != 1) |
| 1116 return -1; | 1180 return -1; |
| 1117 } | 1181 } |
| 1118 | 1182 |
| 1119 if (!noack_mode) | 1183 if (!noack_mode) |
| 1120 { | 1184 { |
| 1121 if (remote_debug) | 1185 if (remote_debug) |
| 1122 { | 1186 { |
| 1123 fprintf (stderr, "getpkt (\"%s\"); [sending ack] \n", buf); | 1187 fprintf (stderr, "getpkt (\"%s\"); [sending ack] \n", buf); |
| 1124 fflush (stderr); | 1188 fflush (stderr); |
| 1125 } | 1189 } |
| 1126 | 1190 |
| 1127 if (write (remote_desc, "+", 1) != 1) | 1191 if (write_prim ("+", 1) != 1) |
| 1128 return -1; | 1192 return -1; |
| 1129 | 1193 |
| 1130 if (remote_debug) | 1194 if (remote_debug) |
| 1131 { | 1195 { |
| 1132 fprintf (stderr, "[sent ack]\n"); | 1196 fprintf (stderr, "[sent ack]\n"); |
| 1133 fflush (stderr); | 1197 fflush (stderr); |
| 1134 } | 1198 } |
| 1135 } | 1199 } |
| 1136 else | 1200 else |
| 1137 { | 1201 { |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1243 disable_async_io (); | 1307 disable_async_io (); |
| 1244 putpkt (own_buf); | 1308 putpkt (own_buf); |
| 1245 enable_async_io (); | 1309 enable_async_io (); |
| 1246 } | 1310 } |
| 1247 | 1311 |
| 1248 void | 1312 void |
| 1249 prepare_resume_reply (char *buf, ptid_t ptid, | 1313 prepare_resume_reply (char *buf, ptid_t ptid, |
| 1250 struct target_waitstatus *status) | 1314 struct target_waitstatus *status) |
| 1251 { | 1315 { |
| 1252 if (debug_threads) | 1316 if (debug_threads) |
| 1253 fprintf (stderr, "Writing resume reply for %s:%d\n\n", | 1317 fprintf (stderr, "Writing resume reply for %s:%d\n", |
| 1254 target_pid_to_str (ptid), status->kind); | 1318 target_pid_to_str (ptid), status->kind); |
| 1255 | 1319 |
| 1256 switch (status->kind) | 1320 switch (status->kind) |
| 1257 { | 1321 { |
| 1258 case TARGET_WAITKIND_STOPPED: | 1322 case TARGET_WAITKIND_STOPPED: |
| 1259 { | 1323 { |
| 1260 struct thread_info *saved_inferior; | 1324 struct thread_info *saved_inferior; |
| 1261 const char **regp; | 1325 const char **regp; |
| 1262 struct regcache *regcache; | 1326 struct regcache *regcache; |
| 1263 | 1327 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1320 /* In non-stop, don't change the general thread behind | 1384 /* In non-stop, don't change the general thread behind |
| 1321 GDB's back. */ | 1385 GDB's back. */ |
| 1322 if (!non_stop) | 1386 if (!non_stop) |
| 1323 general_thread = ptid; | 1387 general_thread = ptid; |
| 1324 sprintf (buf, "thread:"); | 1388 sprintf (buf, "thread:"); |
| 1325 buf += strlen (buf); | 1389 buf += strlen (buf); |
| 1326 buf = write_ptid (buf, ptid); | 1390 buf = write_ptid (buf, ptid); |
| 1327 strcat (buf, ";"); | 1391 strcat (buf, ";"); |
| 1328 buf += strlen (buf); | 1392 buf += strlen (buf); |
| 1329 | 1393 |
| 1330 » » if (the_target->core_of_thread) | 1394 » » core = target_core_of_thread (ptid); |
| 1331 » » core = (*the_target->core_of_thread) (ptid); | 1395 |
| 1332 if (core != -1) | 1396 if (core != -1) |
| 1333 { | 1397 { |
| 1334 sprintf (buf, "core:"); | 1398 sprintf (buf, "core:"); |
| 1335 buf += strlen (buf); | 1399 buf += strlen (buf); |
| 1336 sprintf (buf, "%x", core); | 1400 sprintf (buf, "%x", core); |
| 1337 strcat (buf, ";"); | 1401 strcat (buf, ";"); |
| 1338 buf += strlen (buf); | 1402 buf += strlen (buf); |
| 1339 } | 1403 } |
| 1340 } | 1404 } |
| 1341 } | 1405 } |
| (...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1706 char *buf = xmalloc (strlen (msg) * 2 + 2); | 1770 char *buf = xmalloc (strlen (msg) * 2 + 2); |
| 1707 | 1771 |
| 1708 buf[0] = 'O'; | 1772 buf[0] = 'O'; |
| 1709 hexify (buf + 1, msg, 0); | 1773 hexify (buf + 1, msg, 0); |
| 1710 | 1774 |
| 1711 putpkt (buf); | 1775 putpkt (buf); |
| 1712 free (buf); | 1776 free (buf); |
| 1713 } | 1777 } |
| 1714 | 1778 |
| 1715 #endif | 1779 #endif |
| OLD | NEW |