Fix null pointer dereference in process_debug_info()
[binutils-gdb.git] / gdbserver / remote-utils.h
blob4681ca12f550eee4861bca3e1c7cb2f3a53d5be2
1 /* Remote utility routines for the remote server for GDB.
2 Copyright (C) 1993-2024 Free Software Foundation, Inc.
4 This file is part of GDB.
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 3 of the License, or
9 (at your option) any later version.
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.
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/>. */
19 #ifndef GDBSERVER_REMOTE_UTILS_H
20 #define GDBSERVER_REMOTE_UTILS_H
22 int gdb_connected (void);
24 #define STDIO_CONNECTION_NAME "stdio"
25 int remote_connection_is_stdio (void);
27 ptid_t read_ptid (const char *buf, const char **obuf);
28 char *write_ptid (char *buf, ptid_t ptid);
30 int putpkt (char *buf);
31 int putpkt_binary (char *buf, int len);
32 int putpkt_notif (char *buf);
33 int getpkt (char *buf);
34 void remote_prepare (const char *name);
35 void remote_open (const char *name);
36 void remote_close (void);
37 void write_ok (char *buf);
38 void write_enn (char *buf);
39 void initialize_async_io (void);
40 void enable_async_io (void);
41 void disable_async_io (void);
42 void check_remote_input_interrupt_request (void);
43 void prepare_resume_reply (char *buf, ptid_t ptid,
44 const target_waitstatus &status);
46 const char *decode_address_to_semicolon (CORE_ADDR *addrp, const char *start);
47 void decode_address (CORE_ADDR *addrp, const char *start, int len);
49 /* Given an input string FROM, decode MEM_ADDR_PTR, a memory address in hex
50 form, and LEN_PTR, a length argument in hex form, from the pattern
51 "<MEM_ADDR_PTR>,<LEN_PTR><END_MARKER>", with END_MARKER being an end marker
52 character. */
53 const char *decode_m_packet_params (const char *from, CORE_ADDR *mem_addr_ptr,
54 unsigned int *len_ptr,
55 const char end_marker);
56 void decode_m_packet (const char *from, CORE_ADDR * mem_addr_ptr,
57 unsigned int *len_ptr);
58 void decode_M_packet (const char *from, CORE_ADDR * mem_addr_ptr,
59 unsigned int *len_ptr, unsigned char **to_p);
60 int decode_X_packet (char *from, int packet_len, CORE_ADDR * mem_addr_ptr,
61 unsigned int *len_ptr, unsigned char **to_p);
62 int decode_xfer_write (char *buf, int packet_len,
63 CORE_ADDR *offset, unsigned int *len,
64 unsigned char *data);
65 int decode_search_memory_packet (const char *buf, int packet_len,
66 CORE_ADDR *start_addrp,
67 CORE_ADDR *search_space_lenp,
68 gdb_byte *pattern,
69 unsigned int *pattern_lenp);
71 void clear_symbol_cache (struct sym_cache **symcache_p);
72 int look_up_one_symbol (const char *name, CORE_ADDR *addrp, int may_ask_gdb);
74 int relocate_instruction (CORE_ADDR *to, CORE_ADDR oldloc);
76 void monitor_output (const char *msg);
78 #endif /* GDBSERVER_REMOTE_UTILS_H */