daily update
[external/binutils.git] / gdb / nto-tdep.h
1 /* nto-tdep.h - QNX Neutrino target header.
2
3    Copyright (C) 2003, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
4
5    Contributed by QNX Software Systems Ltd.
6
7    This file is part of GDB.
8
9    This program is free software; you can redistribute it and/or modify
10    it under the terms of the GNU General Public License as published by
11    the Free Software Foundation; either version 3 of the License, or
12    (at your option) any later version.
13
14    This program is distributed in the hope that it will be useful,
15    but WITHOUT ANY WARRANTY; without even the implied warranty of
16    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17    GNU General Public License for more details.
18
19    You should have received a copy of the GNU General Public License
20    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
21
22 #ifndef _NTO_TDEP_H
23 #define _NTO_TDEP_H
24
25 #include "solist.h"
26 #include "osabi.h"
27 #include "regset.h"
28 #include "gdbthread.h"
29
30 /* Target operations defined for Neutrino targets (<target>-nto-tdep.c).  */
31
32 struct nto_target_ops
33 {
34 /* For 'maintenance debug nto-debug' command.  */
35   int internal_debugging;
36
37 /* The CPUINFO flags from the remote.  Currently used by
38    i386 for fxsave but future proofing other hosts.
39    This is initialized in procfs_attach or nto_start_remote
40    depending on our host/target.  It would only be invalid
41    if we were talking to an older pdebug which didn't support
42    the cpuinfo message.  */
43   unsigned cpuinfo_flags;
44
45 /* True if successfully retrieved cpuinfo from remote.  */
46   int cpuinfo_valid;
47
48 /* Given a register, return an id that represents the Neutrino
49    regset it came from.  If reg == -1 update all regsets.  */
50   int (*regset_id) (int);
51
52   void (*supply_gregset) (struct regcache *, char *);
53
54   void (*supply_fpregset) (struct regcache *, char *);
55
56   void (*supply_altregset) (struct regcache *, char *);
57
58 /* Given a regset, tell gdb about registers stored in data.  */
59   void (*supply_regset) (struct regcache *, int, char *);
60
61 /* Given a register and regset, calculate the offset into the regset
62    and stuff it into the last argument.  If regno is -1, calculate the
63    size of the entire regset.  Returns length of data, -1 if unknown
64    regset, 0 if unknown register.  */
65   int (*register_area) (struct gdbarch *, int, int, unsigned *);
66
67 /* Build the Neutrino register set info into the data buffer.  
68    Return -1 if unknown regset, 0 otherwise.  */
69   int (*regset_fill) (const struct regcache *, int, char *);
70
71 /* Gives the fetch_link_map_offsets function exposure outside of
72    solib-svr4.c so that we can override relocate_section_addresses().  */
73   struct link_map_offsets *(*fetch_link_map_offsets) (void);
74
75 /* Used by nto_elf_osabi_sniffer to determine if we're connected to an
76    Neutrino target.  */
77   enum gdb_osabi (*is_nto_target) (bfd *abfd);
78 };
79
80 extern struct nto_target_ops current_nto_target;
81
82 #define nto_internal_debugging (current_nto_target.internal_debugging)
83
84 #define nto_cpuinfo_flags (current_nto_target.cpuinfo_flags)
85
86 #define nto_cpuinfo_valid (current_nto_target.cpuinfo_valid)
87
88 #define nto_regset_id (current_nto_target.regset_id)
89
90 #define nto_supply_gregset (current_nto_target.supply_gregset)
91
92 #define nto_supply_fpregset (current_nto_target.supply_fpregset)
93
94 #define nto_supply_altregset (current_nto_target.supply_altregset)
95
96 #define nto_supply_regset (current_nto_target.supply_regset)
97
98 #define nto_register_area (current_nto_target.register_area)
99
100 #define nto_regset_fill (current_nto_target.regset_fill)
101
102 #define nto_fetch_link_map_offsets \
103 (current_nto_target.fetch_link_map_offsets)
104
105 #define nto_is_nto_target (current_nto_target.is_nto_target)
106
107 /* Keep this consistant with neutrino syspage.h.  */
108 enum
109 {
110   CPUTYPE_X86,
111   CPUTYPE_PPC,
112   CPUTYPE_MIPS,
113   CPUTYPE_SPARE,
114   CPUTYPE_ARM,
115   CPUTYPE_SH,
116   CPUTYPE_UNKNOWN
117 };
118
119 enum
120 {
121   OSTYPE_QNX4,
122   OSTYPE_NTO
123 };
124
125 /* These correspond to the DSMSG_* versions in dsmsgs.h. */
126 enum
127 {
128   NTO_REG_GENERAL,
129   NTO_REG_FLOAT,
130   NTO_REG_SYSTEM,
131   NTO_REG_ALT,
132   NTO_REG_END
133 };
134
135 typedef char qnx_reg64[8];
136
137 typedef struct _debug_regs
138 {
139   qnx_reg64 padding[1024];
140 } nto_regset_t;
141
142 struct private_thread_info
143 {
144   short tid;
145   unsigned char state;
146   unsigned char flags;
147   char name[1];
148 };
149
150 /* Generic functions in nto-tdep.c.  */
151
152 void nto_init_solib_absolute_prefix (void);
153
154 char **nto_parse_redirection (char *start_argv[], const char **in,
155                               const char **out, const char **err);
156
157 void nto_relocate_section_addresses (struct so_list *,
158                                      struct target_section *);
159
160 int nto_map_arch_to_cputype (const char *);
161
162 int nto_find_and_open_solib (char *, unsigned, char **);
163
164 enum gdb_osabi nto_elf_osabi_sniffer (bfd *abfd);
165
166 void nto_initialize_signals (void);
167
168 /* Dummy function for initializing nto_target_ops on targets which do
169    not define a particular regset.  */
170 void nto_dummy_supply_regset (struct regcache *regcache, char *regs);
171
172 int nto_in_dynsym_resolve_code (CORE_ADDR pc);
173
174 char *nto_extra_thread_info (struct thread_info *);
175
176 #endif