1*56bb7041Schristos /* Remote utility routines for the remote server for GDB.
2*56bb7041Schristos    Copyright (C) 1993-2020 Free Software Foundation, Inc.
3*56bb7041Schristos 
4*56bb7041Schristos    This file is part of GDB.
5*56bb7041Schristos 
6*56bb7041Schristos    This program is free software; you can redistribute it and/or modify
7*56bb7041Schristos    it under the terms of the GNU General Public License as published by
8*56bb7041Schristos    the Free Software Foundation; either version 3 of the License, or
9*56bb7041Schristos    (at your option) any later version.
10*56bb7041Schristos 
11*56bb7041Schristos    This program is distributed in the hope that it will be useful,
12*56bb7041Schristos    but WITHOUT ANY WARRANTY; without even the implied warranty of
13*56bb7041Schristos    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14*56bb7041Schristos    GNU General Public License for more details.
15*56bb7041Schristos 
16*56bb7041Schristos    You should have received a copy of the GNU General Public License
17*56bb7041Schristos    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
18*56bb7041Schristos 
19*56bb7041Schristos #ifndef GDBSERVER_REMOTE_UTILS_H
20*56bb7041Schristos #define GDBSERVER_REMOTE_UTILS_H
21*56bb7041Schristos 
22*56bb7041Schristos int gdb_connected (void);
23*56bb7041Schristos 
24*56bb7041Schristos #define STDIO_CONNECTION_NAME "stdio"
25*56bb7041Schristos int remote_connection_is_stdio (void);
26*56bb7041Schristos 
27*56bb7041Schristos ptid_t read_ptid (const char *buf, const char **obuf);
28*56bb7041Schristos char *write_ptid (char *buf, ptid_t ptid);
29*56bb7041Schristos 
30*56bb7041Schristos int putpkt (char *buf);
31*56bb7041Schristos int putpkt_binary (char *buf, int len);
32*56bb7041Schristos int putpkt_notif (char *buf);
33*56bb7041Schristos int getpkt (char *buf);
34*56bb7041Schristos void remote_prepare (const char *name);
35*56bb7041Schristos void remote_open (const char *name);
36*56bb7041Schristos void remote_close (void);
37*56bb7041Schristos void write_ok (char *buf);
38*56bb7041Schristos void write_enn (char *buf);
39*56bb7041Schristos void initialize_async_io (void);
40*56bb7041Schristos void enable_async_io (void);
41*56bb7041Schristos void disable_async_io (void);
42*56bb7041Schristos void check_remote_input_interrupt_request (void);
43*56bb7041Schristos void prepare_resume_reply (char *buf, ptid_t ptid,
44*56bb7041Schristos 			   struct target_waitstatus *status);
45*56bb7041Schristos 
46*56bb7041Schristos const char *decode_address_to_semicolon (CORE_ADDR *addrp, const char *start);
47*56bb7041Schristos void decode_address (CORE_ADDR *addrp, const char *start, int len);
48*56bb7041Schristos void decode_m_packet (char *from, CORE_ADDR * mem_addr_ptr,
49*56bb7041Schristos 		      unsigned int *len_ptr);
50*56bb7041Schristos void decode_M_packet (char *from, CORE_ADDR * mem_addr_ptr,
51*56bb7041Schristos 		      unsigned int *len_ptr, unsigned char **to_p);
52*56bb7041Schristos int decode_X_packet (char *from, int packet_len, CORE_ADDR * mem_addr_ptr,
53*56bb7041Schristos 		     unsigned int *len_ptr, unsigned char **to_p);
54*56bb7041Schristos int decode_xfer_write (char *buf, int packet_len,
55*56bb7041Schristos 		       CORE_ADDR *offset, unsigned int *len,
56*56bb7041Schristos 		       unsigned char *data);
57*56bb7041Schristos int decode_search_memory_packet (const char *buf, int packet_len,
58*56bb7041Schristos 				 CORE_ADDR *start_addrp,
59*56bb7041Schristos 				 CORE_ADDR *search_space_lenp,
60*56bb7041Schristos 				 gdb_byte *pattern,
61*56bb7041Schristos 				 unsigned int *pattern_lenp);
62*56bb7041Schristos 
63*56bb7041Schristos void clear_symbol_cache (struct sym_cache **symcache_p);
64*56bb7041Schristos int look_up_one_symbol (const char *name, CORE_ADDR *addrp, int may_ask_gdb);
65*56bb7041Schristos 
66*56bb7041Schristos int relocate_instruction (CORE_ADDR *to, CORE_ADDR oldloc);
67*56bb7041Schristos 
68*56bb7041Schristos void monitor_output (const char *msg);
69*56bb7041Schristos 
70*56bb7041Schristos #endif /* GDBSERVER_REMOTE_UTILS_H */
71