18dffb485Schristos /* Remote utility routines for the remote server for GDB. 2*13ed34faSchristos Copyright (C) 1993-2024 Free Software Foundation, Inc. 38dffb485Schristos 48dffb485Schristos This file is part of GDB. 58dffb485Schristos 68dffb485Schristos This program is free software; you can redistribute it and/or modify 78dffb485Schristos it under the terms of the GNU General Public License as published by 88dffb485Schristos the Free Software Foundation; either version 3 of the License, or 98dffb485Schristos (at your option) any later version. 108dffb485Schristos 118dffb485Schristos This program is distributed in the hope that it will be useful, 128dffb485Schristos but WITHOUT ANY WARRANTY; without even the implied warranty of 138dffb485Schristos MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 148dffb485Schristos GNU General Public License for more details. 158dffb485Schristos 168dffb485Schristos You should have received a copy of the GNU General Public License 178dffb485Schristos along with this program. If not, see <http://www.gnu.org/licenses/>. */ 188dffb485Schristos 198dffb485Schristos #ifndef GDBSERVER_REMOTE_UTILS_H 208dffb485Schristos #define GDBSERVER_REMOTE_UTILS_H 218dffb485Schristos 228dffb485Schristos int gdb_connected (void); 238dffb485Schristos 248dffb485Schristos #define STDIO_CONNECTION_NAME "stdio" 258dffb485Schristos int remote_connection_is_stdio (void); 268dffb485Schristos 278dffb485Schristos ptid_t read_ptid (const char *buf, const char **obuf); 288dffb485Schristos char *write_ptid (char *buf, ptid_t ptid); 298dffb485Schristos 308dffb485Schristos int putpkt (char *buf); 318dffb485Schristos int putpkt_binary (char *buf, int len); 328dffb485Schristos int putpkt_notif (char *buf); 338dffb485Schristos int getpkt (char *buf); 348dffb485Schristos void remote_prepare (const char *name); 358dffb485Schristos void remote_open (const char *name); 368dffb485Schristos void remote_close (void); 378dffb485Schristos void write_ok (char *buf); 388dffb485Schristos void write_enn (char *buf); 398dffb485Schristos void initialize_async_io (void); 408dffb485Schristos void enable_async_io (void); 418dffb485Schristos void disable_async_io (void); 428dffb485Schristos void check_remote_input_interrupt_request (void); 438dffb485Schristos void prepare_resume_reply (char *buf, ptid_t ptid, 444b169a6bSchristos const target_waitstatus &status); 458dffb485Schristos 468dffb485Schristos const char *decode_address_to_semicolon (CORE_ADDR *addrp, const char *start); 478dffb485Schristos void decode_address (CORE_ADDR *addrp, const char *start, int len); 484b169a6bSchristos 494b169a6bSchristos /* Given an input string FROM, decode MEM_ADDR_PTR, a memory address in hex 504b169a6bSchristos form, and LEN_PTR, a length argument in hex form, from the pattern 514b169a6bSchristos "<MEM_ADDR_PTR>,<LEN_PTR><END_MARKER>", with END_MARKER being an end marker 524b169a6bSchristos character. */ 534b169a6bSchristos const char *decode_m_packet_params (const char *from, CORE_ADDR *mem_addr_ptr, 544b169a6bSchristos unsigned int *len_ptr, 554b169a6bSchristos const char end_marker); 564b169a6bSchristos void decode_m_packet (const char *from, CORE_ADDR * mem_addr_ptr, 578dffb485Schristos unsigned int *len_ptr); 584b169a6bSchristos void decode_M_packet (const char *from, CORE_ADDR * mem_addr_ptr, 598dffb485Schristos unsigned int *len_ptr, unsigned char **to_p); 608dffb485Schristos int decode_X_packet (char *from, int packet_len, CORE_ADDR * mem_addr_ptr, 618dffb485Schristos unsigned int *len_ptr, unsigned char **to_p); 628dffb485Schristos int decode_xfer_write (char *buf, int packet_len, 638dffb485Schristos CORE_ADDR *offset, unsigned int *len, 648dffb485Schristos unsigned char *data); 658dffb485Schristos int decode_search_memory_packet (const char *buf, int packet_len, 668dffb485Schristos CORE_ADDR *start_addrp, 678dffb485Schristos CORE_ADDR *search_space_lenp, 688dffb485Schristos gdb_byte *pattern, 698dffb485Schristos unsigned int *pattern_lenp); 708dffb485Schristos 718dffb485Schristos void clear_symbol_cache (struct sym_cache **symcache_p); 728dffb485Schristos int look_up_one_symbol (const char *name, CORE_ADDR *addrp, int may_ask_gdb); 738dffb485Schristos 748dffb485Schristos int relocate_instruction (CORE_ADDR *to, CORE_ADDR oldloc); 758dffb485Schristos 768dffb485Schristos void monitor_output (const char *msg); 778dffb485Schristos 788dffb485Schristos #endif /* GDBSERVER_REMOTE_UTILS_H */ 79