Commit | Line | Data |
---|---|---|
c906108c | 1 | /* Common definitions for remote server for GDB. |
28e7fd62 | 2 | Copyright (C) 1993-2013 Free Software Foundation, Inc. |
c906108c | 3 | |
c5aa993b | 4 | This file is part of GDB. |
c906108c | 5 | |
c5aa993b JM |
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 | |
a9762ec7 | 8 | the Free Software Foundation; either version 3 of the License, or |
c5aa993b | 9 | (at your option) any later version. |
c906108c | 10 | |
c5aa993b JM |
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. | |
c906108c | 15 | |
c5aa993b | 16 | You should have received a copy of the GNU General Public License |
a9762ec7 | 17 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
c906108c | 18 | |
0a30fbc4 DJ |
19 | #ifndef SERVER_H |
20 | #define SERVER_H | |
21 | ||
22 | #include "config.h" | |
406b1477 | 23 | #include "build-gnulib-gdbserver/config.h" |
0729219d | 24 | |
68070c10 PA |
25 | #ifdef __MINGW32CE__ |
26 | #include "wincecompat.h" | |
27 | #endif | |
28 | ||
18c1b81a YQ |
29 | #include "libiberty.h" |
30 | #include "ansidecl.h" | |
01208463 | 31 | #include "version.h" |
18c1b81a | 32 | |
0a30fbc4 DJ |
33 | #include <stdarg.h> |
34 | #include <stdio.h> | |
35 | #include <stdlib.h> | |
68070c10 | 36 | #ifdef HAVE_ERRNO_H |
0a30fbc4 | 37 | #include <errno.h> |
68070c10 | 38 | #endif |
0729219d | 39 | #include <setjmp.h> |
0a30fbc4 | 40 | |
d8d2a3ee PA |
41 | /* For gnulib's PATH_MAX. */ |
42 | #include "pathmax.h" | |
43 | ||
d64b8841 DJ |
44 | #ifdef HAVE_STRING_H |
45 | #include <string.h> | |
46 | #endif | |
47 | ||
a1723c35 | 48 | #ifdef HAVE_ALLOCA_H |
49 | #include <alloca.h> | |
50 | #endif | |
a778ab81 | 51 | /* On some systems such as MinGW, alloca is declared in malloc.h |
52 | (there is no alloca.h). */ | |
53 | #if HAVE_MALLOC_H | |
54 | #include <malloc.h> | |
55 | #endif | |
a1723c35 | 56 | |
e122f1f5 | 57 | #if !HAVE_DECL_STRERROR |
43d5792c DJ |
58 | #ifndef strerror |
59 | extern char *strerror (int); /* X3.159-1989 4.11.6.2 */ | |
60 | #endif | |
61 | #endif | |
62 | ||
68070c10 PA |
63 | #if !HAVE_DECL_PERROR |
64 | #ifndef perror | |
65 | extern void perror (const char *); | |
66 | #endif | |
67 | #endif | |
68 | ||
bb0116a4 JB |
69 | #if !HAVE_DECL_VASPRINTF |
70 | extern int vasprintf(char **strp, const char *fmt, va_list ap); | |
71 | #endif | |
72 | #if !HAVE_DECL_VSNPRINTF | |
73 | int vsnprintf(char *str, size_t size, const char *format, va_list ap); | |
74 | #endif | |
75 | ||
9e0627f1 PM |
76 | /* Define underscore macro, if not available, to be able to use it inside |
77 | code shared with gdb in common directory. */ | |
78 | #ifndef _ | |
79 | #define _(String) (String) | |
80 | #endif | |
81 | ||
5e1dc496 LM |
82 | #ifdef IN_PROCESS_AGENT |
83 | # define PROG "ipa" | |
84 | #else | |
85 | # define PROG "gdbserver" | |
86 | #endif | |
87 | ||
01f9e8fa DJ |
88 | /* A type used for binary buffers. */ |
89 | typedef unsigned char gdb_byte; | |
90 | ||
d26e3629 KY |
91 | #include "ptid.h" |
92 | #include "buffer.h" | |
93 | #include "xml-utils.h" | |
94 | #include "gdb_locale.h" | |
95 | ||
0729219d DJ |
96 | /* FIXME: This should probably be autoconf'd for. It's an integer type at |
97 | least the size of a (void *). */ | |
0a30fbc4 DJ |
98 | typedef long long CORE_ADDR; |
99 | ||
219f2f23 | 100 | typedef long long LONGEST; |
95954743 PA |
101 | typedef unsigned long long ULONGEST; |
102 | ||
0d62e5e8 DJ |
103 | /* Generic information for tracking a list of ``inferiors'' - threads, |
104 | processes, etc. */ | |
105 | struct inferior_list | |
106 | { | |
107 | struct inferior_list_entry *head; | |
108 | struct inferior_list_entry *tail; | |
109 | }; | |
110 | struct inferior_list_entry | |
111 | { | |
95954743 | 112 | ptid_t id; |
0d62e5e8 DJ |
113 | struct inferior_list_entry *next; |
114 | }; | |
115 | ||
0d62e5e8 | 116 | struct thread_info; |
d50171e4 PA |
117 | struct process_info; |
118 | struct regcache; | |
3aee8918 | 119 | struct target_desc; |
d50171e4 PA |
120 | |
121 | #include "regcache.h" | |
122 | #include "gdb/signals.h" | |
123 | #include "gdb_signals.h" | |
124 | #include "target.h" | |
125 | #include "mem-break.h" | |
623b6bdf | 126 | #include "gdbthread.h" |
c04a1aa8 | 127 | |
255e7678 DJ |
128 | struct dll_info |
129 | { | |
130 | struct inferior_list_entry entry; | |
131 | char *name; | |
132 | CORE_ADDR base_addr; | |
133 | }; | |
134 | ||
95954743 PA |
135 | struct sym_cache; |
136 | struct breakpoint; | |
8b07ae33 | 137 | struct raw_breakpoint; |
fa593d66 | 138 | struct fast_tracepoint_jump; |
95954743 PA |
139 | struct process_info_private; |
140 | ||
141 | struct process_info | |
142 | { | |
143 | struct inferior_list_entry head; | |
144 | ||
8336d594 PA |
145 | /* Nonzero if this child process was attached rather than |
146 | spawned. */ | |
95954743 PA |
147 | int attached; |
148 | ||
8336d594 PA |
149 | /* True if GDB asked us to detach from this process, but we remained |
150 | attached anyway. */ | |
151 | int gdb_detached; | |
152 | ||
95954743 PA |
153 | /* The symbol cache. */ |
154 | struct sym_cache *symbol_cache; | |
155 | ||
95954743 PA |
156 | /* The list of memory breakpoints. */ |
157 | struct breakpoint *breakpoints; | |
158 | ||
8b07ae33 PA |
159 | /* The list of raw memory breakpoints. */ |
160 | struct raw_breakpoint *raw_breakpoints; | |
161 | ||
fa593d66 PA |
162 | /* The list of installed fast tracepoints. */ |
163 | struct fast_tracepoint_jump *fast_tracepoint_jumps; | |
164 | ||
3aee8918 PA |
165 | const struct target_desc *tdesc; |
166 | ||
95954743 PA |
167 | /* Private target data. */ |
168 | struct process_info_private *private; | |
169 | }; | |
170 | ||
171 | /* Return a pointer to the process that corresponds to the current | |
172 | thread (current_inferior). It is an error to call this if there is | |
173 | no current thread selected. */ | |
174 | ||
175 | struct process_info *current_process (void); | |
7fe519cb | 176 | struct process_info *get_thread_process (struct thread_info *); |
95954743 | 177 | |
c906108c SS |
178 | /* Target-specific functions */ |
179 | ||
4ce44c66 | 180 | void initialize_low (); |
c906108c | 181 | |
ce3a066d DJ |
182 | /* From inferiors.c. */ |
183 | ||
95954743 | 184 | extern struct inferior_list all_processes; |
255e7678 DJ |
185 | extern struct inferior_list all_dlls; |
186 | extern int dlls_changed; | |
bf4c19f7 | 187 | extern void clear_dlls (void); |
255e7678 | 188 | |
0d62e5e8 DJ |
189 | void add_inferior_to_list (struct inferior_list *list, |
190 | struct inferior_list_entry *new_inferior); | |
191 | void for_each_inferior (struct inferior_list *list, | |
192 | void (*action) (struct inferior_list_entry *)); | |
95954743 | 193 | |
0d62e5e8 DJ |
194 | extern struct thread_info *current_inferior; |
195 | void remove_inferior (struct inferior_list *list, | |
196 | struct inferior_list_entry *entry); | |
95954743 PA |
197 | |
198 | struct process_info *add_process (int pid, int attached); | |
199 | void remove_process (struct process_info *process); | |
200 | struct process_info *find_process_pid (int pid); | |
9f767825 DE |
201 | int have_started_inferiors_p (void); |
202 | int have_attached_inferiors_p (void); | |
95954743 | 203 | |
95954743 PA |
204 | ptid_t thread_id_to_gdb_id (ptid_t); |
205 | ptid_t thread_to_gdb_id (struct thread_info *); | |
206 | ptid_t gdb_id_to_thread_id (ptid_t); | |
623b6bdf | 207 | |
ce3a066d | 208 | void clear_inferiors (void); |
0d62e5e8 DJ |
209 | struct inferior_list_entry *find_inferior |
210 | (struct inferior_list *, | |
211 | int (*func) (struct inferior_list_entry *, | |
212 | void *), | |
213 | void *arg); | |
214 | struct inferior_list_entry *find_inferior_id (struct inferior_list *list, | |
95954743 | 215 | ptid_t id); |
0d62e5e8 DJ |
216 | void *inferior_target_data (struct thread_info *); |
217 | void set_inferior_target_data (struct thread_info *, void *); | |
218 | void *inferior_regcache_data (struct thread_info *); | |
219 | void set_inferior_regcache_data (struct thread_info *, void *); | |
ce3a066d | 220 | |
255e7678 DJ |
221 | void loaded_dll (const char *name, CORE_ADDR base_addr); |
222 | void unloaded_dll (const char *name, CORE_ADDR base_addr); | |
223 | ||
c906108c SS |
224 | /* Public variables in server.c */ |
225 | ||
95954743 PA |
226 | extern ptid_t cont_thread; |
227 | extern ptid_t general_thread; | |
5b1c542e | 228 | |
0d62e5e8 | 229 | extern int server_waiting; |
c74d0ad8 | 230 | extern int debug_threads; |
aa5ca48f | 231 | extern int debug_hw_points; |
89be2091 | 232 | extern int pass_signals[]; |
9b224c5e PA |
233 | extern int program_signals[]; |
234 | extern int program_signals_p; | |
c906108c SS |
235 | |
236 | extern jmp_buf toplevel; | |
c906108c | 237 | |
db42f210 PA |
238 | extern int disable_packet_vCont; |
239 | extern int disable_packet_Tthread; | |
240 | extern int disable_packet_qC; | |
241 | extern int disable_packet_qfThreadInfo; | |
242 | ||
03f2bd59 | 243 | extern int run_once; |
95954743 | 244 | extern int multi_process; |
bd99dc85 PA |
245 | extern int non_stop; |
246 | ||
03583c20 UW |
247 | extern int disable_randomization; |
248 | ||
ec48365d PA |
249 | #if USE_WIN32API |
250 | #include <winsock2.h> | |
251 | typedef SOCKET gdb_fildes_t; | |
252 | #else | |
253 | typedef int gdb_fildes_t; | |
254 | #endif | |
255 | ||
bd99dc85 PA |
256 | /* Functions from event-loop.c. */ |
257 | typedef void *gdb_client_data; | |
8336d594 | 258 | typedef int (handler_func) (int, gdb_client_data); |
24b066ba | 259 | typedef int (callback_handler_func) (gdb_client_data); |
bd99dc85 | 260 | |
ec48365d PA |
261 | extern void delete_file_handler (gdb_fildes_t fd); |
262 | extern void add_file_handler (gdb_fildes_t fd, handler_func *proc, | |
bd99dc85 | 263 | gdb_client_data client_data); |
24b066ba DE |
264 | extern int append_callback_event (callback_handler_func *proc, |
265 | gdb_client_data client_data); | |
266 | extern void delete_callback_event (int id); | |
bd99dc85 PA |
267 | |
268 | extern void start_event_loop (void); | |
60f662b0 | 269 | extern void initialize_event_loop (void); |
bd99dc85 PA |
270 | |
271 | /* Functions from server.c. */ | |
8336d594 PA |
272 | extern int handle_serial_event (int err, gdb_client_data client_data); |
273 | extern int handle_target_event (int err, gdb_client_data client_data); | |
bd99dc85 | 274 | |
a6b151f1 DJ |
275 | /* Functions from hostio.c. */ |
276 | extern int handle_vFile (char *, int, int *); | |
277 | ||
59a016f0 PA |
278 | /* Functions from hostio-errno.c. */ |
279 | extern void hostio_last_error_from_errno (char *own_buf); | |
280 | ||
ea025f5f DJ |
281 | /* From remote-utils.c */ |
282 | ||
c74d0ad8 | 283 | extern int remote_debug; |
a6f3e723 SL |
284 | extern int noack_mode; |
285 | extern int transport_is_reliable; | |
c906108c | 286 | |
8336d594 PA |
287 | int gdb_connected (void); |
288 | ||
e0f9f062 DE |
289 | #define STDIO_CONNECTION_NAME "stdio" |
290 | int remote_connection_is_stdio (void); | |
291 | ||
95954743 PA |
292 | ptid_t read_ptid (char *buf, char **obuf); |
293 | char *write_ptid (char *buf, ptid_t ptid); | |
294 | ||
a14ed312 | 295 | int putpkt (char *buf); |
01f9e8fa | 296 | int putpkt_binary (char *buf, int len); |
bd99dc85 | 297 | int putpkt_notif (char *buf); |
a14ed312 | 298 | int getpkt (char *buf); |
03f2bd59 | 299 | void remote_prepare (char *name); |
a14ed312 KB |
300 | void remote_open (char *name); |
301 | void remote_close (void); | |
302 | void write_ok (char *buf); | |
303 | void write_enn (char *buf); | |
a20d5e98 | 304 | void initialize_async_io (void); |
a14ed312 KB |
305 | void enable_async_io (void); |
306 | void disable_async_io (void); | |
7390519e | 307 | void check_remote_input_interrupt_request (void); |
fa593d66 PA |
308 | void convert_ascii_to_int (const char *from, unsigned char *to, int n); |
309 | void convert_int_to_ascii (const unsigned char *from, char *to, int n); | |
0d62e5e8 DJ |
310 | void new_thread_notify (int id); |
311 | void dead_thread_notify (int id); | |
95954743 | 312 | void prepare_resume_reply (char *buf, ptid_t ptid, |
5b1c542e | 313 | struct target_waitstatus *status); |
c906108c | 314 | |
89be2091 | 315 | const char *decode_address_to_semicolon (CORE_ADDR *addrp, const char *start); |
dae5f5cf | 316 | void decode_address (CORE_ADDR *addrp, const char *start, int len); |
a14ed312 KB |
317 | void decode_m_packet (char *from, CORE_ADDR * mem_addr_ptr, |
318 | unsigned int *len_ptr); | |
319 | void decode_M_packet (char *from, CORE_ADDR * mem_addr_ptr, | |
fa593d66 | 320 | unsigned int *len_ptr, unsigned char **to_p); |
01f9e8fa | 321 | int decode_X_packet (char *from, int packet_len, CORE_ADDR * mem_addr_ptr, |
fa593d66 | 322 | unsigned int *len_ptr, unsigned char **to_p); |
d08aafef | 323 | int decode_xfer_write (char *buf, int packet_len, |
0e7f50da UW |
324 | CORE_ADDR *offset, unsigned int *len, |
325 | unsigned char *data); | |
08388c79 DE |
326 | int decode_search_memory_packet (const char *buf, int packet_len, |
327 | CORE_ADDR *start_addrp, | |
328 | CORE_ADDR *search_space_lenp, | |
493e2a69 MS |
329 | gdb_byte *pattern, |
330 | unsigned int *pattern_lenp); | |
c906108c | 331 | |
ce3a066d DJ |
332 | int unhexify (char *bin, const char *hex, int count); |
333 | int hexify (char *hex, const char *bin, int count); | |
01f9e8fa DJ |
334 | int remote_escape_output (const gdb_byte *buffer, int len, |
335 | gdb_byte *out_buf, int *out_len, | |
336 | int out_maxlen); | |
219f2f23 | 337 | char *unpack_varlen_hex (char *buff, ULONGEST *result); |
ce3a066d | 338 | |
95954743 | 339 | void clear_symbol_cache (struct sym_cache **symcache_p); |
9836d6ea | 340 | int look_up_one_symbol (const char *name, CORE_ADDR *addrp, int may_ask_gdb); |
ce3a066d | 341 | |
fa593d66 PA |
342 | int relocate_instruction (CORE_ADDR *to, CORE_ADDR oldloc); |
343 | ||
bce7165d | 344 | void monitor_output (const char *msg); |
c74d0ad8 | 345 | |
c906108c | 346 | /* Functions from utils.c */ |
d26e3629 | 347 | #include "common-utils.h" |
c906108c | 348 | |
54363045 | 349 | void perror_with_name (const char *string); |
18c1b81a YQ |
350 | void error (const char *string,...) ATTRIBUTE_NORETURN ATTRIBUTE_PRINTF (1, 2); |
351 | void fatal (const char *string,...) ATTRIBUTE_NORETURN ATTRIBUTE_PRINTF (1, 2); | |
352 | void warning (const char *string,...) ATTRIBUTE_PRINTF (1, 2); | |
aa5ca48f | 353 | char *paddress (CORE_ADDR addr); |
219f2f23 PA |
354 | char *pulongest (ULONGEST u); |
355 | char *plongest (LONGEST l); | |
356 | char *phex_nz (ULONGEST l, int sizeof_l); | |
ec48365d | 357 | char *pfildes (gdb_fildes_t fd); |
0a30fbc4 | 358 | |
d26e3629 | 359 | #include "gdb_assert.h" |
e92d13d5 | 360 | |
5c44784c JM |
361 | /* Maximum number of bytes to read/write at once. The value here |
362 | is chosen to fill up a packet (the headers account for the 32). */ | |
363 | #define MAXBUFBYTES(N) (((N)-32)/2) | |
364 | ||
bb9c3d36 UW |
365 | /* Buffer sizes for transferring memory, registers, etc. Set to a constant |
366 | value to accomodate multiple register formats. This value must be at least | |
367 | as large as the largest register set supported by gdbserver. */ | |
368 | #define PBUFSIZ 16384 | |
0a30fbc4 | 369 | |
219f2f23 PA |
370 | /* Functions from tracepoint.c */ |
371 | ||
405f8e94 SS |
372 | /* Size for a small buffer to report problems from the in-process |
373 | agent back to GDBserver. */ | |
374 | #define IPA_BUFSIZ 100 | |
375 | ||
219f2f23 PA |
376 | void initialize_tracepoint (void); |
377 | ||
8336d594 PA |
378 | extern int tracing; |
379 | extern int disconnected_tracing; | |
380 | ||
fa593d66 PA |
381 | void tracepoint_look_up_symbols (void); |
382 | ||
8336d594 PA |
383 | void stop_tracing (void); |
384 | ||
219f2f23 PA |
385 | int handle_tracepoint_general_set (char *own_buf); |
386 | int handle_tracepoint_query (char *own_buf); | |
387 | ||
388 | int tracepoint_finished_step (struct thread_info *tinfo, CORE_ADDR stop_pc); | |
389 | int tracepoint_was_hit (struct thread_info *tinfo, CORE_ADDR stop_pc); | |
390 | ||
391 | void release_while_stepping_state_list (struct thread_info *tinfo); | |
392 | ||
393 | extern int current_traceframe; | |
394 | ||
395 | int in_readonly_region (CORE_ADDR addr, ULONGEST length); | |
396 | int traceframe_read_mem (int tfnum, CORE_ADDR addr, | |
397 | unsigned char *buf, ULONGEST length, | |
398 | ULONGEST *nbytes); | |
399 | int fetch_traceframe_registers (int tfnum, | |
400 | struct regcache *regcache, | |
401 | int regnum); | |
402 | ||
0fb4aa4b PA |
403 | int traceframe_read_sdata (int tfnum, ULONGEST offset, |
404 | unsigned char *buf, ULONGEST length, | |
405 | ULONGEST *nbytes); | |
406 | ||
b3b9301e PA |
407 | int traceframe_read_info (int tfnum, struct buffer *buffer); |
408 | ||
fa593d66 PA |
409 | /* If a thread is determined to be collecting a fast tracepoint, this |
410 | structure holds the collect status. */ | |
411 | ||
412 | struct fast_tpoint_collect_status | |
413 | { | |
414 | /* The tracepoint that is presently being collected. */ | |
415 | int tpoint_num; | |
416 | CORE_ADDR tpoint_addr; | |
417 | ||
418 | /* The address range in the jump pad of where the original | |
419 | instruction the tracepoint jump was inserted was relocated | |
420 | to. */ | |
421 | CORE_ADDR adjusted_insn_addr; | |
422 | CORE_ADDR adjusted_insn_addr_end; | |
423 | }; | |
424 | ||
425 | int fast_tracepoint_collecting (CORE_ADDR thread_area, | |
426 | CORE_ADDR stop_pc, | |
427 | struct fast_tpoint_collect_status *status); | |
428 | void force_unlock_trace_buffer (void); | |
429 | ||
430 | int handle_tracepoint_bkpts (struct thread_info *tinfo, CORE_ADDR stop_pc); | |
431 | ||
432 | #ifdef IN_PROCESS_AGENT | |
433 | void initialize_low_tracepoint (void); | |
434 | void supply_fast_tracepoint_registers (struct regcache *regcache, | |
435 | const unsigned char *regs); | |
0fb4aa4b PA |
436 | void supply_static_tracepoint_registers (struct regcache *regcache, |
437 | const unsigned char *regs, | |
438 | CORE_ADDR pc); | |
405f8e94 SS |
439 | void set_trampoline_buffer_space (CORE_ADDR begin, CORE_ADDR end, |
440 | char *errmsg); | |
3aee8918 PA |
441 | |
442 | extern const struct target_desc *ipa_tdesc; | |
443 | ||
fa593d66 PA |
444 | #else |
445 | void stop_tracing (void); | |
405f8e94 SS |
446 | |
447 | int claim_trampoline_space (ULONGEST used, CORE_ADDR *trampoline); | |
448 | int have_fast_tracepoint_trampoline_buffer (char *msgbuf); | |
7255706c | 449 | void gdb_agent_about_to_close (int pid); |
fa593d66 PA |
450 | #endif |
451 | ||
5e1dc496 | 452 | struct traceframe; |
5ae4861a | 453 | struct eval_agent_expr_context; |
5e1dc496 LM |
454 | |
455 | /* Do memory copies for bytecodes. */ | |
456 | /* Do the recording of memory blocks for actions and bytecodes. */ | |
457 | ||
5ae4861a | 458 | int agent_mem_read (struct eval_agent_expr_context *ctx, |
5e1dc496 LM |
459 | unsigned char *to, CORE_ADDR from, |
460 | ULONGEST len); | |
461 | ||
462 | LONGEST agent_get_trace_state_variable_value (int num); | |
463 | void agent_set_trace_state_variable_value (int num, LONGEST val); | |
464 | ||
465 | /* Record the value of a trace state variable. */ | |
466 | ||
5ae4861a YQ |
467 | int agent_tsv_read (struct eval_agent_expr_context *ctx, int n); |
468 | int agent_mem_read_string (struct eval_agent_expr_context *ctx, | |
5e1dc496 LM |
469 | unsigned char *to, |
470 | CORE_ADDR from, | |
471 | ULONGEST len); | |
472 | ||
6a271cae PA |
473 | /* Bytecode compilation function vector. */ |
474 | ||
475 | struct emit_ops | |
476 | { | |
477 | void (*emit_prologue) (void); | |
478 | void (*emit_epilogue) (void); | |
479 | void (*emit_add) (void); | |
480 | void (*emit_sub) (void); | |
481 | void (*emit_mul) (void); | |
482 | void (*emit_lsh) (void); | |
483 | void (*emit_rsh_signed) (void); | |
484 | void (*emit_rsh_unsigned) (void); | |
485 | void (*emit_ext) (int arg); | |
486 | void (*emit_log_not) (void); | |
487 | void (*emit_bit_and) (void); | |
488 | void (*emit_bit_or) (void); | |
489 | void (*emit_bit_xor) (void); | |
490 | void (*emit_bit_not) (void); | |
491 | void (*emit_equal) (void); | |
492 | void (*emit_less_signed) (void); | |
493 | void (*emit_less_unsigned) (void); | |
494 | void (*emit_ref) (int size); | |
495 | void (*emit_if_goto) (int *offset_p, int *size_p); | |
496 | void (*emit_goto) (int *offset_p, int *size_p); | |
497 | void (*write_goto_address) (CORE_ADDR from, CORE_ADDR to, int size); | |
4e29fb54 | 498 | void (*emit_const) (LONGEST num); |
6a271cae PA |
499 | void (*emit_call) (CORE_ADDR fn); |
500 | void (*emit_reg) (int reg); | |
501 | void (*emit_pop) (void); | |
502 | void (*emit_stack_flush) (void); | |
503 | void (*emit_zero_ext) (int arg); | |
504 | void (*emit_swap) (void); | |
505 | void (*emit_stack_adjust) (int n); | |
506 | ||
507 | /* Emit code for a generic function that takes one fixed integer | |
508 | argument and returns a 64-bit int (for instance, tsv getter). */ | |
509 | void (*emit_int_call_1) (CORE_ADDR fn, int arg1); | |
510 | ||
511 | /* Emit code for a generic function that takes one fixed integer | |
512 | argument and a 64-bit int from the top of the stack, and returns | |
513 | nothing (for instance, tsv setter). */ | |
514 | void (*emit_void_call_2) (CORE_ADDR fn, int arg1); | |
6b9801d4 SS |
515 | |
516 | /* Emit code specialized for common combinations of compare followed | |
517 | by a goto. */ | |
518 | void (*emit_eq_goto) (int *offset_p, int *size_p); | |
519 | void (*emit_ne_goto) (int *offset_p, int *size_p); | |
520 | void (*emit_lt_goto) (int *offset_p, int *size_p); | |
521 | void (*emit_le_goto) (int *offset_p, int *size_p); | |
522 | void (*emit_gt_goto) (int *offset_p, int *size_p); | |
523 | void (*emit_ge_goto) (int *offset_p, int *size_p); | |
6a271cae PA |
524 | }; |
525 | ||
526 | /* Returns the address of the get_raw_reg function in the IPA. */ | |
527 | CORE_ADDR get_raw_reg_func_addr (void); | |
5e1dc496 LM |
528 | /* Returns the address of the get_trace_state_variable_value |
529 | function in the IPA. */ | |
530 | CORE_ADDR get_get_tsv_func_addr (void); | |
531 | /* Returns the address of the set_trace_state_variable_value | |
532 | function in the IPA. */ | |
533 | CORE_ADDR get_set_tsv_func_addr (void); | |
6a271cae | 534 | |
e90e9ad9 TT |
535 | extern CORE_ADDR current_insn_ptr; |
536 | extern int emit_error; | |
6a271cae | 537 | |
0a30fbc4 | 538 | #endif /* SERVER_H */ |