]>
Commit | Line | Data |
---|---|---|
bd5635a1 | 1 | /* Interface between GDB and target environments, including files and processes |
75af490b | 2 | Copyright 1990, 1991, 1992 Free Software Foundation, Inc. |
bd5635a1 RP |
3 | Contributed by Cygnus Support. Written by John Gilmore. |
4 | ||
5 | This file is part of GDB. | |
6 | ||
75af490b | 7 | This program is free software; you can redistribute it and/or modify |
bd5635a1 | 8 | it under the terms of the GNU General Public License as published by |
75af490b JG |
9 | the Free Software Foundation; either version 2 of the License, or |
10 | (at your option) any later version. | |
bd5635a1 | 11 | |
75af490b | 12 | This program is distributed in the hope that it will be useful, |
bd5635a1 RP |
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. | |
16 | ||
17 | You should have received a copy of the GNU General Public License | |
75af490b JG |
18 | along with this program; if not, write to the Free Software |
19 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ | |
20 | ||
21 | #if !defined (TARGET_H) | |
22 | #define TARGET_H | |
bd5635a1 RP |
23 | |
24 | /* This include file defines the interface between the main part | |
25 | of the debugger, and the part which is target-specific, or | |
26 | specific to the communications interface between us and the | |
27 | target. | |
28 | ||
29 | A TARGET is an interface between the debugger and a particular | |
30 | kind of file or process. Targets can be STACKED in STRATA, | |
31 | so that more than one target can potentially respond to a request. | |
32 | In particular, memory accesses will walk down the stack of targets | |
33 | until they find a target that is interested in handling that particular | |
34 | address. STRATA are artificial boundaries on the stack, within | |
35 | which particular kinds of targets live. Strata exist so that | |
36 | people don't get confused by pushing e.g. a process target and then | |
37 | a file target, and wondering why they can't see the current values | |
38 | of variables any more (the file target is handling them and they | |
39 | never get to the process target). So when you push a file target, | |
40 | it goes into the file stratum, which is always below the process | |
41 | stratum. */ | |
42 | ||
75af490b JG |
43 | #include "bfd.h" |
44 | ||
bd5635a1 RP |
45 | enum strata { |
46 | dummy_stratum, /* The lowest of the low */ | |
47 | file_stratum, /* Executable files, etc */ | |
48 | core_stratum, /* Core dump files */ | |
75af490b | 49 | process_stratum /* Executing processes */ |
bd5635a1 RP |
50 | }; |
51 | ||
67ac9759 JK |
52 | /* Stuff for target_wait. */ |
53 | ||
54 | /* Generally, what has the program done? */ | |
55 | enum target_waitkind { | |
56 | /* The program has exited. The exit status is in value.integer. */ | |
57 | TARGET_WAITKIND_EXITED, | |
58 | ||
59 | /* The program has stopped with a signal. Which signal is in value.sig. */ | |
60 | TARGET_WAITKIND_STOPPED, | |
61 | ||
62 | /* The program has terminated with a signal. Which signal is in | |
63 | value.sig. */ | |
64 | TARGET_WAITKIND_SIGNALLED | |
65 | }; | |
66 | ||
67 | /* The numbering of these signals is chosen to match traditional unix | |
68 | signals (insofar as various unices use the same numbers, anyway). | |
69 | It is also the numbering of the GDB remote protocol. Other remote | |
70 | protocols, if they use a different numbering, should make sure to | |
71 | translate appropriately. */ | |
72 | ||
73 | /* This is based strongly on Unix/POSIX signals for several reasons: | |
74 | (1) This set of signals represents a widely-accepted attempt to | |
75 | represent events of this sort in a portable fashion, (2) we want a | |
76 | signal to make it from wait to child_wait to the user intact, (3) many | |
77 | remote protocols use a similar encoding. However, it is | |
78 | recognized that this set of signals has limitations (such as not | |
79 | distinguishing between various kinds of SIGSEGV, or not | |
80 | distinguishing hitting a breakpoint from finishing a single step). | |
81 | So in the future we may get around this either by adding additional | |
82 | signals for breakpoint, single-step, etc., or by adding signal | |
83 | codes; the latter seems more in the spirit of what BSD, System V, | |
84 | etc. are doing to address these issues. */ | |
85 | ||
86 | /* For an explanation of what each signal means, see | |
87 | target_signal_to_string. */ | |
88 | ||
89 | enum target_signal { | |
90 | /* Used some places (e.g. stop_signal) to record the concept that | |
91 | there is no signal. */ | |
92 | TARGET_SIGNAL_0 = 0, | |
93 | TARGET_SIGNAL_HUP = 1, | |
94 | TARGET_SIGNAL_INT = 2, | |
95 | TARGET_SIGNAL_QUIT = 3, | |
96 | TARGET_SIGNAL_ILL = 4, | |
97 | TARGET_SIGNAL_TRAP = 5, | |
98 | TARGET_SIGNAL_ABRT = 6, | |
99 | TARGET_SIGNAL_EMT = 7, | |
100 | TARGET_SIGNAL_FPE = 8, | |
101 | TARGET_SIGNAL_KILL = 9, | |
102 | TARGET_SIGNAL_BUS = 10, | |
103 | TARGET_SIGNAL_SEGV = 11, | |
104 | TARGET_SIGNAL_SYS = 12, | |
105 | TARGET_SIGNAL_PIPE = 13, | |
106 | TARGET_SIGNAL_ALRM = 14, | |
107 | TARGET_SIGNAL_TERM = 15, | |
108 | TARGET_SIGNAL_URG = 16, | |
109 | TARGET_SIGNAL_STOP = 17, | |
110 | TARGET_SIGNAL_TSTP = 18, | |
111 | TARGET_SIGNAL_CONT = 19, | |
112 | TARGET_SIGNAL_CHLD = 20, | |
113 | TARGET_SIGNAL_TTIN = 21, | |
114 | TARGET_SIGNAL_TTOU = 22, | |
115 | TARGET_SIGNAL_IO = 23, | |
116 | TARGET_SIGNAL_XCPU = 24, | |
117 | TARGET_SIGNAL_XFSZ = 25, | |
118 | TARGET_SIGNAL_VTALRM = 26, | |
119 | TARGET_SIGNAL_PROF = 27, | |
120 | TARGET_SIGNAL_WINCH = 28, | |
121 | TARGET_SIGNAL_LOST = 29, | |
122 | TARGET_SIGNAL_USR1 = 30, | |
123 | TARGET_SIGNAL_USR2 = 31, | |
124 | TARGET_SIGNAL_PWR = 32, | |
125 | /* Similar to SIGIO. Perhaps they should have the same number. */ | |
126 | TARGET_SIGNAL_POLL = 33, | |
127 | TARGET_SIGNAL_WIND = 34, | |
128 | TARGET_SIGNAL_PHONE = 35, | |
129 | TARGET_SIGNAL_WAITING = 36, | |
130 | TARGET_SIGNAL_LWP = 37, | |
131 | TARGET_SIGNAL_DANGER = 38, | |
132 | TARGET_SIGNAL_GRANT = 39, | |
133 | TARGET_SIGNAL_RETRACT = 40, | |
134 | TARGET_SIGNAL_MSG = 41, | |
135 | TARGET_SIGNAL_SOUND = 42, | |
136 | TARGET_SIGNAL_SAK = 43, | |
137 | ||
138 | /* Some signal we don't know about. */ | |
139 | TARGET_SIGNAL_UNKNOWN, | |
140 | ||
141 | /* Last and unused enum value, for sizing arrays, etc. */ | |
142 | TARGET_SIGNAL_LAST | |
143 | }; | |
144 | ||
145 | struct target_waitstatus { | |
146 | enum target_waitkind kind; | |
147 | ||
148 | /* Exit status or signal number. */ | |
149 | union { | |
150 | int integer; | |
151 | enum target_signal sig; | |
152 | } value; | |
153 | }; | |
154 | ||
155 | /* Return the string for a signal. */ | |
156 | extern char *target_signal_to_string PARAMS ((enum target_signal)); | |
157 | ||
158 | /* Return the name (SIGHUP, etc.) for a signal. */ | |
159 | extern char *target_signal_to_name PARAMS ((enum target_signal)); | |
160 | ||
161 | /* Given a name (SIGHUP, etc.), return its signal. */ | |
162 | enum target_signal target_signal_from_name PARAMS ((char *)); | |
163 | \f | |
75af490b JG |
164 | struct target_ops |
165 | { | |
166 | char *to_shortname; /* Name this target type */ | |
167 | char *to_longname; /* Name for printing */ | |
168 | char *to_doc; /* Documentation. Does not include trailing | |
169 | newline, and starts with a one-line descrip- | |
170 | tion (probably similar to to_longname). */ | |
171 | void (*to_open) PARAMS ((char *, int)); | |
172 | void (*to_close) PARAMS ((int)); | |
173 | void (*to_attach) PARAMS ((char *, int)); | |
174 | void (*to_detach) PARAMS ((char *, int)); | |
67ac9759 JK |
175 | void (*to_resume) PARAMS ((int, int, enum target_signal)); |
176 | int (*to_wait) PARAMS ((int, struct target_waitstatus *)); | |
75af490b JG |
177 | void (*to_fetch_registers) PARAMS ((int)); |
178 | void (*to_store_registers) PARAMS ((int)); | |
179 | void (*to_prepare_to_store) PARAMS ((void)); | |
f1e7bafc JK |
180 | |
181 | /* Transfer LEN bytes of memory between GDB address MYADDR and | |
182 | target address MEMADDR. If WRITE, transfer them to the target, else | |
183 | transfer them from the target. TARGET is the target from which we | |
184 | get this function. | |
185 | ||
186 | Return value, N, is one of the following: | |
187 | ||
188 | 0 means that we can't handle this. If errno has been set, it is the | |
189 | error which prevented us from doing it (FIXME: What about bfd_error?). | |
190 | ||
191 | positive (call it N) means that we have transferred N bytes | |
192 | starting at MEMADDR. We might be able to handle more bytes | |
193 | beyond this length, but no promises. | |
194 | ||
195 | negative (call its absolute value N) means that we cannot | |
196 | transfer right at MEMADDR, but we could transfer at least | |
197 | something at MEMADDR + N. */ | |
198 | ||
199 | int (*to_xfer_memory) PARAMS ((CORE_ADDR memaddr, char *myaddr, | |
200 | int len, int write, | |
201 | struct target_ops * target)); | |
202 | ||
75af490b JG |
203 | void (*to_files_info) PARAMS ((struct target_ops *)); |
204 | int (*to_insert_breakpoint) PARAMS ((CORE_ADDR, char *)); | |
205 | int (*to_remove_breakpoint) PARAMS ((CORE_ADDR, char *)); | |
206 | void (*to_terminal_init) PARAMS ((void)); | |
207 | void (*to_terminal_inferior) PARAMS ((void)); | |
208 | void (*to_terminal_ours_for_output) PARAMS ((void)); | |
209 | void (*to_terminal_ours) PARAMS ((void)); | |
210 | void (*to_terminal_info) PARAMS ((char *, int)); | |
211 | void (*to_kill) PARAMS ((void)); | |
212 | void (*to_load) PARAMS ((char *, int)); | |
213 | int (*to_lookup_symbol) PARAMS ((char *, CORE_ADDR *)); | |
214 | void (*to_create_inferior) PARAMS ((char *, char *, char **)); | |
215 | void (*to_mourn_inferior) PARAMS ((void)); | |
836e343b | 216 | int (*to_can_run) PARAMS ((void)); |
67ac9759 | 217 | void (*to_notice_signals) PARAMS ((int pid)); |
75af490b JG |
218 | enum strata to_stratum; |
219 | struct target_ops | |
220 | *to_next; | |
221 | int to_has_all_memory; | |
222 | int to_has_memory; | |
223 | int to_has_stack; | |
224 | int to_has_registers; | |
225 | int to_has_execution; | |
226 | struct section_table | |
227 | *to_sections; | |
228 | struct section_table | |
229 | *to_sections_end; | |
230 | int to_magic; | |
231 | /* Need sub-structure for target machine related rather than comm related? */ | |
bd5635a1 RP |
232 | }; |
233 | ||
234 | /* Magic number for checking ops size. If a struct doesn't end with this | |
235 | number, somebody changed the declaration but didn't change all the | |
236 | places that initialize one. */ | |
237 | ||
238 | #define OPS_MAGIC 3840 | |
239 | ||
f1e7bafc JK |
240 | /* The ops structure for our "current" target process. This should |
241 | never be NULL. If there is no target, it points to the dummy_target. */ | |
bd5635a1 RP |
242 | |
243 | extern struct target_ops *current_target; | |
244 | ||
245 | /* Define easy words for doing these operations on our current target. */ | |
246 | ||
247 | #define target_shortname (current_target->to_shortname) | |
248 | #define target_longname (current_target->to_longname) | |
249 | ||
9136fe49 JK |
250 | /* The open routine takes the rest of the parameters from the command, |
251 | and (if successful) pushes a new target onto the stack. | |
252 | Targets should supply this routine, if only to provide an error message. */ | |
bd5635a1 RP |
253 | #define target_open(name, from_tty) \ |
254 | (*current_target->to_open) (name, from_tty) | |
255 | ||
256 | /* Does whatever cleanup is required for a target that we are no longer | |
257 | going to be calling. Argument says whether we are quitting gdb and | |
258 | should not get hung in case of errors, or whether we want a clean | |
259 | termination even if it takes a while. This routine is automatically | |
260 | always called just before a routine is popped off the target stack. | |
261 | Closing file descriptors and freeing memory are typical things it should | |
262 | do. */ | |
263 | ||
264 | #define target_close(quitting) \ | |
265 | (*current_target->to_close) (quitting) | |
266 | ||
836e343b JG |
267 | /* Attaches to a process on the target side. Arguments are as passed |
268 | to the `attach' command by the user. This routine can be called | |
269 | when the target is not on the target-stack, if the target_can_run | |
270 | routine returns 1; in that case, it must push itself onto the stack. | |
271 | Upon exit, the target should be ready for normal operations, and | |
272 | should be ready to deliver the status of the process immediately | |
273 | (without waiting) to an upcoming target_wait call. */ | |
bd5635a1 RP |
274 | |
275 | #define target_attach(args, from_tty) \ | |
276 | (*current_target->to_attach) (args, from_tty) | |
277 | ||
278 | /* Takes a program previously attached to and detaches it. | |
279 | The program may resume execution (some targets do, some don't) and will | |
280 | no longer stop on signals, etc. We better not have left any breakpoints | |
281 | in the program or it'll die when it hits one. ARGS is arguments | |
282 | typed by the user (e.g. a signal to send the process). FROM_TTY | |
283 | says whether to be verbose or not. */ | |
284 | ||
f1e7bafc JK |
285 | extern void |
286 | target_detach PARAMS ((char *, int)); | |
bd5635a1 | 287 | |
f1e7bafc JK |
288 | /* Resume execution of the target process PID. STEP says whether to |
289 | single-step or to run free; SIGGNAL is the signal value (e.g. SIGINT) to be | |
290 | given to the target, or zero for no signal. */ | |
bd5635a1 | 291 | |
f1e7bafc JK |
292 | #define target_resume(pid, step, siggnal) \ |
293 | (*current_target->to_resume) (pid, step, siggnal) | |
bd5635a1 | 294 | |
67ac9759 JK |
295 | /* Wait for process pid to do something. Pid = -1 to wait for any pid to do |
296 | something. Return pid of child, or -1 in case of error; store status | |
297 | through argument pointer STATUS. */ | |
bd5635a1 | 298 | |
67ac9759 JK |
299 | #define target_wait(pid, status) \ |
300 | (*current_target->to_wait) (pid, status) | |
bd5635a1 | 301 | |
75af490b | 302 | /* Fetch register REGNO, or all regs if regno == -1. No result. */ |
bd5635a1 RP |
303 | |
304 | #define target_fetch_registers(regno) \ | |
305 | (*current_target->to_fetch_registers) (regno) | |
306 | ||
307 | /* Store at least register REGNO, or all regs if REGNO == -1. | |
f1e7bafc JK |
308 | It can store as many registers as it wants to, so target_prepare_to_store |
309 | must have been previously called. Calls error() if there are problems. */ | |
bd5635a1 RP |
310 | |
311 | #define target_store_registers(regs) \ | |
312 | (*current_target->to_store_registers) (regs) | |
313 | ||
314 | /* Get ready to modify the registers array. On machines which store | |
315 | individual registers, this doesn't need to do anything. On machines | |
316 | which store all the registers in one fell swoop, this makes sure | |
317 | that REGISTERS contains all the registers from the program being | |
318 | debugged. */ | |
319 | ||
320 | #define target_prepare_to_store() \ | |
321 | (*current_target->to_prepare_to_store) () | |
322 | ||
75af490b JG |
323 | extern int |
324 | target_read_string PARAMS ((CORE_ADDR, char *, int)); | |
325 | ||
326 | extern int | |
327 | target_read_memory PARAMS ((CORE_ADDR, char *, int)); | |
328 | ||
f1e7bafc JK |
329 | extern int |
330 | target_read_memory_partial PARAMS ((CORE_ADDR, char *, int, int *)); | |
331 | ||
75af490b JG |
332 | extern int |
333 | target_write_memory PARAMS ((CORE_ADDR, char *, int)); | |
334 | ||
335 | extern int | |
336 | xfer_memory PARAMS ((CORE_ADDR, char *, int, int, struct target_ops *)); | |
337 | ||
338 | extern int | |
339 | child_xfer_memory PARAMS ((CORE_ADDR, char *, int, int, struct target_ops *)); | |
340 | ||
f1e7bafc JK |
341 | /* Transfer LEN bytes between target address MEMADDR and GDB address MYADDR. |
342 | Returns 0 for success, errno code for failure (which includes partial | |
343 | transfers--if you want a more useful response to partial transfers, try | |
344 | target_read_memory_partial). */ | |
345 | ||
346 | extern int target_xfer_memory PARAMS ((CORE_ADDR memaddr, char *myaddr, | |
347 | int len, int write)); | |
75af490b JG |
348 | |
349 | /* From exec.c */ | |
350 | ||
351 | extern void | |
352 | print_section_info PARAMS ((struct target_ops *, bfd *)); | |
bd5635a1 RP |
353 | |
354 | /* Print a line about the current target. */ | |
355 | ||
356 | #define target_files_info() \ | |
75af490b | 357 | (*current_target->to_files_info) (current_target) |
bd5635a1 RP |
358 | |
359 | /* Insert a breakpoint at address ADDR in the target machine. | |
360 | SAVE is a pointer to memory allocated for saving the | |
361 | target contents. It is guaranteed by the caller to be long enough | |
362 | to save "sizeof BREAKPOINT" bytes. Result is 0 for success, or | |
363 | an errno value. */ | |
364 | ||
365 | #define target_insert_breakpoint(addr, save) \ | |
366 | (*current_target->to_insert_breakpoint) (addr, save) | |
367 | ||
368 | /* Remove a breakpoint at address ADDR in the target machine. | |
369 | SAVE is a pointer to the same save area | |
370 | that was previously passed to target_insert_breakpoint. | |
371 | Result is 0 for success, or an errno value. */ | |
372 | ||
373 | #define target_remove_breakpoint(addr, save) \ | |
374 | (*current_target->to_remove_breakpoint) (addr, save) | |
375 | ||
376 | /* Initialize the terminal settings we record for the inferior, | |
377 | before we actually run the inferior. */ | |
378 | ||
379 | #define target_terminal_init() \ | |
380 | (*current_target->to_terminal_init) () | |
f1e7bafc | 381 | |
bd5635a1 RP |
382 | /* Put the inferior's terminal settings into effect. |
383 | This is preparation for starting or resuming the inferior. */ | |
384 | ||
385 | #define target_terminal_inferior() \ | |
386 | (*current_target->to_terminal_inferior) () | |
387 | ||
388 | /* Put some of our terminal settings into effect, | |
389 | enough to get proper results from our output, | |
390 | but do not change into or out of RAW mode | |
391 | so that no input is discarded. | |
392 | ||
393 | After doing this, either terminal_ours or terminal_inferior | |
394 | should be called to get back to a normal state of affairs. */ | |
395 | ||
396 | #define target_terminal_ours_for_output() \ | |
397 | (*current_target->to_terminal_ours_for_output) () | |
398 | ||
399 | /* Put our terminal settings into effect. | |
400 | First record the inferior's terminal settings | |
401 | so they can be restored properly later. */ | |
402 | ||
403 | #define target_terminal_ours() \ | |
404 | (*current_target->to_terminal_ours) () | |
405 | ||
406 | /* Print useful information about our terminal status, if such a thing | |
407 | exists. */ | |
408 | ||
409 | #define target_terminal_info(arg, from_tty) \ | |
410 | (*current_target->to_terminal_info) (arg, from_tty) | |
411 | ||
412 | /* Kill the inferior process. Make it go away. */ | |
413 | ||
75af490b JG |
414 | #define target_kill() \ |
415 | (*current_target->to_kill) () | |
bd5635a1 RP |
416 | |
417 | /* Load an executable file into the target process. This is expected to | |
418 | not only bring new code into the target process, but also to update | |
419 | GDB's symbol tables to match. */ | |
420 | ||
421 | #define target_load(arg, from_tty) \ | |
422 | (*current_target->to_load) (arg, from_tty) | |
423 | ||
bd5635a1 RP |
424 | /* Look up a symbol in the target's symbol table. NAME is the symbol |
425 | name. ADDRP is a CORE_ADDR * pointing to where the value of the symbol | |
426 | should be returned. The result is 0 if successful, nonzero if the | |
427 | symbol does not exist in the target environment. This function should | |
428 | not call error() if communication with the target is interrupted, since | |
429 | it is called from symbol reading, but should return nonzero, possibly | |
430 | doing a complain(). */ | |
431 | ||
432 | #define target_lookup_symbol(name, addrp) \ | |
433 | (*current_target->to_lookup_symbol) (name, addrp) | |
434 | ||
435 | /* Start an inferior process and set inferior_pid to its pid. | |
436 | EXEC_FILE is the file to run. | |
437 | ALLARGS is a string containing the arguments to the program. | |
438 | ENV is the environment vector to pass. Errors reported with error(). | |
439 | On VxWorks and various standalone systems, we ignore exec_file. */ | |
440 | ||
441 | #define target_create_inferior(exec_file, args, env) \ | |
442 | (*current_target->to_create_inferior) (exec_file, args, env) | |
443 | ||
444 | /* The inferior process has died. Do what is right. */ | |
445 | ||
446 | #define target_mourn_inferior() \ | |
447 | (*current_target->to_mourn_inferior) () | |
448 | ||
836e343b JG |
449 | /* Does target have enough data to do a run or attach command? */ |
450 | ||
451 | #define target_can_run(t) \ | |
452 | ((t)->to_can_run) () | |
453 | ||
f1e7bafc JK |
454 | /* post process changes to signal handling in the inferior. */ |
455 | ||
67ac9759 JK |
456 | #define target_notice_signals(pid) \ |
457 | (*current_target->to_notice_signals) (pid) | |
f1e7bafc | 458 | |
bd5635a1 RP |
459 | /* Pointer to next target in the chain, e.g. a core file and an exec file. */ |
460 | ||
461 | #define target_next \ | |
462 | (current_target->to_next) | |
463 | ||
464 | /* Does the target include all of memory, or only part of it? This | |
465 | determines whether we look up the target chain for other parts of | |
466 | memory if this target can't satisfy a request. */ | |
467 | ||
468 | #define target_has_all_memory \ | |
469 | (current_target->to_has_all_memory) | |
470 | ||
471 | /* Does the target include memory? (Dummy targets don't.) */ | |
472 | ||
473 | #define target_has_memory \ | |
474 | (current_target->to_has_memory) | |
475 | ||
476 | /* Does the target have a stack? (Exec files don't, VxWorks doesn't, until | |
477 | we start a process.) */ | |
478 | ||
479 | #define target_has_stack \ | |
480 | (current_target->to_has_stack) | |
481 | ||
482 | /* Does the target have registers? (Exec files don't.) */ | |
483 | ||
484 | #define target_has_registers \ | |
485 | (current_target->to_has_registers) | |
486 | ||
f1e7bafc JK |
487 | /* Does the target have execution? Can we make it jump (through |
488 | hoops), or pop its stack a few times? FIXME: If this is to work that | |
489 | way, it needs to check whether an inferior actually exists. | |
490 | remote-udi.c and probably other targets can be the current target | |
491 | when the inferior doesn't actually exist at the moment. Right now | |
492 | this just tells us whether this target is *capable* of execution. */ | |
bd5635a1 RP |
493 | |
494 | #define target_has_execution \ | |
495 | (current_target->to_has_execution) | |
496 | ||
f1e7bafc JK |
497 | /* Converts a process id to a string. Usually, the string just contains |
498 | `process xyz', but on some systems it may contain | |
499 | `process xyz thread abc'. */ | |
500 | ||
501 | #ifndef target_pid_to_str | |
502 | #define target_pid_to_str(PID) \ | |
503 | normal_pid_to_str (PID) | |
504 | extern char *normal_pid_to_str PARAMS ((int pid)); | |
505 | #endif | |
506 | ||
bd5635a1 RP |
507 | /* Routines for maintenance of the target structures... |
508 | ||
509 | add_target: Add a target to the list of all possible targets. | |
510 | ||
511 | push_target: Make this target the top of the stack of currently used | |
512 | targets, within its particular stratum of the stack. Result | |
513 | is 0 if now atop the stack, nonzero if not on top (maybe | |
514 | should warn user). | |
515 | ||
516 | unpush_target: Remove this from the stack of currently used targets, | |
517 | no matter where it is on the list. Returns 0 if no | |
518 | change, 1 if removed from stack. | |
519 | ||
520 | pop_target: Remove the top thing on the stack of current targets. */ | |
521 | ||
75af490b JG |
522 | extern void |
523 | add_target PARAMS ((struct target_ops *)); | |
524 | ||
525 | extern int | |
526 | push_target PARAMS ((struct target_ops *)); | |
527 | ||
528 | extern int | |
529 | unpush_target PARAMS ((struct target_ops *)); | |
530 | ||
531 | extern void | |
532 | target_preopen PARAMS ((int)); | |
533 | ||
534 | extern void | |
535 | pop_target PARAMS ((void)); | |
536 | ||
537 | /* Struct section_table maps address ranges to file sections. It is | |
538 | mostly used with BFD files, but can be used without (e.g. for handling | |
539 | raw disks, or files not in formats handled by BFD). */ | |
540 | ||
541 | struct section_table { | |
542 | CORE_ADDR addr; /* Lowest address in section */ | |
543 | CORE_ADDR endaddr; /* 1+highest address in section */ | |
544 | sec_ptr sec_ptr; /* BFD section pointer */ | |
545 | bfd *bfd; /* BFD file pointer */ | |
546 | }; | |
547 | ||
548 | /* Builds a section table, given args BFD, SECTABLE_PTR, SECEND_PTR. | |
549 | Returns 0 if OK, 1 on error. */ | |
550 | ||
551 | extern int | |
552 | build_section_table PARAMS ((bfd *, struct section_table **, | |
553 | struct section_table **)); | |
554 | ||
75af490b JG |
555 | /* From mem-break.c */ |
556 | ||
557 | extern int | |
558 | memory_remove_breakpoint PARAMS ((CORE_ADDR, char *)); | |
559 | ||
560 | extern int | |
561 | memory_insert_breakpoint PARAMS ((CORE_ADDR, char *)); | |
562 | ||
dcc8abce JG |
563 | /* From target.c */ |
564 | ||
565 | void | |
566 | noprocess PARAMS ((void)); | |
567 | ||
836e343b JG |
568 | void |
569 | find_default_attach PARAMS ((char *, int)); | |
570 | ||
571 | void | |
572 | find_default_create_inferior PARAMS ((char *, char *, char **)); | |
573 | ||
f1e7bafc JK |
574 | struct target_ops * |
575 | find_core_target PARAMS ((void)); | |
576 | \f | |
67ac9759 JK |
577 | /* Stuff that should be shared among the various remote targets. */ |
578 | ||
579 | /* Debugging level. 0 is off, and non-zero values mean to print some debug | |
580 | information (higher values, more information). */ | |
581 | extern int remote_debug; | |
582 | ||
583 | /* Speed in bits per second. */ | |
584 | extern int baud_rate; | |
585 | \f | |
586 | /* Functions for helping to write a native target. */ | |
587 | ||
588 | /* This is for native targets which use a unix/POSIX-style waitstatus. */ | |
589 | extern void store_waitstatus PARAMS ((struct target_waitstatus *, int)); | |
590 | ||
591 | /* Convert between host signal numbers and enum target_signal's. */ | |
592 | extern enum target_signal target_signal_from_host PARAMS ((int)); | |
593 | extern int target_signal_to_host PARAMS ((enum target_signal)); | |
594 | ||
75af490b | 595 | #endif /* !defined (TARGET_H) */ |