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