* linux-low.c (regsets_fetch_inferior_registers): Fix memory leak.
[gdb/SamB.git] / gdb / darwin-nat.h
blob43a15223251310fbbbc0a421a1af815268c3f5bd
1 /* Common things used by the various darwin files
2 Copyright (C) 1995, 1996, 1997, 1999, 2000, 2007, 2008, 2009
3 Free Software Foundation, Inc.
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 3 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
19 #ifndef __DARWIN_NAT_H__
20 #define __DARWIN_NAT_H__
22 #include <mach/mach.h>
23 #include "gdb_assert.h"
25 /* Define the threads vector type. */
26 DEF_VEC_I (thread_t);
28 /* Describe the mach exception handling state for a task. This state is saved
29 before being changed and restored when a process is detached.
30 For more information on these fields see task_get_exception_ports manual
31 page. */
32 struct darwin_exception_info
34 /* Exceptions handled by the port. */
35 exception_mask_t masks[EXC_TYPES_COUNT];
37 /* Ports receiving exception messages. */
38 mach_port_t ports[EXC_TYPES_COUNT];
40 /* Type of messages sent. */
41 exception_behavior_t behaviors[EXC_TYPES_COUNT];
43 /* Type of state to be sent. */
44 thread_state_flavor_t flavors[EXC_TYPES_COUNT];
46 /* Number of elements set. */
47 mach_msg_type_number_t count;
49 typedef struct darwin_exception_info darwin_exception_info;
51 /* Describe an inferior. */
52 struct darwin_inferior
54 /* Inferior PID. */
55 int pid;
57 /* Corresponding task port. */
58 task_t task;
60 /* Previous port for request notification on task. */
61 mach_port_t prev_not_port;
63 /* Initial exception handling. */
64 darwin_exception_info exception_info;
66 /* Sorted vector of known threads. */
67 VEC(thread_t) *threads;
69 typedef struct darwin_inferior darwin_inferior;
71 /* Current inferior. */
72 extern darwin_inferior *darwin_inf;
74 /* Exception port. */
75 extern mach_port_t darwin_ex_port;
77 /* Notification port. */
78 extern mach_port_t darwin_not_port;
80 /* Port set. */
81 extern mach_port_t darwin_port_set;
83 /* A copy of mach_host_self (). */
84 extern mach_port_t darwin_host_self;
86 /* ASSERT_FUNCTION is defined in gdb_assert.h (or not). */
87 #ifdef ASSERT_FUNCTION
88 #define MACH_CHECK_ERROR(ret) \
89 mach_check_error (ret, __FILE__, __LINE__, ASSERT_FUNCTION)
90 #else
91 #define MACH_CHECK_ERROR(ret) \
92 mach_check_error (ret, __FILE__, __LINE__, "??")
93 #endif
95 extern void mach_check_error (kern_return_t ret, const char *file,
96 unsigned int line, const char *func);
98 void darwin_set_sstep (thread_t thread, int enable);
100 /* This one is called in darwin-nat.c, but needs to be provided by the
101 platform specific nat code. It allows each platform to add platform specific
102 stuff to the darwin_ops. */
103 extern void darwin_complete_target (struct target_ops *target);
105 void darwin_check_osabi (darwin_inferior *inf, thread_t thread);
107 #endif /* __DARWIN_NAT_H__ */