]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/darwin-nat.h
gdb:
[thirdparty/binutils-gdb.git] / gdb / darwin-nat.h
1 /* Common things used by the various darwin files
2 Copyright (C) 1995, 1996, 1997, 1999, 2000, 2007, 2008
3 Free Software Foundation, Inc.
4
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.
9
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.
14
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/>.
17 */
18
19 #ifndef __DARWIN_NAT_H__
20 #define __DARWIN_NAT_H__
21
22 #include <mach/mach.h>
23 #include "gdb_assert.h"
24
25 /* Define the threads vector type. */
26 DEF_VEC_I (thread_t);
27
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
33 {
34 /* Exceptions handled by the port. */
35 exception_mask_t masks[EXC_TYPES_COUNT];
36
37 /* Ports receiving exception messages. */
38 mach_port_t ports[EXC_TYPES_COUNT];
39
40 /* Type of messages sent. */
41 exception_behavior_t behaviors[EXC_TYPES_COUNT];
42
43 /* Type of state to be sent. */
44 thread_state_flavor_t flavors[EXC_TYPES_COUNT];
45
46 /* Number of elements set. */
47 mach_msg_type_number_t count;
48 };
49 typedef struct darwin_exception_info darwin_exception_info;
50
51 /* Describe an inferior. */
52 struct darwin_inferior
53 {
54 /* Inferior PID. */
55 int pid;
56
57 /* Corresponding task port. */
58 task_t task;
59
60 /* Previous port for request notification on task. */
61 mach_port_t prev_not_port;
62
63 /* Initial exception handling. */
64 darwin_exception_info exception_info;
65
66 /* Sorted vector of known threads. */
67 VEC(thread_t) *threads;
68 };
69 typedef struct darwin_inferior darwin_inferior;
70
71 /* Current inferior. */
72 extern darwin_inferior *darwin_inf;
73
74 /* Exception port. */
75 extern mach_port_t darwin_ex_port;
76
77 /* Notification port. */
78 extern mach_port_t darwin_not_port;
79
80 /* Port set. */
81 extern mach_port_t darwin_port_set;
82
83 /* A copy of mach_host_self (). */
84 extern mach_port_t darwin_host_self;
85
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
94
95 extern void mach_check_error (kern_return_t ret, const char *file,
96 unsigned int line, const char *func);
97
98 void darwin_set_sstep (thread_t thread, int enable);
99
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);
104
105 void darwin_check_osabi (darwin_inferior *inf, thread_t thread);
106
107 #endif /* __DARWIN_NAT_H__ */