| OLD | NEW |
| 1 /* Common definitions for remote server for GDB. | 1 /* Common definitions for remote server for GDB. |
| 2 Copyright (C) 1993, 1995, 1997-2000, 2002-2012 Free Software | 2 Copyright (C) 1993, 1995, 1997-2000, 2002-2012 Free Software |
| 3 Foundation, Inc. | 3 Foundation, Inc. |
| 4 | 4 |
| 5 This file is part of GDB. | 5 This file is part of GDB. |
| 6 | 6 |
| 7 This program is free software; you can redistribute it and/or modify | 7 This program is free software; you can redistribute it and/or modify |
| 8 it under the terms of the GNU General Public License as published by | 8 it under the terms of the GNU General Public License as published by |
| 9 the Free Software Foundation; either version 3 of the License, or | 9 the Free Software Foundation; either version 3 of the License, or |
| 10 (at your option) any later version. | 10 (at your option) any later version. |
| 11 | 11 |
| 12 This program is distributed in the hope that it will be useful, | 12 This program is distributed in the hope that it will be useful, |
| 13 but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 GNU General Public License for more details. | 15 GNU General Public License for more details. |
| 16 | 16 |
| 17 You should have received a copy of the GNU General Public License | 17 You should have received a copy of the GNU General Public License |
| 18 along with this program. If not, see <http://www.gnu.org/licenses/>. */ | 18 along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
| 19 | 19 |
| 20 #ifndef SERVER_H | 20 #ifndef SERVER_H |
| 21 #define SERVER_H | 21 #define SERVER_H |
| 22 | 22 |
| 23 #include "config.h" | 23 #include "config.h" |
| 24 #include "build-gnulib-gdbserver/config.h" |
| 24 | 25 |
| 25 #ifdef __MINGW32CE__ | 26 #ifdef __MINGW32CE__ |
| 26 #include "wincecompat.h" | 27 #include "wincecompat.h" |
| 27 #endif | 28 #endif |
| 28 | 29 |
| 29 #include <stdarg.h> | 30 #include <stdarg.h> |
| 30 #include <stdio.h> | 31 #include <stdio.h> |
| 31 #include <stdlib.h> | 32 #include <stdlib.h> |
| 32 #ifdef HAVE_ERRNO_H | 33 #ifdef HAVE_ERRNO_H |
| 33 #include <errno.h> | 34 #include <errno.h> |
| (...skipping 18 matching lines...) Expand all Loading... |
| 52 extern char *strerror (int); /* X3.159-1989 4.11.6.2 */ | 53 extern char *strerror (int); /* X3.159-1989 4.11.6.2 */ |
| 53 #endif | 54 #endif |
| 54 #endif | 55 #endif |
| 55 | 56 |
| 56 #if !HAVE_DECL_PERROR | 57 #if !HAVE_DECL_PERROR |
| 57 #ifndef perror | 58 #ifndef perror |
| 58 extern void perror (const char *); | 59 extern void perror (const char *); |
| 59 #endif | 60 #endif |
| 60 #endif | 61 #endif |
| 61 | 62 |
| 62 #if !HAVE_DECL_MEMMEM | |
| 63 extern void *memmem (const void *, size_t , const void *, size_t); | |
| 64 #endif | |
| 65 | |
| 66 #if !HAVE_DECL_VASPRINTF | 63 #if !HAVE_DECL_VASPRINTF |
| 67 extern int vasprintf(char **strp, const char *fmt, va_list ap); | 64 extern int vasprintf(char **strp, const char *fmt, va_list ap); |
| 68 #endif | 65 #endif |
| 69 #if !HAVE_DECL_VSNPRINTF | 66 #if !HAVE_DECL_VSNPRINTF |
| 70 int vsnprintf(char *str, size_t size, const char *format, va_list ap); | 67 int vsnprintf(char *str, size_t size, const char *format, va_list ap); |
| 71 #endif | 68 #endif |
| 72 | 69 |
| 73 #ifndef ATTR_NORETURN | 70 #ifndef ATTR_NORETURN |
| 74 #if defined(__GNUC__) && (__GNUC__ > 2 \ | 71 #if defined(__GNUC__) && (__GNUC__ > 2 \ |
| 75 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)) | 72 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)) |
| (...skipping 19 matching lines...) Expand all Loading... |
| 95 #define ATTR_MALLOC /* nothing */ | 92 #define ATTR_MALLOC /* nothing */ |
| 96 #endif | 93 #endif |
| 97 #endif | 94 #endif |
| 98 | 95 |
| 99 /* Define underscore macro, if not available, to be able to use it inside | 96 /* Define underscore macro, if not available, to be able to use it inside |
| 100 code shared with gdb in common directory. */ | 97 code shared with gdb in common directory. */ |
| 101 #ifndef _ | 98 #ifndef _ |
| 102 #define _(String) (String) | 99 #define _(String) (String) |
| 103 #endif | 100 #endif |
| 104 | 101 |
| 102 #ifdef IN_PROCESS_AGENT |
| 103 # define PROG "ipa" |
| 104 #else |
| 105 # define PROG "gdbserver" |
| 106 #endif |
| 107 |
| 105 /* A type used for binary buffers. */ | 108 /* A type used for binary buffers. */ |
| 106 typedef unsigned char gdb_byte; | 109 typedef unsigned char gdb_byte; |
| 107 | 110 |
| 108 #include "ptid.h" | 111 #include "ptid.h" |
| 109 #include "buffer.h" | 112 #include "buffer.h" |
| 110 #include "xml-utils.h" | 113 #include "xml-utils.h" |
| 111 #include "gdb_locale.h" | 114 #include "gdb_locale.h" |
| 112 | 115 |
| 113 /* FIXME: This should probably be autoconf'd for. It's an integer type at | 116 /* FIXME: This should probably be autoconf'd for. It's an integer type at |
| 114 least the size of a (void *). */ | 117 least the size of a (void *). */ |
| (...skipping 17 matching lines...) Expand all Loading... |
| 132 | 135 |
| 133 struct thread_info; | 136 struct thread_info; |
| 134 struct process_info; | 137 struct process_info; |
| 135 struct regcache; | 138 struct regcache; |
| 136 | 139 |
| 137 #include "regcache.h" | 140 #include "regcache.h" |
| 138 #include "gdb/signals.h" | 141 #include "gdb/signals.h" |
| 139 #include "gdb_signals.h" | 142 #include "gdb_signals.h" |
| 140 #include "target.h" | 143 #include "target.h" |
| 141 #include "mem-break.h" | 144 #include "mem-break.h" |
| 142 | 145 #include "gdbthread.h" |
| 143 struct thread_info | |
| 144 { | |
| 145 struct inferior_list_entry entry; | |
| 146 void *target_data; | |
| 147 void *regcache_data; | |
| 148 | |
| 149 /* The last resume GDB requested on this thread. */ | |
| 150 enum resume_kind last_resume_kind; | |
| 151 | |
| 152 /* The last wait status reported for this thread. */ | |
| 153 struct target_waitstatus last_status; | |
| 154 | |
| 155 /* Given `while-stepping', a thread may be collecting data for more | |
| 156 than one tracepoint simultaneously. E.g.: | |
| 157 | |
| 158 ff0001 INSN1 <-- TP1, while-stepping 10 collect $regs | |
| 159 ff0002 INSN2 | |
| 160 ff0003 INSN3 <-- TP2, collect $regs | |
| 161 ff0004 INSN4 <-- TP3, while-stepping 10 collect $regs | |
| 162 ff0005 INSN5 | |
| 163 | |
| 164 Notice that when instruction INSN5 is reached, the while-stepping | |
| 165 actions of both TP1 and TP3 are still being collected, and that TP2 | |
| 166 had been collected meanwhile. The whole range of ff0001-ff0005 | |
| 167 should be single-stepped, due to at least TP1's while-stepping | |
| 168 action covering the whole range. | |
| 169 | |
| 170 On the other hand, the same tracepoint with a while-stepping action | |
| 171 may be hit by more than one thread simultaneously, hence we can't | |
| 172 keep the current step count in the tracepoint itself. | |
| 173 | |
| 174 This is the head of the list of the states of `while-stepping' | |
| 175 tracepoint actions this thread is now collecting; NULL if empty. | |
| 176 Each item in the list holds the current step of the while-stepping | |
| 177 action. */ | |
| 178 struct wstep_state *while_stepping; | |
| 179 }; | |
| 180 | 146 |
| 181 struct dll_info | 147 struct dll_info |
| 182 { | 148 { |
| 183 struct inferior_list_entry entry; | 149 struct inferior_list_entry entry; |
| 184 char *name; | 150 char *name; |
| 185 CORE_ADDR base_addr; | 151 CORE_ADDR base_addr; |
| 186 }; | 152 }; |
| 187 | 153 |
| 188 struct sym_cache; | 154 struct sym_cache; |
| 189 struct breakpoint; | 155 struct breakpoint; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 struct process_info *current_process (void); | 192 struct process_info *current_process (void); |
| 227 struct process_info *get_thread_process (struct thread_info *); | 193 struct process_info *get_thread_process (struct thread_info *); |
| 228 | 194 |
| 229 /* Target-specific functions */ | 195 /* Target-specific functions */ |
| 230 | 196 |
| 231 void initialize_low (); | 197 void initialize_low (); |
| 232 | 198 |
| 233 /* From inferiors.c. */ | 199 /* From inferiors.c. */ |
| 234 | 200 |
| 235 extern struct inferior_list all_processes; | 201 extern struct inferior_list all_processes; |
| 236 extern struct inferior_list all_threads; | |
| 237 extern struct inferior_list all_dlls; | 202 extern struct inferior_list all_dlls; |
| 238 extern int dlls_changed; | 203 extern int dlls_changed; |
| 204 extern void clear_dlls (void); |
| 239 | 205 |
| 240 void add_inferior_to_list (struct inferior_list *list, | 206 void add_inferior_to_list (struct inferior_list *list, |
| 241 struct inferior_list_entry *new_inferior); | 207 struct inferior_list_entry *new_inferior); |
| 242 void for_each_inferior (struct inferior_list *list, | 208 void for_each_inferior (struct inferior_list *list, |
| 243 void (*action) (struct inferior_list_entry *)); | 209 void (*action) (struct inferior_list_entry *)); |
| 244 | 210 |
| 245 extern struct thread_info *current_inferior; | 211 extern struct thread_info *current_inferior; |
| 246 void remove_inferior (struct inferior_list *list, | 212 void remove_inferior (struct inferior_list *list, |
| 247 struct inferior_list_entry *entry); | 213 struct inferior_list_entry *entry); |
| 248 void remove_thread (struct thread_info *thread); | |
| 249 void add_thread (ptid_t ptid, void *target_data); | |
| 250 | 214 |
| 251 struct process_info *add_process (int pid, int attached); | 215 struct process_info *add_process (int pid, int attached); |
| 252 void remove_process (struct process_info *process); | 216 void remove_process (struct process_info *process); |
| 253 struct process_info *find_process_pid (int pid); | 217 struct process_info *find_process_pid (int pid); |
| 254 int have_started_inferiors_p (void); | 218 int have_started_inferiors_p (void); |
| 255 int have_attached_inferiors_p (void); | 219 int have_attached_inferiors_p (void); |
| 256 | 220 |
| 257 struct thread_info *find_thread_ptid (ptid_t ptid); | |
| 258 | |
| 259 ptid_t thread_id_to_gdb_id (ptid_t); | 221 ptid_t thread_id_to_gdb_id (ptid_t); |
| 260 ptid_t thread_to_gdb_id (struct thread_info *); | 222 ptid_t thread_to_gdb_id (struct thread_info *); |
| 261 ptid_t gdb_id_to_thread_id (ptid_t); | 223 ptid_t gdb_id_to_thread_id (ptid_t); |
| 262 struct thread_info *gdb_id_to_thread (unsigned int); | 224 |
| 263 void clear_inferiors (void); | 225 void clear_inferiors (void); |
| 264 struct inferior_list_entry *find_inferior | 226 struct inferior_list_entry *find_inferior |
| 265 (struct inferior_list *, | 227 (struct inferior_list *, |
| 266 int (*func) (struct inferior_list_entry *, | 228 int (*func) (struct inferior_list_entry *, |
| 267 void *), | 229 void *), |
| 268 void *arg); | 230 void *arg); |
| 269 struct inferior_list_entry *find_inferior_id (struct inferior_list *list, | 231 struct inferior_list_entry *find_inferior_id (struct inferior_list *list, |
| 270 ptid_t id); | 232 ptid_t id); |
| 271 void *inferior_target_data (struct thread_info *); | 233 void *inferior_target_data (struct thread_info *); |
| 272 void set_inferior_target_data (struct thread_info *, void *); | 234 void set_inferior_target_data (struct thread_info *, void *); |
| 273 void *inferior_regcache_data (struct thread_info *); | 235 void *inferior_regcache_data (struct thread_info *); |
| 274 void set_inferior_regcache_data (struct thread_info *, void *); | 236 void set_inferior_regcache_data (struct thread_info *, void *); |
| 275 void add_pid_to_list (struct inferior_list *list, unsigned long pid); | |
| 276 int pull_pid_from_list (struct inferior_list *list, unsigned long pid); | |
| 277 | 237 |
| 278 void loaded_dll (const char *name, CORE_ADDR base_addr); | 238 void loaded_dll (const char *name, CORE_ADDR base_addr); |
| 279 void unloaded_dll (const char *name, CORE_ADDR base_addr); | 239 void unloaded_dll (const char *name, CORE_ADDR base_addr); |
| 280 | 240 |
| 281 /* Public variables in server.c */ | 241 /* Public variables in server.c */ |
| 282 | 242 |
| 283 extern ptid_t cont_thread; | 243 extern ptid_t cont_thread; |
| 284 extern ptid_t general_thread; | 244 extern ptid_t general_thread; |
| 285 | 245 |
| 286 extern int server_waiting; | 246 extern int server_waiting; |
| 287 extern int debug_threads; | 247 extern int debug_threads; |
| 288 extern int debug_hw_points; | 248 extern int debug_hw_points; |
| 289 extern int pass_signals[]; | 249 extern int pass_signals[]; |
| 250 extern int program_signals[]; |
| 251 extern int program_signals_p; |
| 290 | 252 |
| 291 extern jmp_buf toplevel; | 253 extern jmp_buf toplevel; |
| 292 | 254 |
| 293 extern int disable_packet_vCont; | 255 extern int disable_packet_vCont; |
| 294 extern int disable_packet_Tthread; | 256 extern int disable_packet_Tthread; |
| 295 extern int disable_packet_qC; | 257 extern int disable_packet_qC; |
| 296 extern int disable_packet_qfThreadInfo; | 258 extern int disable_packet_qfThreadInfo; |
| 297 | 259 |
| 298 extern int run_once; | 260 extern int run_once; |
| 299 extern int multi_process; | 261 extern int multi_process; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 extern void hostio_last_error_from_errno (char *own_buf); | 297 extern void hostio_last_error_from_errno (char *own_buf); |
| 336 | 298 |
| 337 /* From remote-utils.c */ | 299 /* From remote-utils.c */ |
| 338 | 300 |
| 339 extern int remote_debug; | 301 extern int remote_debug; |
| 340 extern int noack_mode; | 302 extern int noack_mode; |
| 341 extern int transport_is_reliable; | 303 extern int transport_is_reliable; |
| 342 | 304 |
| 343 int gdb_connected (void); | 305 int gdb_connected (void); |
| 344 | 306 |
| 307 #define STDIO_CONNECTION_NAME "stdio" |
| 308 int remote_connection_is_stdio (void); |
| 309 |
| 345 ptid_t read_ptid (char *buf, char **obuf); | 310 ptid_t read_ptid (char *buf, char **obuf); |
| 346 char *write_ptid (char *buf, ptid_t ptid); | 311 char *write_ptid (char *buf, ptid_t ptid); |
| 347 | 312 |
| 348 int putpkt (char *buf); | 313 int putpkt (char *buf); |
| 349 int putpkt_binary (char *buf, int len); | 314 int putpkt_binary (char *buf, int len); |
| 350 int putpkt_notif (char *buf); | 315 int putpkt_notif (char *buf); |
| 351 int getpkt (char *buf); | 316 int getpkt (char *buf); |
| 352 void remote_prepare (char *name); | 317 void remote_prepare (char *name); |
| 353 void remote_open (char *name); | 318 void remote_open (char *name); |
| 354 void remote_close (void); | 319 void remote_close (void); |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 426 value to accomodate multiple register formats. This value must be at least | 391 value to accomodate multiple register formats. This value must be at least |
| 427 as large as the largest register set supported by gdbserver. */ | 392 as large as the largest register set supported by gdbserver. */ |
| 428 #define PBUFSIZ 16384 | 393 #define PBUFSIZ 16384 |
| 429 | 394 |
| 430 /* Functions from tracepoint.c */ | 395 /* Functions from tracepoint.c */ |
| 431 | 396 |
| 432 /* Size for a small buffer to report problems from the in-process | 397 /* Size for a small buffer to report problems from the in-process |
| 433 agent back to GDBserver. */ | 398 agent back to GDBserver. */ |
| 434 #define IPA_BUFSIZ 100 | 399 #define IPA_BUFSIZ 100 |
| 435 | 400 |
| 436 int in_process_agent_loaded (void); | |
| 437 | |
| 438 void initialize_tracepoint (void); | 401 void initialize_tracepoint (void); |
| 439 | 402 |
| 440 extern int tracing; | 403 extern int tracing; |
| 441 extern int disconnected_tracing; | 404 extern int disconnected_tracing; |
| 442 | 405 |
| 443 void tracepoint_look_up_symbols (void); | 406 void tracepoint_look_up_symbols (void); |
| 444 | 407 |
| 445 void stop_tracing (void); | 408 void stop_tracing (void); |
| 446 | 409 |
| 447 int handle_tracepoint_general_set (char *own_buf); | 410 int handle_tracepoint_general_set (char *own_buf); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 500 CORE_ADDR pc); | 463 CORE_ADDR pc); |
| 501 void set_trampoline_buffer_space (CORE_ADDR begin, CORE_ADDR end, | 464 void set_trampoline_buffer_space (CORE_ADDR begin, CORE_ADDR end, |
| 502 char *errmsg); | 465 char *errmsg); |
| 503 #else | 466 #else |
| 504 void stop_tracing (void); | 467 void stop_tracing (void); |
| 505 | 468 |
| 506 int claim_trampoline_space (ULONGEST used, CORE_ADDR *trampoline); | 469 int claim_trampoline_space (ULONGEST used, CORE_ADDR *trampoline); |
| 507 int have_fast_tracepoint_trampoline_buffer (char *msgbuf); | 470 int have_fast_tracepoint_trampoline_buffer (char *msgbuf); |
| 508 #endif | 471 #endif |
| 509 | 472 |
| 473 struct traceframe; |
| 474 |
| 475 /* Do memory copies for bytecodes. */ |
| 476 /* Do the recording of memory blocks for actions and bytecodes. */ |
| 477 |
| 478 int agent_mem_read (struct traceframe *tframe, |
| 479 unsigned char *to, CORE_ADDR from, |
| 480 ULONGEST len); |
| 481 |
| 482 LONGEST agent_get_trace_state_variable_value (int num); |
| 483 void agent_set_trace_state_variable_value (int num, LONGEST val); |
| 484 |
| 485 /* Record the value of a trace state variable. */ |
| 486 |
| 487 int agent_tsv_read (struct traceframe *tframe, int n); |
| 488 int agent_mem_read_string (struct traceframe *tframe, |
| 489 unsigned char *to, |
| 490 CORE_ADDR from, |
| 491 ULONGEST len); |
| 492 |
| 510 /* Bytecode compilation function vector. */ | 493 /* Bytecode compilation function vector. */ |
| 511 | 494 |
| 512 struct emit_ops | 495 struct emit_ops |
| 513 { | 496 { |
| 514 void (*emit_prologue) (void); | 497 void (*emit_prologue) (void); |
| 515 void (*emit_epilogue) (void); | 498 void (*emit_epilogue) (void); |
| 516 void (*emit_add) (void); | 499 void (*emit_add) (void); |
| 517 void (*emit_sub) (void); | 500 void (*emit_sub) (void); |
| 518 void (*emit_mul) (void); | 501 void (*emit_mul) (void); |
| 519 void (*emit_lsh) (void); | 502 void (*emit_lsh) (void); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 555 void (*emit_eq_goto) (int *offset_p, int *size_p); | 538 void (*emit_eq_goto) (int *offset_p, int *size_p); |
| 556 void (*emit_ne_goto) (int *offset_p, int *size_p); | 539 void (*emit_ne_goto) (int *offset_p, int *size_p); |
| 557 void (*emit_lt_goto) (int *offset_p, int *size_p); | 540 void (*emit_lt_goto) (int *offset_p, int *size_p); |
| 558 void (*emit_le_goto) (int *offset_p, int *size_p); | 541 void (*emit_le_goto) (int *offset_p, int *size_p); |
| 559 void (*emit_gt_goto) (int *offset_p, int *size_p); | 542 void (*emit_gt_goto) (int *offset_p, int *size_p); |
| 560 void (*emit_ge_goto) (int *offset_p, int *size_p); | 543 void (*emit_ge_goto) (int *offset_p, int *size_p); |
| 561 }; | 544 }; |
| 562 | 545 |
| 563 /* Returns the address of the get_raw_reg function in the IPA. */ | 546 /* Returns the address of the get_raw_reg function in the IPA. */ |
| 564 CORE_ADDR get_raw_reg_func_addr (void); | 547 CORE_ADDR get_raw_reg_func_addr (void); |
| 548 /* Returns the address of the get_trace_state_variable_value |
| 549 function in the IPA. */ |
| 550 CORE_ADDR get_get_tsv_func_addr (void); |
| 551 /* Returns the address of the set_trace_state_variable_value |
| 552 function in the IPA. */ |
| 553 CORE_ADDR get_set_tsv_func_addr (void); |
| 565 | 554 |
| 566 CORE_ADDR current_insn_ptr; | 555 CORE_ADDR current_insn_ptr; |
| 567 int emit_error; | 556 int emit_error; |
| 568 | 557 |
| 569 /* Version information, from version.c. */ | 558 /* Version information, from version.c. */ |
| 570 extern const char version[]; | 559 extern const char version[]; |
| 571 extern const char host_name[]; | 560 extern const char host_name[]; |
| 572 | 561 |
| 573 #endif /* SERVER_H */ | 562 #endif /* SERVER_H */ |
| OLD | NEW |