| 1 | /* Common definitions for remote server for GDB. |
| 2 | Copyright (C) 1993 Free Software Foundation, Inc. |
| 3 | |
| 4 | This file is part of GDB. |
| 5 | |
| 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 |
| 8 | the Free Software Foundation; either version 2 of the License, or |
| 9 | (at your option) any later version. |
| 10 | |
| 11 | This program is distributed in the hope that it will be useful, |
| 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | GNU General Public License for more details. |
| 15 | |
| 16 | You should have received a copy of the GNU General Public License |
| 17 | along with this program; if not, write to the Free Software |
| 18 | Foundation, Inc., 59 Temple Place - Suite 330, |
| 19 | Boston, MA 02111-1307, USA. */ |
| 20 | |
| 21 | #include "defs.h" |
| 22 | #include <setjmp.h> |
| 23 | |
| 24 | /* Target-specific functions */ |
| 25 | |
| 26 | int create_inferior PARAMS ((char *program, char **allargs)); |
| 27 | void kill_inferior PARAMS ((void)); |
| 28 | void fetch_inferior_registers PARAMS ((int regno)); |
| 29 | void store_inferior_registers PARAMS ((int regno)); |
| 30 | int mythread_alive PARAMS ((int pid)); |
| 31 | void myresume PARAMS ((int step, int signo)); |
| 32 | unsigned char mywait PARAMS ((char *status)); |
| 33 | void read_inferior_memory PARAMS ((CORE_ADDR memaddr, char *myaddr, int len)); |
| 34 | int write_inferior_memory PARAMS ((CORE_ADDR memaddr, char *myaddr, int len)); |
| 35 | int create_inferior (); |
| 36 | |
| 37 | /* Target-specific variables */ |
| 38 | |
| 39 | extern char *registers; |
| 40 | |
| 41 | /* Public variables in server.c */ |
| 42 | |
| 43 | extern int cont_thread; |
| 44 | extern int general_thread; |
| 45 | extern int thread_from_wait; |
| 46 | extern int old_thread_from_wait; |
| 47 | |
| 48 | extern jmp_buf toplevel; |
| 49 | extern int inferior_pid; |
| 50 | |
| 51 | /* Functions from remote-utils.c */ |
| 52 | |
| 53 | int putpkt PARAMS ((char *buf)); |
| 54 | int getpkt PARAMS ((char *buf)); |
| 55 | void remote_open PARAMS ((char *name)); |
| 56 | void remote_close PARAMS ((void)); |
| 57 | void write_ok PARAMS ((char *buf)); |
| 58 | void write_enn PARAMS ((char *buf)); |
| 59 | void enable_async_io PARAMS ((void)); |
| 60 | void disable_async_io PARAMS ((void)); |
| 61 | void convert_ascii_to_int PARAMS ((char *from, char *to, int n)); |
| 62 | void convert_int_to_ascii PARAMS ((char *from, char *to, int n)); |
| 63 | void prepare_resume_reply PARAMS ((char *buf, char status, unsigned char sig)); |
| 64 | |
| 65 | void decode_m_packet PARAMS ((char *from, CORE_ADDR * mem_addr_ptr, |
| 66 | unsigned int *len_ptr)); |
| 67 | void decode_M_packet PARAMS ((char *from, CORE_ADDR * mem_addr_ptr, |
| 68 | unsigned int *len_ptr, char *to)); |
| 69 | |
| 70 | |
| 71 | /* Functions from utils.c */ |
| 72 | |
| 73 | void perror_with_name PARAMS ((char *string)); |
| 74 | |
| 75 | |
| 76 | /* Maximum number of bytes to read/write at once. The value here |
| 77 | is chosen to fill up a packet (the headers account for the 32). */ |
| 78 | #define MAXBUFBYTES(N) (((N)-32)/2) |
| 79 | |
| 80 | /* Buffer sizes for transferring memory, registers, etc. Round up PBUFSIZ to |
| 81 | hold all the registers, at least. */ |
| 82 | #define PBUFSIZ ((REGISTER_BYTES > MAXBUFBYTES (2000)) \ |
| 83 | ? (REGISTER_BYTES * 2 + 32) \ |
| 84 | : 2000) |