GDBserver
/home/stan/gdb/src/gdb/gdbserver/inferiors.h
Go to the documentation of this file.
00001 /* Inferior process information for the remote server for GDB.
00002    Copyright (C) 1993-2013 Free Software Foundation, Inc.
00003 
00004    This file is part of GDB.
00005 
00006    This program is free software; you can redistribute it and/or modify
00007    it under the terms of the GNU General Public License as published by
00008    the Free Software Foundation; either version 3 of the License, or
00009    (at your option) any later version.
00010 
00011    This program is distributed in the hope that it will be useful,
00012    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014    GNU General Public License for more details.
00015 
00016    You should have received a copy of the GNU General Public License
00017    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
00018 
00019 #ifndef INFERIORS_H
00020 #define INFERIORS_H
00021 
00022 /* Generic information for tracking a list of ``inferiors'' - threads,
00023    processes, etc.  */
00024 struct inferior_list
00025 {
00026   struct inferior_list_entry *head;
00027   struct inferior_list_entry *tail;
00028 };
00029 struct inferior_list_entry
00030 {
00031   ptid_t id;
00032   struct inferior_list_entry *next;
00033 };
00034 
00035 struct thread_info;
00036 struct target_desc;
00037 struct sym_cache;
00038 struct breakpoint;
00039 struct raw_breakpoint;
00040 struct fast_tracepoint_jump;
00041 struct process_info_private;
00042 
00043 struct process_info
00044 {
00045   struct inferior_list_entry head;
00046 
00047   /* Nonzero if this child process was attached rather than
00048      spawned.  */
00049   int attached;
00050 
00051   /* True if GDB asked us to detach from this process, but we remained
00052      attached anyway.  */
00053   int gdb_detached;
00054 
00055   /* The symbol cache.  */
00056   struct sym_cache *symbol_cache;
00057 
00058   /* The list of memory breakpoints.  */
00059   struct breakpoint *breakpoints;
00060 
00061   /* The list of raw memory breakpoints.  */
00062   struct raw_breakpoint *raw_breakpoints;
00063 
00064   /* The list of installed fast tracepoints.  */
00065   struct fast_tracepoint_jump *fast_tracepoint_jumps;
00066 
00067   const struct target_desc *tdesc;
00068 
00069   /* Private target data.  */
00070   struct process_info_private *private;
00071 };
00072 
00073 /* Return a pointer to the process that corresponds to the current
00074    thread (current_inferior).  It is an error to call this if there is
00075    no current thread selected.  */
00076 
00077 struct process_info *current_process (void);
00078 struct process_info *get_thread_process (struct thread_info *);
00079 
00080 extern struct inferior_list all_processes;
00081 
00082 void add_inferior_to_list (struct inferior_list *list,
00083                            struct inferior_list_entry *new_inferior);
00084 void for_each_inferior (struct inferior_list *list,
00085                         void (*action) (struct inferior_list_entry *));
00086 
00087 extern struct thread_info *current_inferior;
00088 void remove_inferior (struct inferior_list *list,
00089                       struct inferior_list_entry *entry);
00090 
00091 struct process_info *add_process (int pid, int attached);
00092 void remove_process (struct process_info *process);
00093 struct process_info *find_process_pid (int pid);
00094 int have_started_inferiors_p (void);
00095 int have_attached_inferiors_p (void);
00096 
00097 ptid_t thread_id_to_gdb_id (ptid_t);
00098 ptid_t thread_to_gdb_id (struct thread_info *);
00099 ptid_t gdb_id_to_thread_id (ptid_t);
00100 
00101 void clear_inferiors (void);
00102 struct inferior_list_entry *find_inferior
00103      (struct inferior_list *,
00104       int (*func) (struct inferior_list_entry *,
00105                    void *),
00106       void *arg);
00107 struct inferior_list_entry *find_inferior_id (struct inferior_list *list,
00108                                               ptid_t id);
00109 void *inferior_target_data (struct thread_info *);
00110 void set_inferior_target_data (struct thread_info *, void *);
00111 void *inferior_regcache_data (struct thread_info *);
00112 void set_inferior_regcache_data (struct thread_info *, void *);
00113 
00114 #endif /* INFERIORS_H */
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines