GDB (API)
/home/stan/gdb/src/gdb/nto-tdep.h
Go to the documentation of this file.
00001 /* nto-tdep.h - QNX Neutrino target header.
00002 
00003    Copyright (C) 2003-2013 Free Software Foundation, Inc.
00004 
00005    Contributed by QNX Software Systems Ltd.
00006 
00007    This file is part of GDB.
00008 
00009    This program is free software; you can redistribute it and/or modify
00010    it under the terms of the GNU General Public License as published by
00011    the Free Software Foundation; either version 3 of the License, or
00012    (at your option) any later version.
00013 
00014    This program is distributed in the hope that it will be useful,
00015    but WITHOUT ANY WARRANTY; without even the implied warranty of
00016    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017    GNU General Public License for more details.
00018 
00019    You should have received a copy of the GNU General Public License
00020    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
00021 
00022 #ifndef _NTO_TDEP_H
00023 #define _NTO_TDEP_H
00024 
00025 #include "solist.h"
00026 #include "osabi.h"
00027 #include "regset.h"
00028 #include "gdbthread.h"
00029 
00030 /* Target operations defined for Neutrino targets (<target>-nto-tdep.c).  */
00031 
00032 struct nto_target_ops
00033 {
00034 /* The CPUINFO flags from the remote.  Currently used by
00035    i386 for fxsave but future proofing other hosts.
00036    This is initialized in procfs_attach or nto_start_remote
00037    depending on our host/target.  It would only be invalid
00038    if we were talking to an older pdebug which didn't support
00039    the cpuinfo message.  */
00040   unsigned cpuinfo_flags;
00041 
00042 /* True if successfully retrieved cpuinfo from remote.  */
00043   int cpuinfo_valid;
00044 
00045 /* Given a register, return an id that represents the Neutrino
00046    regset it came from.  If reg == -1 update all regsets.  */
00047   int (*regset_id) (int);
00048 
00049   void (*supply_gregset) (struct regcache *, char *);
00050 
00051   void (*supply_fpregset) (struct regcache *, char *);
00052 
00053   void (*supply_altregset) (struct regcache *, char *);
00054 
00055 /* Given a regset, tell gdb about registers stored in data.  */
00056   void (*supply_regset) (struct regcache *, int, char *);
00057 
00058 /* Given a register and regset, calculate the offset into the regset
00059    and stuff it into the last argument.  If regno is -1, calculate the
00060    size of the entire regset.  Returns length of data, -1 if unknown
00061    regset, 0 if unknown register.  */
00062   int (*register_area) (struct gdbarch *, int, int, unsigned *);
00063 
00064 /* Build the Neutrino register set info into the data buffer.
00065    Return -1 if unknown regset, 0 otherwise.  */
00066   int (*regset_fill) (const struct regcache *, int, char *);
00067 
00068 /* Gives the fetch_link_map_offsets function exposure outside of
00069    solib-svr4.c so that we can override relocate_section_addresses().  */
00070   struct link_map_offsets *(*fetch_link_map_offsets) (void);
00071 
00072 /* Used by nto_elf_osabi_sniffer to determine if we're connected to an
00073    Neutrino target.  */
00074   enum gdb_osabi (*is_nto_target) (bfd *abfd);
00075 };
00076 
00077 extern struct nto_target_ops current_nto_target;
00078 
00079 #define nto_cpuinfo_flags (current_nto_target.cpuinfo_flags)
00080 
00081 #define nto_cpuinfo_valid (current_nto_target.cpuinfo_valid)
00082 
00083 #define nto_regset_id (current_nto_target.regset_id)
00084 
00085 #define nto_supply_gregset (current_nto_target.supply_gregset)
00086 
00087 #define nto_supply_fpregset (current_nto_target.supply_fpregset)
00088 
00089 #define nto_supply_altregset (current_nto_target.supply_altregset)
00090 
00091 #define nto_supply_regset (current_nto_target.supply_regset)
00092 
00093 #define nto_register_area (current_nto_target.register_area)
00094 
00095 #define nto_regset_fill (current_nto_target.regset_fill)
00096 
00097 #define nto_fetch_link_map_offsets \
00098 (current_nto_target.fetch_link_map_offsets)
00099 
00100 #define nto_is_nto_target (current_nto_target.is_nto_target)
00101 
00102 /* Keep this consistant with neutrino syspage.h.  */
00103 enum
00104 {
00105   CPUTYPE_X86,
00106   CPUTYPE_PPC,
00107   CPUTYPE_MIPS,
00108   CPUTYPE_SPARE,
00109   CPUTYPE_ARM,
00110   CPUTYPE_SH,
00111   CPUTYPE_UNKNOWN
00112 };
00113 
00114 enum
00115 {
00116   OSTYPE_QNX4,
00117   OSTYPE_NTO
00118 };
00119 
00120 /* These correspond to the DSMSG_* versions in dsmsgs.h.  */
00121 enum
00122 {
00123   NTO_REG_GENERAL,
00124   NTO_REG_FLOAT,
00125   NTO_REG_SYSTEM,
00126   NTO_REG_ALT,
00127   NTO_REG_END
00128 };
00129 
00130 typedef char qnx_reg64[8];
00131 
00132 typedef struct _debug_regs
00133 {
00134   qnx_reg64 padding[1024];
00135 } nto_regset_t;
00136 
00137 struct private_thread_info
00138 {
00139   short tid;
00140   unsigned char state;
00141   unsigned char flags;
00142   char name[1];
00143 };
00144 
00145 /* Generic functions in nto-tdep.c.  */
00146 
00147 void nto_init_solib_absolute_prefix (void);
00148 
00149 char **nto_parse_redirection (char *start_argv[], const char **in,
00150                               const char **out, const char **err);
00151 
00152 void nto_relocate_section_addresses (struct so_list *,
00153                                      struct target_section *);
00154 
00155 int nto_map_arch_to_cputype (const char *);
00156 
00157 int nto_find_and_open_solib (char *, unsigned, char **);
00158 
00159 enum gdb_osabi nto_elf_osabi_sniffer (bfd *abfd);
00160 
00161 void nto_initialize_signals (void);
00162 
00163 /* Dummy function for initializing nto_target_ops on targets which do
00164    not define a particular regset.  */
00165 void nto_dummy_supply_regset (struct regcache *regcache, char *regs);
00166 
00167 int nto_in_dynsym_resolve_code (CORE_ADDR pc);
00168 
00169 char *nto_extra_thread_info (struct thread_info *);
00170 
00171 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines