]>
Commit | Line | Data |
---|---|---|
c906108c SS |
1 | /* Mach 3.0 common definitions and global vars. |
2 | ||
3 | Copyright (C) 1992 Free Software Foundation, Inc. | |
4 | ||
c5aa993b | 5 | This file is part of GDB. |
c906108c | 6 | |
c5aa993b JM |
7 | This program is free software; you can redistribute it and/or modify |
8 | it under the terms of the GNU General Public License as published by | |
9 | the Free Software Foundation; either version 2 of the License, or | |
10 | (at your option) any later version. | |
c906108c | 11 | |
c5aa993b JM |
12 | This program is distributed in the hope that it will be useful, |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | GNU General Public License for more details. | |
c906108c | 16 | |
c5aa993b JM |
17 | You should have received a copy of the GNU General Public License |
18 | along with this program; if not, write to the Free Software | |
19 | Foundation, Inc., 59 Temple Place - Suite 330, | |
20 | Boston, MA 02111-1307, USA. */ | |
c906108c SS |
21 | |
22 | #ifndef NM_M3_H | |
23 | #define NM_M3_H | |
24 | ||
25 | #include <mach.h> | |
26 | ||
27 | /* Mach3 doesn't declare errno in <errno.h>. */ | |
28 | extern int errno; | |
29 | ||
30 | /* Task port of our debugged inferior. */ | |
31 | ||
32 | extern task_t inferior_task; | |
33 | ||
34 | /* Thread port of the current thread in the inferior. */ | |
35 | ||
36 | extern thread_t current_thread; | |
37 | ||
38 | /* If nonzero, we must suspend/abort && resume threads | |
39 | * when setting or getting the state. | |
40 | */ | |
41 | extern int must_suspend_thread; | |
42 | ||
43 | #define PREPARE_TO_PROCEED(select_it) mach3_prepare_to_proceed(select_it) | |
44 | ||
45 | /* Try to get the privileged host port for authentication to machid | |
c5aa993b | 46 | |
c906108c SS |
47 | * If you can get this, you may debug anything on this host. |
48 | * | |
49 | * If you can't, gdb gives it's own task port as the | |
50 | * authentication port | |
51 | */ | |
52 | #define mach_privileged_host_port() task_by_pid(-1) | |
53 | ||
54 | /* | |
55 | * This is the MIG ID number of the emulator/server bsd_execve() RPC call. | |
56 | * | |
57 | * It SHOULD never change, but if it does, gdb `run' | |
58 | * command won't work until you fix this define. | |
59 | * | |
60 | */ | |
61 | #define MIG_EXEC_SYSCALL_ID 101000 | |
62 | ||
63 | /* If our_message_port gets a msg with this ID, | |
64 | * GDB suspends it's inferior and enters command level. | |
65 | * (Useful at least if ^C does not work) | |
66 | */ | |
67 | #define GDB_MESSAGE_ID_STOP 0x41151 | |
68 | ||
69 | /* wait3 WNOHANG is defined in <sys/wait.h> but | |
70 | * for some reason gdb does not want to include | |
71 | * that file. | |
72 | * | |
73 | * If your system defines WNOHANG differently, this has to be changed. | |
74 | */ | |
75 | #define WNOHANG 1 | |
76 | ||
77 | /* Before storing, we need to read all the registers. */ | |
78 | ||
79 | #define CHILD_PREPARE_TO_STORE() read_register_bytes (0, NULL, REGISTER_BYTES) | |
80 | ||
81 | /* Check if the inferior exists */ | |
82 | #define MACH_ERROR_NO_INFERIOR \ | |
83 | do if (!MACH_PORT_VALID (inferior_task)) \ | |
84 | error ("Inferior task does not exist."); while(0) | |
85 | ||
86 | /* Error handler for mach calls */ | |
87 | #define CHK(str,ret) \ | |
88 | do if (ret != KERN_SUCCESS) \ | |
89 | error ("Gdb %s [%d] %s : %s\n",__FILE__,__LINE__,str, \ | |
90 | mach_error_string(ret)); while(0) | |
91 | ||
92 | /* This is from POE9 emulator/emul_stack.h | |
93 | */ | |
94 | /* | |
95 | * Top of emulator stack holds link and reply port. | |
96 | */ | |
c5aa993b JM |
97 | struct emul_stack_top |
98 | { | |
99 | struct emul_stack_top *link; | |
100 | mach_port_t reply_port; | |
101 | }; | |
c906108c SS |
102 | |
103 | #define EMULATOR_STACK_SIZE (4096*4) | |
104 | ||
105 | #define THREAD_ALLOWED_TO_BREAK(mid) mach_thread_for_breakpoint (mid) | |
106 | ||
107 | #define THREAD_PARSE_ID(arg) mach_thread_parse_id (arg) | |
108 | ||
109 | #define THREAD_OUTPUT_ID(mid) mach_thread_output_id (mid) | |
110 | ||
111 | #define ATTACH_TO_THREAD attach_to_thread | |
112 | ||
113 | /* Don't do wait_for_inferior on attach. */ | |
114 | #define ATTACH_NO_WAIT | |
115 | ||
116 | /* Do Mach 3 dependent operations when ^C or a STOP is requested */ | |
117 | #define DO_QUIT() mach3_quit () | |
118 | ||
119 | #if 0 | |
120 | /* This is bogus. It is NOT OK to quit out of target_wait. */ | |
121 | /* If in mach_msg() and ^C is typed set immediate_quit */ | |
122 | #define REQUEST_QUIT() mach3_request_quit () | |
123 | #endif | |
124 | ||
125 | #endif /* NM_M3_H */ |