1 /* Inferior process information for the remote server for GDB.
2 Copyright (C) 1993-2014 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/>. */
22 /* Generic information for tracking a list of ``inferiors'' - threads,
26 struct inferior_list_entry
*head
;
27 struct inferior_list_entry
*tail
;
29 struct inferior_list_entry
32 struct inferior_list_entry
*next
;
39 struct raw_breakpoint
;
40 struct fast_tracepoint_jump
;
41 struct process_info_private
;
45 /* This must appear first.
46 The list iterator functions assume it. */
47 struct inferior_list_entry entry
;
49 /* Nonzero if this child process was attached rather than
53 /* True if GDB asked us to detach from this process, but we remained
57 /* The symbol cache. */
58 struct sym_cache
*symbol_cache
;
60 /* The list of memory breakpoints. */
61 struct breakpoint
*breakpoints
;
63 /* The list of raw memory breakpoints. */
64 struct raw_breakpoint
*raw_breakpoints
;
66 /* The list of installed fast tracepoints. */
67 struct fast_tracepoint_jump
*fast_tracepoint_jumps
;
69 const struct target_desc
*tdesc
;
71 /* Private target data. */
72 struct process_info_private
*private;
75 #define ptid_of(inf) ((inf)->entry.id)
76 #define pid_of(inf) ptid_get_pid ((inf)->entry.id)
77 #define lwpid_of(inf) ptid_get_lwp ((inf)->entry.id)
79 /* Return a pointer to the process that corresponds to the current
80 thread (current_inferior). It is an error to call this if there is
81 no current thread selected. */
83 struct process_info
*current_process (void);
84 struct process_info
*get_thread_process (struct thread_info
*);
86 extern struct inferior_list all_processes
;
88 void add_inferior_to_list (struct inferior_list
*list
,
89 struct inferior_list_entry
*new_inferior
);
90 void for_each_inferior (struct inferior_list
*list
,
91 void (*action
) (struct inferior_list_entry
*));
93 void for_each_inferior_with_data
94 (struct inferior_list
*list
,
95 void (*action
) (struct inferior_list_entry
*, void *),
98 void clear_inferior_list (struct inferior_list
*list
);
100 int one_inferior_p (struct inferior_list
*list
);
102 extern struct thread_info
*current_inferior
;
103 void remove_inferior (struct inferior_list
*list
,
104 struct inferior_list_entry
*entry
);
106 struct inferior_list_entry
*get_first_inferior (struct inferior_list
*list
);
108 struct process_info
*add_process (int pid
, int attached
);
109 void remove_process (struct process_info
*process
);
110 struct process_info
*find_process_pid (int pid
);
111 int have_started_inferiors_p (void);
112 int have_attached_inferiors_p (void);
114 ptid_t
thread_to_gdb_id (struct thread_info
*);
115 ptid_t
gdb_id_to_thread_id (ptid_t
);
117 void clear_inferiors (void);
118 struct inferior_list_entry
*find_inferior
119 (struct inferior_list
*,
120 int (*func
) (struct inferior_list_entry
*,
123 struct inferior_list_entry
*find_inferior_id (struct inferior_list
*list
,
126 void *inferior_target_data (struct thread_info
*);
127 void set_inferior_target_data (struct thread_info
*, void *);
128 void *inferior_regcache_data (struct thread_info
*);
129 void set_inferior_regcache_data (struct thread_info
*, void *);
131 #endif /* INFERIORS_H */