1e93f7393Sniklas /* Interface between GDB and target environments, including files and processes 2b725ae77Skettenis 3b725ae77Skettenis Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 4b725ae77Skettenis 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. 5b725ae77Skettenis 6e93f7393Sniklas Contributed by Cygnus Support. Written by John Gilmore. 7e93f7393Sniklas 8e93f7393Sniklas This file is part of GDB. 9e93f7393Sniklas 10e93f7393Sniklas This program is free software; you can redistribute it and/or modify 11e93f7393Sniklas it under the terms of the GNU General Public License as published by 12e93f7393Sniklas the Free Software Foundation; either version 2 of the License, or 13e93f7393Sniklas (at your option) any later version. 14e93f7393Sniklas 15e93f7393Sniklas This program is distributed in the hope that it will be useful, 16e93f7393Sniklas but WITHOUT ANY WARRANTY; without even the implied warranty of 17e93f7393Sniklas MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18e93f7393Sniklas GNU General Public License for more details. 19e93f7393Sniklas 20e93f7393Sniklas You should have received a copy of the GNU General Public License 21e93f7393Sniklas along with this program; if not, write to the Free Software 22b725ae77Skettenis Foundation, Inc., 59 Temple Place - Suite 330, 23b725ae77Skettenis Boston, MA 02111-1307, USA. */ 24e93f7393Sniklas 25e93f7393Sniklas #if !defined (TARGET_H) 26e93f7393Sniklas #define TARGET_H 27e93f7393Sniklas 28b725ae77Skettenis struct objfile; 29b725ae77Skettenis struct ui_file; 30b725ae77Skettenis struct mem_attrib; 31b725ae77Skettenis struct target_ops; 32b725ae77Skettenis 33e93f7393Sniklas /* This include file defines the interface between the main part 34e93f7393Sniklas of the debugger, and the part which is target-specific, or 35e93f7393Sniklas specific to the communications interface between us and the 36e93f7393Sniklas target. 37e93f7393Sniklas 38e93f7393Sniklas A TARGET is an interface between the debugger and a particular 39e93f7393Sniklas kind of file or process. Targets can be STACKED in STRATA, 40e93f7393Sniklas so that more than one target can potentially respond to a request. 41e93f7393Sniklas In particular, memory accesses will walk down the stack of targets 42e93f7393Sniklas until they find a target that is interested in handling that particular 43e93f7393Sniklas address. STRATA are artificial boundaries on the stack, within 44e93f7393Sniklas which particular kinds of targets live. Strata exist so that 45e93f7393Sniklas people don't get confused by pushing e.g. a process target and then 46e93f7393Sniklas a file target, and wondering why they can't see the current values 47e93f7393Sniklas of variables any more (the file target is handling them and they 48e93f7393Sniklas never get to the process target). So when you push a file target, 49e93f7393Sniklas it goes into the file stratum, which is always below the process 50e93f7393Sniklas stratum. */ 51e93f7393Sniklas 52e93f7393Sniklas #include "bfd.h" 53b725ae77Skettenis #include "symtab.h" 54b725ae77Skettenis #include "dcache.h" 55b725ae77Skettenis #include "memattr.h" 56e93f7393Sniklas 57b725ae77Skettenis enum strata 58b725ae77Skettenis { 59e93f7393Sniklas dummy_stratum, /* The lowest of the low */ 60e93f7393Sniklas file_stratum, /* Executable files, etc */ 61e93f7393Sniklas core_stratum, /* Core dump files */ 62e93f7393Sniklas download_stratum, /* Downloading of remote targets */ 63b725ae77Skettenis process_stratum, /* Executing processes */ 64b725ae77Skettenis thread_stratum /* Executing threads */ 65b725ae77Skettenis }; 66b725ae77Skettenis 67b725ae77Skettenis enum thread_control_capabilities 68b725ae77Skettenis { 69b725ae77Skettenis tc_none = 0, /* Default: can't control thread execution. */ 70b725ae77Skettenis tc_schedlock = 1, /* Can lock the thread scheduler. */ 71b725ae77Skettenis tc_switch = 2 /* Can switch the running thread on demand. */ 72e93f7393Sniklas }; 73e93f7393Sniklas 74e93f7393Sniklas /* Stuff for target_wait. */ 75e93f7393Sniklas 76e93f7393Sniklas /* Generally, what has the program done? */ 77b725ae77Skettenis enum target_waitkind 78b725ae77Skettenis { 79e93f7393Sniklas /* The program has exited. The exit status is in value.integer. */ 80e93f7393Sniklas TARGET_WAITKIND_EXITED, 81e93f7393Sniklas 82b725ae77Skettenis /* The program has stopped with a signal. Which signal is in 83b725ae77Skettenis value.sig. */ 84e93f7393Sniklas TARGET_WAITKIND_STOPPED, 85e93f7393Sniklas 86e93f7393Sniklas /* The program has terminated with a signal. Which signal is in 87e93f7393Sniklas value.sig. */ 88e93f7393Sniklas TARGET_WAITKIND_SIGNALLED, 89e93f7393Sniklas 90e93f7393Sniklas /* The program is letting us know that it dynamically loaded something 91e93f7393Sniklas (e.g. it called load(2) on AIX). */ 92e93f7393Sniklas TARGET_WAITKIND_LOADED, 93e93f7393Sniklas 94b725ae77Skettenis /* The program has forked. A "related" process' ID is in 95b725ae77Skettenis value.related_pid. I.e., if the child forks, value.related_pid 96b725ae77Skettenis is the parent's ID. */ 97b725ae77Skettenis 98b725ae77Skettenis TARGET_WAITKIND_FORKED, 99b725ae77Skettenis 100b725ae77Skettenis /* The program has vforked. A "related" process's ID is in 101b725ae77Skettenis value.related_pid. */ 102b725ae77Skettenis 103b725ae77Skettenis TARGET_WAITKIND_VFORKED, 104b725ae77Skettenis 105b725ae77Skettenis /* The program has exec'ed a new executable file. The new file's 106b725ae77Skettenis pathname is pointed to by value.execd_pathname. */ 107b725ae77Skettenis 108b725ae77Skettenis TARGET_WAITKIND_EXECD, 109b725ae77Skettenis 110b725ae77Skettenis /* The program has entered or returned from a system call. On 111b725ae77Skettenis HP-UX, this is used in the hardware watchpoint implementation. 112b725ae77Skettenis The syscall's unique integer ID number is in value.syscall_id */ 113b725ae77Skettenis 114b725ae77Skettenis TARGET_WAITKIND_SYSCALL_ENTRY, 115b725ae77Skettenis TARGET_WAITKIND_SYSCALL_RETURN, 116b725ae77Skettenis 117e93f7393Sniklas /* Nothing happened, but we stopped anyway. This perhaps should be handled 118e93f7393Sniklas within target_wait, but I'm not sure target_wait should be resuming the 119e93f7393Sniklas inferior. */ 120b725ae77Skettenis TARGET_WAITKIND_SPURIOUS, 121b725ae77Skettenis 122b725ae77Skettenis /* An event has occured, but we should wait again. 123b725ae77Skettenis Remote_async_wait() returns this when there is an event 124b725ae77Skettenis on the inferior, but the rest of the world is not interested in 125b725ae77Skettenis it. The inferior has not stopped, but has just sent some output 126b725ae77Skettenis to the console, for instance. In this case, we want to go back 127b725ae77Skettenis to the event loop and wait there for another event from the 128b725ae77Skettenis inferior, rather than being stuck in the remote_async_wait() 129b725ae77Skettenis function. This way the event loop is responsive to other events, 130b725ae77Skettenis like for instance the user typing. */ 131b725ae77Skettenis TARGET_WAITKIND_IGNORE 132e93f7393Sniklas }; 133e93f7393Sniklas 134b725ae77Skettenis struct target_waitstatus 135b725ae77Skettenis { 136e93f7393Sniklas enum target_waitkind kind; 137e93f7393Sniklas 138b725ae77Skettenis /* Forked child pid, execd pathname, exit status or signal number. */ 139b725ae77Skettenis union 140b725ae77Skettenis { 141e93f7393Sniklas int integer; 142e93f7393Sniklas enum target_signal sig; 143b725ae77Skettenis int related_pid; 144b725ae77Skettenis char *execd_pathname; 145b725ae77Skettenis int syscall_id; 146b725ae77Skettenis } 147b725ae77Skettenis value; 148b725ae77Skettenis }; 149b725ae77Skettenis 150b725ae77Skettenis /* Possible types of events that the inferior handler will have to 151b725ae77Skettenis deal with. */ 152b725ae77Skettenis enum inferior_event_type 153b725ae77Skettenis { 154b725ae77Skettenis /* There is a request to quit the inferior, abandon it. */ 155b725ae77Skettenis INF_QUIT_REQ, 156b725ae77Skettenis /* Process a normal inferior event which will result in target_wait 157b725ae77Skettenis being called. */ 158b725ae77Skettenis INF_REG_EVENT, 159b725ae77Skettenis /* Deal with an error on the inferior. */ 160b725ae77Skettenis INF_ERROR, 161b725ae77Skettenis /* We are called because a timer went off. */ 162b725ae77Skettenis INF_TIMER, 163b725ae77Skettenis /* We are called to do stuff after the inferior stops. */ 164b725ae77Skettenis INF_EXEC_COMPLETE, 165b725ae77Skettenis /* We are called to do some stuff after the inferior stops, but we 166b725ae77Skettenis are expected to reenter the proceed() and 167b725ae77Skettenis handle_inferior_event() functions. This is used only in case of 168b725ae77Skettenis 'step n' like commands. */ 169b725ae77Skettenis INF_EXEC_CONTINUE 170e93f7393Sniklas }; 171e93f7393Sniklas 172e93f7393Sniklas /* Return the string for a signal. */ 173b725ae77Skettenis extern char *target_signal_to_string (enum target_signal); 174e93f7393Sniklas 175e93f7393Sniklas /* Return the name (SIGHUP, etc.) for a signal. */ 176b725ae77Skettenis extern char *target_signal_to_name (enum target_signal); 177e93f7393Sniklas 178e93f7393Sniklas /* Given a name (SIGHUP, etc.), return its signal. */ 179b725ae77Skettenis enum target_signal target_signal_from_name (char *); 180e93f7393Sniklas 181b725ae77Skettenis /* Request the transfer of up to LEN 8-bit bytes of the target's 182b725ae77Skettenis OBJECT. The OFFSET, for a seekable object, specifies the starting 183b725ae77Skettenis point. The ANNEX can be used to provide additional data-specific 184b725ae77Skettenis information to the target. 185b725ae77Skettenis 186b725ae77Skettenis Return the number of bytes actually transfered, zero when no 187b725ae77Skettenis further transfer is possible, and -1 when the transfer is not 188b725ae77Skettenis supported. 189b725ae77Skettenis 190b725ae77Skettenis NOTE: cagney/2003-10-17: The current interface does not support a 191b725ae77Skettenis "retry" mechanism. Instead it assumes that at least one byte will 192b725ae77Skettenis be transfered on each call. 193b725ae77Skettenis 194b725ae77Skettenis NOTE: cagney/2003-10-17: The current interface can lead to 195b725ae77Skettenis fragmented transfers. Lower target levels should not implement 196b725ae77Skettenis hacks, such as enlarging the transfer, in an attempt to compensate 197b725ae77Skettenis for this. Instead, the target stack should be extended so that it 198b725ae77Skettenis implements supply/collect methods and a look-aside object cache. 199b725ae77Skettenis With that available, the lowest target can safely and freely "push" 200b725ae77Skettenis data up the stack. 201b725ae77Skettenis 202b725ae77Skettenis NOTE: cagney/2003-10-17: Unlike the old query and the memory 203b725ae77Skettenis transfer mechanisms, these methods are explicitly parameterized by 204b725ae77Skettenis the target that it should be applied to. 205b725ae77Skettenis 206b725ae77Skettenis NOTE: cagney/2003-10-17: Just like the old query and memory xfer 207b725ae77Skettenis methods, these new methods perform partial transfers. The only 208b725ae77Skettenis difference is that these new methods thought to include "partial" 209b725ae77Skettenis in the name. The old code's failure to do this lead to much 210b725ae77Skettenis confusion and duplication of effort as each target object attempted 211b725ae77Skettenis to locally take responsibility for something it didn't have to 212b725ae77Skettenis worry about. 213b725ae77Skettenis 214b725ae77Skettenis NOTE: cagney/2003-10-17: With a TARGET_OBJECT_KOD object, for 215b725ae77Skettenis backward compatibility with the "target_query" method that this 216b725ae77Skettenis replaced, when OFFSET and LEN are both zero, return the "minimum" 217b725ae77Skettenis buffer size. See "remote.c" for further information. */ 218b725ae77Skettenis 219b725ae77Skettenis enum target_object 220b725ae77Skettenis { 221b725ae77Skettenis /* Kernel Object Display transfer. See "kod.c" and "remote.c". */ 222b725ae77Skettenis TARGET_OBJECT_KOD, 223b725ae77Skettenis /* AVR target specific transfer. See "avr-tdep.c" and "remote.c". */ 224b725ae77Skettenis TARGET_OBJECT_AVR, 225b725ae77Skettenis /* Transfer up-to LEN bytes of memory starting at OFFSET. */ 226b725ae77Skettenis TARGET_OBJECT_MEMORY, 227b725ae77Skettenis /* Kernel Unwind Table. See "ia64-tdep.c". */ 228b725ae77Skettenis TARGET_OBJECT_UNWIND_TABLE, 229b725ae77Skettenis /* Transfer auxilliary vector. */ 230b725ae77Skettenis TARGET_OBJECT_AUXV, 231b725ae77Skettenis /* StackGhost cookie. See "sparc-tdep.c". */ 232b725ae77Skettenis TARGET_OBJECT_WCOOKIE 233b725ae77Skettenis 234b725ae77Skettenis /* Possible future objects: TARGET_OBJECT_FILE, TARGET_OBJECT_PROC, ... */ 235b725ae77Skettenis }; 236b725ae77Skettenis 237b725ae77Skettenis extern LONGEST target_read_partial (struct target_ops *ops, 238b725ae77Skettenis enum target_object object, 239b725ae77Skettenis const char *annex, void *buf, 240b725ae77Skettenis ULONGEST offset, LONGEST len); 241b725ae77Skettenis 242b725ae77Skettenis extern LONGEST target_write_partial (struct target_ops *ops, 243b725ae77Skettenis enum target_object object, 244b725ae77Skettenis const char *annex, const void *buf, 245b725ae77Skettenis ULONGEST offset, LONGEST len); 246b725ae77Skettenis 247b725ae77Skettenis /* Wrappers to perform the full transfer. */ 248b725ae77Skettenis extern LONGEST target_read (struct target_ops *ops, 249b725ae77Skettenis enum target_object object, 250b725ae77Skettenis const char *annex, void *buf, 251b725ae77Skettenis ULONGEST offset, LONGEST len); 252b725ae77Skettenis 253b725ae77Skettenis extern LONGEST target_write (struct target_ops *ops, 254b725ae77Skettenis enum target_object object, 255b725ae77Skettenis const char *annex, const void *buf, 256b725ae77Skettenis ULONGEST offset, LONGEST len); 257b725ae77Skettenis 258b725ae77Skettenis /* Wrappers to target read/write that perform memory transfers. They 259b725ae77Skettenis throw an error if the memory transfer fails. 260b725ae77Skettenis 261b725ae77Skettenis NOTE: cagney/2003-10-23: The naming schema is lifted from 262b725ae77Skettenis "frame.h". The parameter order is lifted from get_frame_memory, 263b725ae77Skettenis which in turn lifted it from read_memory. */ 264b725ae77Skettenis 265b725ae77Skettenis extern void get_target_memory (struct target_ops *ops, CORE_ADDR addr, 266b725ae77Skettenis void *buf, LONGEST len); 267b725ae77Skettenis extern ULONGEST get_target_memory_unsigned (struct target_ops *ops, 268b725ae77Skettenis CORE_ADDR addr, int len); 269b725ae77Skettenis 270b725ae77Skettenis 271e93f7393Sniklas /* If certain kinds of activity happen, target_wait should perform 272e93f7393Sniklas callbacks. */ 273e93f7393Sniklas /* Right now we just call (*TARGET_ACTIVITY_FUNCTION) if I/O is possible 274e93f7393Sniklas on TARGET_ACTIVITY_FD. */ 275e93f7393Sniklas extern int target_activity_fd; 276e93f7393Sniklas /* Returns zero to leave the inferior alone, one to interrupt it. */ 277b725ae77Skettenis extern int (*target_activity_function) (void); 278e93f7393Sniklas 279b725ae77Skettenis struct thread_info; /* fwd decl for parameter list below: */ 280b725ae77Skettenis 281e93f7393Sniklas struct target_ops 282e93f7393Sniklas { 283b725ae77Skettenis struct target_ops *beneath; /* To the target under this one. */ 284e93f7393Sniklas char *to_shortname; /* Name this target type */ 285e93f7393Sniklas char *to_longname; /* Name for printing */ 286e93f7393Sniklas char *to_doc; /* Documentation. Does not include trailing 287e93f7393Sniklas newline, and starts with a one-line descrip- 288e93f7393Sniklas tion (probably similar to to_longname). */ 289b725ae77Skettenis /* Per-target scratch pad. */ 290b725ae77Skettenis void *to_data; 291b725ae77Skettenis /* The open routine takes the rest of the parameters from the 292b725ae77Skettenis command, and (if successful) pushes a new target onto the 293b725ae77Skettenis stack. Targets should supply this routine, if only to provide 294b725ae77Skettenis an error message. */ 295b725ae77Skettenis void (*to_open) (char *, int); 296b725ae77Skettenis /* Old targets with a static target vector provide "to_close". 297b725ae77Skettenis New re-entrant targets provide "to_xclose" and that is expected 298b725ae77Skettenis to xfree everything (including the "struct target_ops"). */ 299b725ae77Skettenis void (*to_xclose) (struct target_ops *targ, int quitting); 300b725ae77Skettenis void (*to_close) (int); 301b725ae77Skettenis void (*to_attach) (char *, int); 302b725ae77Skettenis void (*to_post_attach) (int); 303b725ae77Skettenis void (*to_detach) (char *, int); 304b725ae77Skettenis void (*to_disconnect) (char *, int); 305b725ae77Skettenis void (*to_resume) (ptid_t, int, enum target_signal); 306b725ae77Skettenis ptid_t (*to_wait) (ptid_t, struct target_waitstatus *); 307b725ae77Skettenis void (*to_fetch_registers) (int); 308b725ae77Skettenis void (*to_store_registers) (int); 309b725ae77Skettenis void (*to_prepare_to_store) (void); 310e93f7393Sniklas 311e93f7393Sniklas /* Transfer LEN bytes of memory between GDB address MYADDR and 312e93f7393Sniklas target address MEMADDR. If WRITE, transfer them to the target, else 313e93f7393Sniklas transfer them from the target. TARGET is the target from which we 314e93f7393Sniklas get this function. 315e93f7393Sniklas 316e93f7393Sniklas Return value, N, is one of the following: 317e93f7393Sniklas 318e93f7393Sniklas 0 means that we can't handle this. If errno has been set, it is the 319e93f7393Sniklas error which prevented us from doing it (FIXME: What about bfd_error?). 320e93f7393Sniklas 321e93f7393Sniklas positive (call it N) means that we have transferred N bytes 322e93f7393Sniklas starting at MEMADDR. We might be able to handle more bytes 323e93f7393Sniklas beyond this length, but no promises. 324e93f7393Sniklas 325e93f7393Sniklas negative (call its absolute value N) means that we cannot 326e93f7393Sniklas transfer right at MEMADDR, but we could transfer at least 327*63addd46Skettenis something at MEMADDR + N. 328e93f7393Sniklas 329*63addd46Skettenis NOTE: cagney/2004-10-01: This has been entirely superseeded by 330*63addd46Skettenis to_xfer_partial and inferior inheritance. */ 331*63addd46Skettenis 332*63addd46Skettenis int (*deprecated_xfer_memory) (CORE_ADDR memaddr, char *myaddr, 333e93f7393Sniklas int len, int write, 334b725ae77Skettenis struct mem_attrib *attrib, 335b725ae77Skettenis struct target_ops *target); 336e93f7393Sniklas 337b725ae77Skettenis void (*to_files_info) (struct target_ops *); 338b725ae77Skettenis int (*to_insert_breakpoint) (CORE_ADDR, char *); 339b725ae77Skettenis int (*to_remove_breakpoint) (CORE_ADDR, char *); 340b725ae77Skettenis int (*to_can_use_hw_breakpoint) (int, int, int); 341b725ae77Skettenis int (*to_insert_hw_breakpoint) (CORE_ADDR, char *); 342b725ae77Skettenis int (*to_remove_hw_breakpoint) (CORE_ADDR, char *); 343b725ae77Skettenis int (*to_remove_watchpoint) (CORE_ADDR, int, int); 344b725ae77Skettenis int (*to_insert_watchpoint) (CORE_ADDR, int, int); 345b725ae77Skettenis int (*to_stopped_by_watchpoint) (void); 346b725ae77Skettenis int to_have_continuable_watchpoint; 347*63addd46Skettenis int (*to_stopped_data_address) (struct target_ops *, CORE_ADDR *); 348b725ae77Skettenis int (*to_region_size_ok_for_hw_watchpoint) (int); 349b725ae77Skettenis void (*to_terminal_init) (void); 350b725ae77Skettenis void (*to_terminal_inferior) (void); 351b725ae77Skettenis void (*to_terminal_ours_for_output) (void); 352b725ae77Skettenis void (*to_terminal_ours) (void); 353b725ae77Skettenis void (*to_terminal_save_ours) (void); 354b725ae77Skettenis void (*to_terminal_info) (char *, int); 355b725ae77Skettenis void (*to_kill) (void); 356b725ae77Skettenis void (*to_load) (char *, int); 357b725ae77Skettenis int (*to_lookup_symbol) (char *, CORE_ADDR *); 358*63addd46Skettenis void (*to_create_inferior) (char *, char *, char **, int); 359b725ae77Skettenis void (*to_post_startup_inferior) (ptid_t); 360b725ae77Skettenis void (*to_acknowledge_created_inferior) (int); 361b725ae77Skettenis int (*to_insert_fork_catchpoint) (int); 362b725ae77Skettenis int (*to_remove_fork_catchpoint) (int); 363b725ae77Skettenis int (*to_insert_vfork_catchpoint) (int); 364b725ae77Skettenis int (*to_remove_vfork_catchpoint) (int); 365b725ae77Skettenis int (*to_follow_fork) (int); 366b725ae77Skettenis int (*to_insert_exec_catchpoint) (int); 367b725ae77Skettenis int (*to_remove_exec_catchpoint) (int); 368b725ae77Skettenis int (*to_reported_exec_events_per_exec_call) (void); 369b725ae77Skettenis int (*to_has_exited) (int, int, int *); 370b725ae77Skettenis void (*to_mourn_inferior) (void); 371b725ae77Skettenis int (*to_can_run) (void); 372b725ae77Skettenis void (*to_notice_signals) (ptid_t ptid); 373b725ae77Skettenis int (*to_thread_alive) (ptid_t ptid); 374b725ae77Skettenis void (*to_find_new_threads) (void); 375b725ae77Skettenis char *(*to_pid_to_str) (ptid_t); 376b725ae77Skettenis char *(*to_extra_thread_info) (struct thread_info *); 377b725ae77Skettenis void (*to_stop) (void); 378b725ae77Skettenis void (*to_rcmd) (char *command, struct ui_file *output); 379b725ae77Skettenis struct symtab_and_line *(*to_enable_exception_callback) (enum 380b725ae77Skettenis exception_event_kind, 381b725ae77Skettenis int); 382b725ae77Skettenis struct exception_event_record *(*to_get_current_exception_event) (void); 383b725ae77Skettenis char *(*to_pid_to_exec_file) (int pid); 384e93f7393Sniklas enum strata to_stratum; 385e93f7393Sniklas int to_has_all_memory; 386e93f7393Sniklas int to_has_memory; 387e93f7393Sniklas int to_has_stack; 388e93f7393Sniklas int to_has_registers; 389e93f7393Sniklas int to_has_execution; 390b725ae77Skettenis int to_has_thread_control; /* control thread execution */ 391e93f7393Sniklas struct section_table 392e93f7393Sniklas *to_sections; 393e93f7393Sniklas struct section_table 394e93f7393Sniklas *to_sections_end; 395b725ae77Skettenis /* ASYNC target controls */ 396b725ae77Skettenis int (*to_can_async_p) (void); 397b725ae77Skettenis int (*to_is_async_p) (void); 398b725ae77Skettenis void (*to_async) (void (*cb) (enum inferior_event_type, void *context), 399b725ae77Skettenis void *context); 400b725ae77Skettenis int to_async_mask_value; 401b725ae77Skettenis int (*to_find_memory_regions) (int (*) (CORE_ADDR, 402b725ae77Skettenis unsigned long, 403b725ae77Skettenis int, int, int, 404b725ae77Skettenis void *), 405b725ae77Skettenis void *); 406b725ae77Skettenis char * (*to_make_corefile_notes) (bfd *, int *); 407b725ae77Skettenis 408b725ae77Skettenis /* Return the thread-local address at OFFSET in the 409b725ae77Skettenis thread-local storage for the thread PTID and the shared library 410b725ae77Skettenis or executable file given by OBJFILE. If that block of 411b725ae77Skettenis thread-local storage hasn't been allocated yet, this function 412b725ae77Skettenis may return an error. */ 413b725ae77Skettenis CORE_ADDR (*to_get_thread_local_address) (ptid_t ptid, 414b725ae77Skettenis struct objfile *objfile, 415b725ae77Skettenis CORE_ADDR offset); 416b725ae77Skettenis 417b725ae77Skettenis /* Perform partial transfers on OBJECT. See target_read_partial 418b725ae77Skettenis and target_write_partial for details of each variant. One, and 419b725ae77Skettenis only one, of readbuf or writebuf must be non-NULL. */ 420b725ae77Skettenis LONGEST (*to_xfer_partial) (struct target_ops *ops, 421b725ae77Skettenis enum target_object object, const char *annex, 422b725ae77Skettenis void *readbuf, const void *writebuf, 423b725ae77Skettenis ULONGEST offset, LONGEST len); 424b725ae77Skettenis 425e93f7393Sniklas int to_magic; 426b725ae77Skettenis /* Need sub-structure for target machine related rather than comm related? 427b725ae77Skettenis */ 428e93f7393Sniklas }; 429e93f7393Sniklas 430e93f7393Sniklas /* Magic number for checking ops size. If a struct doesn't end with this 431e93f7393Sniklas number, somebody changed the declaration but didn't change all the 432e93f7393Sniklas places that initialize one. */ 433e93f7393Sniklas 434e93f7393Sniklas #define OPS_MAGIC 3840 435e93f7393Sniklas 436e93f7393Sniklas /* The ops structure for our "current" target process. This should 437e93f7393Sniklas never be NULL. If there is no target, it points to the dummy_target. */ 438e93f7393Sniklas 439e93f7393Sniklas extern struct target_ops current_target; 440e93f7393Sniklas 441e93f7393Sniklas /* Define easy words for doing these operations on our current target. */ 442e93f7393Sniklas 443e93f7393Sniklas #define target_shortname (current_target.to_shortname) 444e93f7393Sniklas #define target_longname (current_target.to_longname) 445e93f7393Sniklas 446b725ae77Skettenis /* Does whatever cleanup is required for a target that we are no 447b725ae77Skettenis longer going to be calling. QUITTING indicates that GDB is exiting 448b725ae77Skettenis and should not get hung on an error (otherwise it is important to 449b725ae77Skettenis perform clean termination, even if it takes a while). This routine 450b725ae77Skettenis is automatically always called when popping the target off the 451b725ae77Skettenis target stack (to_beneath is undefined). Closing file descriptors 452b725ae77Skettenis and freeing all memory allocated memory are typical things it 453b725ae77Skettenis should do. */ 454e93f7393Sniklas 455b725ae77Skettenis void target_close (struct target_ops *targ, int quitting); 456e93f7393Sniklas 457e93f7393Sniklas /* Attaches to a process on the target side. Arguments are as passed 458e93f7393Sniklas to the `attach' command by the user. This routine can be called 459e93f7393Sniklas when the target is not on the target-stack, if the target_can_run 460e93f7393Sniklas routine returns 1; in that case, it must push itself onto the stack. 461e93f7393Sniklas Upon exit, the target should be ready for normal operations, and 462e93f7393Sniklas should be ready to deliver the status of the process immediately 463e93f7393Sniklas (without waiting) to an upcoming target_wait call. */ 464e93f7393Sniklas 465e93f7393Sniklas #define target_attach(args, from_tty) \ 466e93f7393Sniklas (*current_target.to_attach) (args, from_tty) 467e93f7393Sniklas 468b725ae77Skettenis /* The target_attach operation places a process under debugger control, 469b725ae77Skettenis and stops the process. 470b725ae77Skettenis 471b725ae77Skettenis This operation provides a target-specific hook that allows the 472b725ae77Skettenis necessary bookkeeping to be performed after an attach completes. */ 473b725ae77Skettenis #define target_post_attach(pid) \ 474b725ae77Skettenis (*current_target.to_post_attach) (pid) 475b725ae77Skettenis 476e93f7393Sniklas /* Takes a program previously attached to and detaches it. 477e93f7393Sniklas The program may resume execution (some targets do, some don't) and will 478e93f7393Sniklas no longer stop on signals, etc. We better not have left any breakpoints 479e93f7393Sniklas in the program or it'll die when it hits one. ARGS is arguments 480e93f7393Sniklas typed by the user (e.g. a signal to send the process). FROM_TTY 481e93f7393Sniklas says whether to be verbose or not. */ 482e93f7393Sniklas 483b725ae77Skettenis extern void target_detach (char *, int); 484e93f7393Sniklas 485b725ae77Skettenis /* Disconnect from the current target without resuming it (leaving it 486b725ae77Skettenis waiting for a debugger). */ 487b725ae77Skettenis 488b725ae77Skettenis extern void target_disconnect (char *, int); 489b725ae77Skettenis 490b725ae77Skettenis /* Resume execution of the target process PTID. STEP says whether to 491e93f7393Sniklas single-step or to run free; SIGGNAL is the signal to be given to 492e93f7393Sniklas the target, or TARGET_SIGNAL_0 for no signal. The caller may not 493e93f7393Sniklas pass TARGET_SIGNAL_DEFAULT. */ 494e93f7393Sniklas 495b725ae77Skettenis #define target_resume(ptid, step, siggnal) \ 496b725ae77Skettenis do { \ 497b725ae77Skettenis dcache_invalidate(target_dcache); \ 498b725ae77Skettenis (*current_target.to_resume) (ptid, step, siggnal); \ 499b725ae77Skettenis } while (0) 500e93f7393Sniklas 501b725ae77Skettenis /* Wait for process pid to do something. PTID = -1 to wait for any 502b725ae77Skettenis pid to do something. Return pid of child, or -1 in case of error; 503e93f7393Sniklas store status through argument pointer STATUS. Note that it is 504b725ae77Skettenis _NOT_ OK to throw_exception() out of target_wait() without popping 505e93f7393Sniklas the debugging target from the stack; GDB isn't prepared to get back 506e93f7393Sniklas to the prompt with a debugging target but without the frame cache, 507e93f7393Sniklas stop_pc, etc., set up. */ 508e93f7393Sniklas 509b725ae77Skettenis #define target_wait(ptid, status) \ 510b725ae77Skettenis (*current_target.to_wait) (ptid, status) 511e93f7393Sniklas 512b725ae77Skettenis /* Fetch at least register REGNO, or all regs if regno == -1. No result. */ 513e93f7393Sniklas 514e93f7393Sniklas #define target_fetch_registers(regno) \ 515e93f7393Sniklas (*current_target.to_fetch_registers) (regno) 516e93f7393Sniklas 517e93f7393Sniklas /* Store at least register REGNO, or all regs if REGNO == -1. 518e93f7393Sniklas It can store as many registers as it wants to, so target_prepare_to_store 519e93f7393Sniklas must have been previously called. Calls error() if there are problems. */ 520e93f7393Sniklas 521e93f7393Sniklas #define target_store_registers(regs) \ 522e93f7393Sniklas (*current_target.to_store_registers) (regs) 523e93f7393Sniklas 524e93f7393Sniklas /* Get ready to modify the registers array. On machines which store 525e93f7393Sniklas individual registers, this doesn't need to do anything. On machines 526e93f7393Sniklas which store all the registers in one fell swoop, this makes sure 527e93f7393Sniklas that REGISTERS contains all the registers from the program being 528e93f7393Sniklas debugged. */ 529e93f7393Sniklas 530e93f7393Sniklas #define target_prepare_to_store() \ 531e93f7393Sniklas (*current_target.to_prepare_to_store) () 532e93f7393Sniklas 533b725ae77Skettenis extern DCACHE *target_dcache; 534e93f7393Sniklas 535b725ae77Skettenis extern int do_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write, 536b725ae77Skettenis struct mem_attrib *attrib); 537e93f7393Sniklas 538b725ae77Skettenis extern int target_read_string (CORE_ADDR, char **, int, int *); 539e93f7393Sniklas 540b725ae77Skettenis extern int target_read_memory (CORE_ADDR memaddr, char *myaddr, int len); 541e93f7393Sniklas 542b725ae77Skettenis extern int target_write_memory (CORE_ADDR memaddr, char *myaddr, int len); 543e93f7393Sniklas 544b725ae77Skettenis extern int xfer_memory (CORE_ADDR, char *, int, int, 545b725ae77Skettenis struct mem_attrib *, struct target_ops *); 546e93f7393Sniklas 547b725ae77Skettenis extern int child_xfer_memory (CORE_ADDR, char *, int, int, 548b725ae77Skettenis struct mem_attrib *, struct target_ops *); 549e93f7393Sniklas 550b725ae77Skettenis /* Make a single attempt at transfering LEN bytes. On a successful 551b725ae77Skettenis transfer, the number of bytes actually transfered is returned and 552b725ae77Skettenis ERR is set to 0. When a transfer fails, -1 is returned (the number 553b725ae77Skettenis of bytes actually transfered is not defined) and ERR is set to a 554b725ae77Skettenis non-zero error indication. */ 555b725ae77Skettenis 556b725ae77Skettenis extern int target_read_memory_partial (CORE_ADDR addr, char *buf, int len, 557b725ae77Skettenis int *err); 558b725ae77Skettenis 559b725ae77Skettenis extern int target_write_memory_partial (CORE_ADDR addr, char *buf, int len, 560b725ae77Skettenis int *err); 561b725ae77Skettenis 562b725ae77Skettenis extern char *child_pid_to_exec_file (int); 563b725ae77Skettenis 564b725ae77Skettenis extern char *child_core_file_to_sym_file (char *); 565b725ae77Skettenis 566b725ae77Skettenis #if defined(CHILD_POST_ATTACH) 567b725ae77Skettenis extern void child_post_attach (int); 568b725ae77Skettenis #endif 569b725ae77Skettenis 570b725ae77Skettenis extern void child_post_startup_inferior (ptid_t); 571b725ae77Skettenis 572b725ae77Skettenis extern void child_acknowledge_created_inferior (int); 573b725ae77Skettenis 574b725ae77Skettenis extern int child_insert_fork_catchpoint (int); 575b725ae77Skettenis 576b725ae77Skettenis extern int child_remove_fork_catchpoint (int); 577b725ae77Skettenis 578b725ae77Skettenis extern int child_insert_vfork_catchpoint (int); 579b725ae77Skettenis 580b725ae77Skettenis extern int child_remove_vfork_catchpoint (int); 581b725ae77Skettenis 582b725ae77Skettenis extern void child_acknowledge_created_inferior (int); 583b725ae77Skettenis 584b725ae77Skettenis extern int child_follow_fork (int); 585b725ae77Skettenis 586b725ae77Skettenis extern int child_insert_exec_catchpoint (int); 587b725ae77Skettenis 588b725ae77Skettenis extern int child_remove_exec_catchpoint (int); 589b725ae77Skettenis 590b725ae77Skettenis extern int child_reported_exec_events_per_exec_call (void); 591b725ae77Skettenis 592b725ae77Skettenis extern int child_has_exited (int, int, int *); 593b725ae77Skettenis 594b725ae77Skettenis extern int child_thread_alive (ptid_t); 595b725ae77Skettenis 596b725ae77Skettenis /* From infrun.c. */ 597b725ae77Skettenis 598b725ae77Skettenis extern int inferior_has_forked (int pid, int *child_pid); 599b725ae77Skettenis 600b725ae77Skettenis extern int inferior_has_vforked (int pid, int *child_pid); 601b725ae77Skettenis 602b725ae77Skettenis extern int inferior_has_execd (int pid, char **execd_pathname); 603e93f7393Sniklas 604e93f7393Sniklas /* From exec.c */ 605e93f7393Sniklas 606b725ae77Skettenis extern void print_section_info (struct target_ops *, bfd *); 607e93f7393Sniklas 608e93f7393Sniklas /* Print a line about the current target. */ 609e93f7393Sniklas 610e93f7393Sniklas #define target_files_info() \ 611e93f7393Sniklas (*current_target.to_files_info) (¤t_target) 612e93f7393Sniklas 613b725ae77Skettenis /* Insert a breakpoint at address ADDR in the target machine. SAVE is 614b725ae77Skettenis a pointer to memory allocated for saving the target contents. It 615b725ae77Skettenis is guaranteed by the caller to be long enough to save the number of 616b725ae77Skettenis breakpoint bytes indicated by BREAKPOINT_FROM_PC. Result is 0 for 617b725ae77Skettenis success, or an errno value. */ 618e93f7393Sniklas 619e93f7393Sniklas #define target_insert_breakpoint(addr, save) \ 620e93f7393Sniklas (*current_target.to_insert_breakpoint) (addr, save) 621e93f7393Sniklas 622e93f7393Sniklas /* Remove a breakpoint at address ADDR in the target machine. 623e93f7393Sniklas SAVE is a pointer to the same save area 624e93f7393Sniklas that was previously passed to target_insert_breakpoint. 625e93f7393Sniklas Result is 0 for success, or an errno value. */ 626e93f7393Sniklas 627e93f7393Sniklas #define target_remove_breakpoint(addr, save) \ 628e93f7393Sniklas (*current_target.to_remove_breakpoint) (addr, save) 629e93f7393Sniklas 630e93f7393Sniklas /* Initialize the terminal settings we record for the inferior, 631e93f7393Sniklas before we actually run the inferior. */ 632e93f7393Sniklas 633e93f7393Sniklas #define target_terminal_init() \ 634e93f7393Sniklas (*current_target.to_terminal_init) () 635e93f7393Sniklas 636e93f7393Sniklas /* Put the inferior's terminal settings into effect. 637e93f7393Sniklas This is preparation for starting or resuming the inferior. */ 638e93f7393Sniklas 639e93f7393Sniklas #define target_terminal_inferior() \ 640e93f7393Sniklas (*current_target.to_terminal_inferior) () 641e93f7393Sniklas 642e93f7393Sniklas /* Put some of our terminal settings into effect, 643e93f7393Sniklas enough to get proper results from our output, 644e93f7393Sniklas but do not change into or out of RAW mode 645e93f7393Sniklas so that no input is discarded. 646e93f7393Sniklas 647e93f7393Sniklas After doing this, either terminal_ours or terminal_inferior 648e93f7393Sniklas should be called to get back to a normal state of affairs. */ 649e93f7393Sniklas 650e93f7393Sniklas #define target_terminal_ours_for_output() \ 651e93f7393Sniklas (*current_target.to_terminal_ours_for_output) () 652e93f7393Sniklas 653e93f7393Sniklas /* Put our terminal settings into effect. 654e93f7393Sniklas First record the inferior's terminal settings 655e93f7393Sniklas so they can be restored properly later. */ 656e93f7393Sniklas 657e93f7393Sniklas #define target_terminal_ours() \ 658e93f7393Sniklas (*current_target.to_terminal_ours) () 659e93f7393Sniklas 660b725ae77Skettenis /* Save our terminal settings. 661b725ae77Skettenis This is called from TUI after entering or leaving the curses 662b725ae77Skettenis mode. Since curses modifies our terminal this call is here 663b725ae77Skettenis to take this change into account. */ 664b725ae77Skettenis 665b725ae77Skettenis #define target_terminal_save_ours() \ 666b725ae77Skettenis (*current_target.to_terminal_save_ours) () 667b725ae77Skettenis 668e93f7393Sniklas /* Print useful information about our terminal status, if such a thing 669e93f7393Sniklas exists. */ 670e93f7393Sniklas 671e93f7393Sniklas #define target_terminal_info(arg, from_tty) \ 672e93f7393Sniklas (*current_target.to_terminal_info) (arg, from_tty) 673e93f7393Sniklas 674e93f7393Sniklas /* Kill the inferior process. Make it go away. */ 675e93f7393Sniklas 676e93f7393Sniklas #define target_kill() \ 677e93f7393Sniklas (*current_target.to_kill) () 678e93f7393Sniklas 679b725ae77Skettenis /* Load an executable file into the target process. This is expected 680b725ae77Skettenis to not only bring new code into the target process, but also to 681b725ae77Skettenis update GDB's symbol tables to match. */ 682e93f7393Sniklas 683b725ae77Skettenis extern void target_load (char *arg, int from_tty); 684e93f7393Sniklas 685e93f7393Sniklas /* Look up a symbol in the target's symbol table. NAME is the symbol 686b725ae77Skettenis name. ADDRP is a CORE_ADDR * pointing to where the value of the 687b725ae77Skettenis symbol should be returned. The result is 0 if successful, nonzero 688b725ae77Skettenis if the symbol does not exist in the target environment. This 689b725ae77Skettenis function should not call error() if communication with the target 690b725ae77Skettenis is interrupted, since it is called from symbol reading, but should 691b725ae77Skettenis return nonzero, possibly doing a complain(). */ 692e93f7393Sniklas 693e93f7393Sniklas #define target_lookup_symbol(name, addrp) \ 694e93f7393Sniklas (*current_target.to_lookup_symbol) (name, addrp) 695e93f7393Sniklas 696b725ae77Skettenis /* Start an inferior process and set inferior_ptid to its pid. 697e93f7393Sniklas EXEC_FILE is the file to run. 698e93f7393Sniklas ALLARGS is a string containing the arguments to the program. 699e93f7393Sniklas ENV is the environment vector to pass. Errors reported with error(). 700e93f7393Sniklas On VxWorks and various standalone systems, we ignore exec_file. */ 701e93f7393Sniklas 702*63addd46Skettenis #define target_create_inferior(exec_file, args, env, FROM_TTY) \ 703*63addd46Skettenis (*current_target.to_create_inferior) (exec_file, args, env, (FROM_TTY)) 704e93f7393Sniklas 705b725ae77Skettenis 706b725ae77Skettenis /* Some targets (such as ttrace-based HPUX) don't allow us to request 707b725ae77Skettenis notification of inferior events such as fork and vork immediately 708b725ae77Skettenis after the inferior is created. (This because of how gdb gets an 709b725ae77Skettenis inferior created via invoking a shell to do it. In such a scenario, 710b725ae77Skettenis if the shell init file has commands in it, the shell will fork and 711b725ae77Skettenis exec for each of those commands, and we will see each such fork 712b725ae77Skettenis event. Very bad.) 713b725ae77Skettenis 714b725ae77Skettenis Such targets will supply an appropriate definition for this function. */ 715b725ae77Skettenis 716b725ae77Skettenis #define target_post_startup_inferior(ptid) \ 717b725ae77Skettenis (*current_target.to_post_startup_inferior) (ptid) 718b725ae77Skettenis 719b725ae77Skettenis /* On some targets, the sequence of starting up an inferior requires 720b725ae77Skettenis some synchronization between gdb and the new inferior process, PID. */ 721b725ae77Skettenis 722b725ae77Skettenis #define target_acknowledge_created_inferior(pid) \ 723b725ae77Skettenis (*current_target.to_acknowledge_created_inferior) (pid) 724b725ae77Skettenis 725b725ae77Skettenis /* On some targets, we can catch an inferior fork or vfork event when 726b725ae77Skettenis it occurs. These functions insert/remove an already-created 727b725ae77Skettenis catchpoint for such events. */ 728b725ae77Skettenis 729b725ae77Skettenis #define target_insert_fork_catchpoint(pid) \ 730b725ae77Skettenis (*current_target.to_insert_fork_catchpoint) (pid) 731b725ae77Skettenis 732b725ae77Skettenis #define target_remove_fork_catchpoint(pid) \ 733b725ae77Skettenis (*current_target.to_remove_fork_catchpoint) (pid) 734b725ae77Skettenis 735b725ae77Skettenis #define target_insert_vfork_catchpoint(pid) \ 736b725ae77Skettenis (*current_target.to_insert_vfork_catchpoint) (pid) 737b725ae77Skettenis 738b725ae77Skettenis #define target_remove_vfork_catchpoint(pid) \ 739b725ae77Skettenis (*current_target.to_remove_vfork_catchpoint) (pid) 740b725ae77Skettenis 741b725ae77Skettenis /* If the inferior forks or vforks, this function will be called at 742b725ae77Skettenis the next resume in order to perform any bookkeeping and fiddling 743b725ae77Skettenis necessary to continue debugging either the parent or child, as 744b725ae77Skettenis requested, and releasing the other. Information about the fork 745b725ae77Skettenis or vfork event is available via get_last_target_status (). 746b725ae77Skettenis This function returns 1 if the inferior should not be resumed 747b725ae77Skettenis (i.e. there is another event pending). */ 748b725ae77Skettenis 749b725ae77Skettenis #define target_follow_fork(follow_child) \ 750b725ae77Skettenis (*current_target.to_follow_fork) (follow_child) 751b725ae77Skettenis 752b725ae77Skettenis /* On some targets, we can catch an inferior exec event when it 753b725ae77Skettenis occurs. These functions insert/remove an already-created 754b725ae77Skettenis catchpoint for such events. */ 755b725ae77Skettenis 756b725ae77Skettenis #define target_insert_exec_catchpoint(pid) \ 757b725ae77Skettenis (*current_target.to_insert_exec_catchpoint) (pid) 758b725ae77Skettenis 759b725ae77Skettenis #define target_remove_exec_catchpoint(pid) \ 760b725ae77Skettenis (*current_target.to_remove_exec_catchpoint) (pid) 761b725ae77Skettenis 762b725ae77Skettenis /* Returns the number of exec events that are reported when a process 763b725ae77Skettenis invokes a flavor of the exec() system call on this target, if exec 764b725ae77Skettenis events are being reported. */ 765b725ae77Skettenis 766b725ae77Skettenis #define target_reported_exec_events_per_exec_call() \ 767b725ae77Skettenis (*current_target.to_reported_exec_events_per_exec_call) () 768b725ae77Skettenis 769b725ae77Skettenis /* Returns TRUE if PID has exited. And, also sets EXIT_STATUS to the 770b725ae77Skettenis exit code of PID, if any. */ 771b725ae77Skettenis 772b725ae77Skettenis #define target_has_exited(pid,wait_status,exit_status) \ 773b725ae77Skettenis (*current_target.to_has_exited) (pid,wait_status,exit_status) 774b725ae77Skettenis 775b725ae77Skettenis /* The debugger has completed a blocking wait() call. There is now 776b725ae77Skettenis some process event that must be processed. This function should 777b725ae77Skettenis be defined by those targets that require the debugger to perform 778b725ae77Skettenis cleanup or internal state changes in response to the process event. */ 779b725ae77Skettenis 780e93f7393Sniklas /* The inferior process has died. Do what is right. */ 781e93f7393Sniklas 782e93f7393Sniklas #define target_mourn_inferior() \ 783e93f7393Sniklas (*current_target.to_mourn_inferior) () 784e93f7393Sniklas 785e93f7393Sniklas /* Does target have enough data to do a run or attach command? */ 786e93f7393Sniklas 787e93f7393Sniklas #define target_can_run(t) \ 788e93f7393Sniklas ((t)->to_can_run) () 789e93f7393Sniklas 790e93f7393Sniklas /* post process changes to signal handling in the inferior. */ 791e93f7393Sniklas 792b725ae77Skettenis #define target_notice_signals(ptid) \ 793b725ae77Skettenis (*current_target.to_notice_signals) (ptid) 794e93f7393Sniklas 795e93f7393Sniklas /* Check to see if a thread is still alive. */ 796e93f7393Sniklas 797b725ae77Skettenis #define target_thread_alive(ptid) \ 798b725ae77Skettenis (*current_target.to_thread_alive) (ptid) 799e93f7393Sniklas 800b725ae77Skettenis /* Query for new threads and add them to the thread list. */ 801e93f7393Sniklas 802b725ae77Skettenis #define target_find_new_threads() \ 803b725ae77Skettenis (*current_target.to_find_new_threads) (); \ 804e93f7393Sniklas 805b725ae77Skettenis /* Make target stop in a continuable fashion. (For instance, under 806b725ae77Skettenis Unix, this should act like SIGSTOP). This function is normally 807b725ae77Skettenis used by GUIs to implement a stop button. */ 808e93f7393Sniklas 809b725ae77Skettenis #define target_stop current_target.to_stop 810b725ae77Skettenis 811b725ae77Skettenis /* Send the specified COMMAND to the target's monitor 812b725ae77Skettenis (shell,interpreter) for execution. The result of the query is 813b725ae77Skettenis placed in OUTBUF. */ 814b725ae77Skettenis 815b725ae77Skettenis #define target_rcmd(command, outbuf) \ 816b725ae77Skettenis (*current_target.to_rcmd) (command, outbuf) 817b725ae77Skettenis 818b725ae77Skettenis 819b725ae77Skettenis /* Get the symbol information for a breakpointable routine called when 820b725ae77Skettenis an exception event occurs. 821b725ae77Skettenis Intended mainly for C++, and for those 822b725ae77Skettenis platforms/implementations where such a callback mechanism is available, 823b725ae77Skettenis e.g. HP-UX with ANSI C++ (aCC). Some compilers (e.g. g++) support 824b725ae77Skettenis different mechanisms for debugging exceptions. */ 825b725ae77Skettenis 826b725ae77Skettenis #define target_enable_exception_callback(kind, enable) \ 827b725ae77Skettenis (*current_target.to_enable_exception_callback) (kind, enable) 828b725ae77Skettenis 829b725ae77Skettenis /* Get the current exception event kind -- throw or catch, etc. */ 830b725ae77Skettenis 831b725ae77Skettenis #define target_get_current_exception_event() \ 832b725ae77Skettenis (*current_target.to_get_current_exception_event) () 833e93f7393Sniklas 834e93f7393Sniklas /* Does the target include all of memory, or only part of it? This 835e93f7393Sniklas determines whether we look up the target chain for other parts of 836e93f7393Sniklas memory if this target can't satisfy a request. */ 837e93f7393Sniklas 838e93f7393Sniklas #define target_has_all_memory \ 839e93f7393Sniklas (current_target.to_has_all_memory) 840e93f7393Sniklas 841e93f7393Sniklas /* Does the target include memory? (Dummy targets don't.) */ 842e93f7393Sniklas 843e93f7393Sniklas #define target_has_memory \ 844e93f7393Sniklas (current_target.to_has_memory) 845e93f7393Sniklas 846e93f7393Sniklas /* Does the target have a stack? (Exec files don't, VxWorks doesn't, until 847e93f7393Sniklas we start a process.) */ 848e93f7393Sniklas 849e93f7393Sniklas #define target_has_stack \ 850e93f7393Sniklas (current_target.to_has_stack) 851e93f7393Sniklas 852e93f7393Sniklas /* Does the target have registers? (Exec files don't.) */ 853e93f7393Sniklas 854e93f7393Sniklas #define target_has_registers \ 855e93f7393Sniklas (current_target.to_has_registers) 856e93f7393Sniklas 857e93f7393Sniklas /* Does the target have execution? Can we make it jump (through 858e93f7393Sniklas hoops), or pop its stack a few times? FIXME: If this is to work that 859e93f7393Sniklas way, it needs to check whether an inferior actually exists. 860e93f7393Sniklas remote-udi.c and probably other targets can be the current target 861e93f7393Sniklas when the inferior doesn't actually exist at the moment. Right now 862e93f7393Sniklas this just tells us whether this target is *capable* of execution. */ 863e93f7393Sniklas 864e93f7393Sniklas #define target_has_execution \ 865e93f7393Sniklas (current_target.to_has_execution) 866e93f7393Sniklas 867b725ae77Skettenis /* Can the target support the debugger control of thread execution? 868b725ae77Skettenis a) Can it lock the thread scheduler? 869b725ae77Skettenis b) Can it switch the currently running thread? */ 870b725ae77Skettenis 871b725ae77Skettenis #define target_can_lock_scheduler \ 872b725ae77Skettenis (current_target.to_has_thread_control & tc_schedlock) 873b725ae77Skettenis 874b725ae77Skettenis #define target_can_switch_threads \ 875b725ae77Skettenis (current_target.to_has_thread_control & tc_switch) 876b725ae77Skettenis 877b725ae77Skettenis /* Can the target support asynchronous execution? */ 878b725ae77Skettenis #define target_can_async_p() (current_target.to_can_async_p ()) 879b725ae77Skettenis 880b725ae77Skettenis /* Is the target in asynchronous execution mode? */ 881b725ae77Skettenis #define target_is_async_p() (current_target.to_is_async_p()) 882b725ae77Skettenis 883b725ae77Skettenis /* Put the target in async mode with the specified callback function. */ 884b725ae77Skettenis #define target_async(CALLBACK,CONTEXT) \ 885b725ae77Skettenis (current_target.to_async((CALLBACK), (CONTEXT))) 886b725ae77Skettenis 887b725ae77Skettenis /* This is to be used ONLY within call_function_by_hand(). It provides 888b725ae77Skettenis a workaround, to have inferior function calls done in sychronous 889b725ae77Skettenis mode, even though the target is asynchronous. After 890b725ae77Skettenis target_async_mask(0) is called, calls to target_can_async_p() will 891b725ae77Skettenis return FALSE , so that target_resume() will not try to start the 892b725ae77Skettenis target asynchronously. After the inferior stops, we IMMEDIATELY 893b725ae77Skettenis restore the previous nature of the target, by calling 894b725ae77Skettenis target_async_mask(1). After that, target_can_async_p() will return 895b725ae77Skettenis TRUE. ANY OTHER USE OF THIS FEATURE IS DEPRECATED. 896b725ae77Skettenis 897b725ae77Skettenis FIXME ezannoni 1999-12-13: we won't need this once we move 898b725ae77Skettenis the turning async on and off to the single execution commands, 899b725ae77Skettenis from where it is done currently, in remote_resume(). */ 900b725ae77Skettenis 901b725ae77Skettenis #define target_async_mask_value \ 902b725ae77Skettenis (current_target.to_async_mask_value) 903b725ae77Skettenis 904b725ae77Skettenis extern int target_async_mask (int mask); 905b725ae77Skettenis 906b725ae77Skettenis extern void target_link (char *, CORE_ADDR *); 907e93f7393Sniklas 908e93f7393Sniklas /* Converts a process id to a string. Usually, the string just contains 909e93f7393Sniklas `process xyz', but on some systems it may contain 910e93f7393Sniklas `process xyz thread abc'. */ 911e93f7393Sniklas 912b725ae77Skettenis #undef target_pid_to_str 913b725ae77Skettenis #define target_pid_to_str(PID) current_target.to_pid_to_str (PID) 914b725ae77Skettenis 915b725ae77Skettenis #ifndef target_tid_to_str 916b725ae77Skettenis #define target_tid_to_str(PID) \ 917b725ae77Skettenis target_pid_to_str (PID) 918b725ae77Skettenis extern char *normal_pid_to_str (ptid_t ptid); 919e93f7393Sniklas #endif 920e93f7393Sniklas 921b725ae77Skettenis /* Return a short string describing extra information about PID, 922b725ae77Skettenis e.g. "sleeping", "runnable", "running on LWP 3". Null return value 923b725ae77Skettenis is okay. */ 924b725ae77Skettenis 925b725ae77Skettenis #define target_extra_thread_info(TP) \ 926b725ae77Skettenis (current_target.to_extra_thread_info (TP)) 927b725ae77Skettenis 928b725ae77Skettenis /* 929b725ae77Skettenis * New Objfile Event Hook: 930b725ae77Skettenis * 931b725ae77Skettenis * Sometimes a GDB component wants to get notified whenever a new 932b725ae77Skettenis * objfile is loaded. Mainly this is used by thread-debugging 933b725ae77Skettenis * implementations that need to know when symbols for the target 934b725ae77Skettenis * thread implemenation are available. 935b725ae77Skettenis * 936b725ae77Skettenis * The old way of doing this is to define a macro 'target_new_objfile' 937b725ae77Skettenis * that points to the function that you want to be called on every 938b725ae77Skettenis * objfile/shlib load. 939b725ae77Skettenis 940*63addd46Skettenis The new way is to grab the function pointer, 941*63addd46Skettenis 'deprecated_target_new_objfile_hook', and point it to the function 942*63addd46Skettenis that you want to be called on every objfile/shlib load. 943*63addd46Skettenis 944*63addd46Skettenis If multiple clients are willing to be cooperative, they can each 945*63addd46Skettenis save a pointer to the previous value of 946*63addd46Skettenis deprecated_target_new_objfile_hook before modifying it, and arrange 947*63addd46Skettenis for their function to call the previous function in the chain. In 948*63addd46Skettenis that way, multiple clients can receive this notification (something 949*63addd46Skettenis like with signal handlers). */ 950*63addd46Skettenis 951*63addd46Skettenis extern void (*deprecated_target_new_objfile_hook) (struct objfile *); 952b725ae77Skettenis 953b725ae77Skettenis #ifndef target_pid_or_tid_to_str 954b725ae77Skettenis #define target_pid_or_tid_to_str(ID) \ 955b725ae77Skettenis target_pid_to_str (ID) 956e93f7393Sniklas #endif 957e93f7393Sniklas 958b725ae77Skettenis /* Attempts to find the pathname of the executable file 959b725ae77Skettenis that was run to create a specified process. 960e93f7393Sniklas 961b725ae77Skettenis The process PID must be stopped when this operation is used. 962e93f7393Sniklas 963b725ae77Skettenis If the executable file cannot be determined, NULL is returned. 964b725ae77Skettenis 965b725ae77Skettenis Else, a pointer to a character string containing the pathname 966b725ae77Skettenis is returned. This string should be copied into a buffer by 967b725ae77Skettenis the client if the string will not be immediately used, or if 968b725ae77Skettenis it must persist. */ 969b725ae77Skettenis 970b725ae77Skettenis #define target_pid_to_exec_file(pid) \ 971b725ae77Skettenis (current_target.to_pid_to_exec_file) (pid) 972b725ae77Skettenis 973b725ae77Skettenis /* 974b725ae77Skettenis * Iterator function for target memory regions. 975b725ae77Skettenis * Calls a callback function once for each memory region 'mapped' 976b725ae77Skettenis * in the child process. Defined as a simple macro rather than 977b725ae77Skettenis * as a function macro so that it can be tested for nullity. 978b725ae77Skettenis */ 979b725ae77Skettenis 980b725ae77Skettenis #define target_find_memory_regions(FUNC, DATA) \ 981b725ae77Skettenis (current_target.to_find_memory_regions) (FUNC, DATA) 982b725ae77Skettenis 983b725ae77Skettenis /* 984b725ae77Skettenis * Compose corefile .note section. 985b725ae77Skettenis */ 986b725ae77Skettenis 987b725ae77Skettenis #define target_make_corefile_notes(BFD, SIZE_P) \ 988b725ae77Skettenis (current_target.to_make_corefile_notes) (BFD, SIZE_P) 989b725ae77Skettenis 990b725ae77Skettenis /* Thread-local values. */ 991b725ae77Skettenis #define target_get_thread_local_address \ 992b725ae77Skettenis (current_target.to_get_thread_local_address) 993b725ae77Skettenis #define target_get_thread_local_address_p() \ 994b725ae77Skettenis (target_get_thread_local_address != NULL) 995b725ae77Skettenis 996b725ae77Skettenis /* Hook to call target dependent code just after inferior target process has 997e93f7393Sniklas started. */ 998e93f7393Sniklas 999e93f7393Sniklas #ifndef TARGET_CREATE_INFERIOR_HOOK 1000e93f7393Sniklas #define TARGET_CREATE_INFERIOR_HOOK(PID) 1001e93f7393Sniklas #endif 1002e93f7393Sniklas 1003e93f7393Sniklas /* Hardware watchpoint interfaces. */ 1004e93f7393Sniklas 1005e93f7393Sniklas /* Returns non-zero if we were stopped by a hardware watchpoint (memory read or 1006e93f7393Sniklas write). */ 1007e93f7393Sniklas 1008e93f7393Sniklas #ifndef STOPPED_BY_WATCHPOINT 1009b725ae77Skettenis #define STOPPED_BY_WATCHPOINT(w) \ 1010b725ae77Skettenis (*current_target.to_stopped_by_watchpoint) () 1011e93f7393Sniklas #endif 1012e93f7393Sniklas 1013b725ae77Skettenis /* Non-zero if we have continuable watchpoints */ 1014e93f7393Sniklas 1015b725ae77Skettenis #ifndef HAVE_CONTINUABLE_WATCHPOINT 1016b725ae77Skettenis #define HAVE_CONTINUABLE_WATCHPOINT \ 1017b725ae77Skettenis (current_target.to_have_continuable_watchpoint) 1018b725ae77Skettenis #endif 1019b725ae77Skettenis 1020b725ae77Skettenis /* HP-UX supplies these operations, which respectively disable and enable 1021b725ae77Skettenis the memory page-protections that are used to implement hardware watchpoints 1022b725ae77Skettenis on that platform. See wait_for_inferior's use of these. */ 1023b725ae77Skettenis 1024b725ae77Skettenis #if !defined(TARGET_DISABLE_HW_WATCHPOINTS) 1025b725ae77Skettenis #define TARGET_DISABLE_HW_WATCHPOINTS(pid) 1026b725ae77Skettenis #endif 1027b725ae77Skettenis 1028b725ae77Skettenis #if !defined(TARGET_ENABLE_HW_WATCHPOINTS) 1029b725ae77Skettenis #define TARGET_ENABLE_HW_WATCHPOINTS(pid) 1030b725ae77Skettenis #endif 1031b725ae77Skettenis 1032b725ae77Skettenis /* Provide defaults for hardware watchpoint functions. */ 1033b725ae77Skettenis 1034b725ae77Skettenis /* If the *_hw_beakpoint functions have not been defined 1035b725ae77Skettenis elsewhere use the definitions in the target vector. */ 1036e93f7393Sniklas 1037e93f7393Sniklas /* Returns non-zero if we can set a hardware watchpoint of type TYPE. TYPE is 1038e93f7393Sniklas one of bp_hardware_watchpoint, bp_read_watchpoint, bp_write_watchpoint, or 1039e93f7393Sniklas bp_hardware_breakpoint. CNT is the number of such watchpoints used so far 1040e93f7393Sniklas (including this one?). OTHERTYPE is who knows what... */ 1041e93f7393Sniklas 1042b725ae77Skettenis #ifndef TARGET_CAN_USE_HARDWARE_WATCHPOINT 1043b725ae77Skettenis #define TARGET_CAN_USE_HARDWARE_WATCHPOINT(TYPE,CNT,OTHERTYPE) \ 1044b725ae77Skettenis (*current_target.to_can_use_hw_breakpoint) (TYPE, CNT, OTHERTYPE); 1045b725ae77Skettenis #endif 1046e93f7393Sniklas 1047b725ae77Skettenis #if !defined(TARGET_REGION_SIZE_OK_FOR_HW_WATCHPOINT) 1048b725ae77Skettenis #define TARGET_REGION_SIZE_OK_FOR_HW_WATCHPOINT(byte_count) \ 1049b725ae77Skettenis (*current_target.to_region_size_ok_for_hw_watchpoint) (byte_count) 1050b725ae77Skettenis #endif 1051e93f7393Sniklas 1052e93f7393Sniklas 1053b725ae77Skettenis /* Set/clear a hardware watchpoint starting at ADDR, for LEN bytes. TYPE is 0 1054b725ae77Skettenis for write, 1 for read, and 2 for read/write accesses. Returns 0 for 1055b725ae77Skettenis success, non-zero for failure. */ 1056b725ae77Skettenis 1057b725ae77Skettenis #ifndef target_insert_watchpoint 1058b725ae77Skettenis #define target_insert_watchpoint(addr, len, type) \ 1059b725ae77Skettenis (*current_target.to_insert_watchpoint) (addr, len, type) 1060b725ae77Skettenis 1061b725ae77Skettenis #define target_remove_watchpoint(addr, len, type) \ 1062b725ae77Skettenis (*current_target.to_remove_watchpoint) (addr, len, type) 1063b725ae77Skettenis #endif 1064e93f7393Sniklas 1065e93f7393Sniklas #ifndef target_insert_hw_breakpoint 1066b725ae77Skettenis #define target_insert_hw_breakpoint(addr, save) \ 1067b725ae77Skettenis (*current_target.to_insert_hw_breakpoint) (addr, save) 1068b725ae77Skettenis 1069b725ae77Skettenis #define target_remove_hw_breakpoint(addr, save) \ 1070b725ae77Skettenis (*current_target.to_remove_hw_breakpoint) (addr, save) 1071e93f7393Sniklas #endif 1072e93f7393Sniklas 1073*63addd46Skettenis extern int target_stopped_data_address_p (struct target_ops *); 1074*63addd46Skettenis 1075e93f7393Sniklas #ifndef target_stopped_data_address 1076*63addd46Skettenis #define target_stopped_data_address(target, x) \ 1077*63addd46Skettenis (*target.to_stopped_data_address) (target, x) 1078*63addd46Skettenis #else 1079*63addd46Skettenis /* Horrible hack to get around existing macros :-(. */ 1080*63addd46Skettenis #define target_stopped_data_address_p(CURRENT_TARGET) (1) 1081b725ae77Skettenis #endif 1082b725ae77Skettenis 1083b725ae77Skettenis /* This will only be defined by a target that supports catching vfork events, 1084b725ae77Skettenis such as HP-UX. 1085b725ae77Skettenis 1086b725ae77Skettenis On some targets (such as HP-UX 10.20 and earlier), resuming a newly vforked 1087b725ae77Skettenis child process after it has exec'd, causes the parent process to resume as 1088b725ae77Skettenis well. To prevent the parent from running spontaneously, such targets should 1089b725ae77Skettenis define this to a function that prevents that from happening. */ 1090b725ae77Skettenis #if !defined(ENSURE_VFORKING_PARENT_REMAINS_STOPPED) 1091b725ae77Skettenis #define ENSURE_VFORKING_PARENT_REMAINS_STOPPED(PID) (0) 1092b725ae77Skettenis #endif 1093b725ae77Skettenis 1094b725ae77Skettenis /* This will only be defined by a target that supports catching vfork events, 1095b725ae77Skettenis such as HP-UX. 1096b725ae77Skettenis 1097b725ae77Skettenis On some targets (such as HP-UX 10.20 and earlier), a newly vforked child 1098b725ae77Skettenis process must be resumed when it delivers its exec event, before the parent 1099b725ae77Skettenis vfork event will be delivered to us. */ 1100b725ae77Skettenis 1101b725ae77Skettenis #if !defined(RESUME_EXECD_VFORKING_CHILD_TO_GET_PARENT_VFORK) 1102b725ae77Skettenis #define RESUME_EXECD_VFORKING_CHILD_TO_GET_PARENT_VFORK() (0) 1103e93f7393Sniklas #endif 1104e93f7393Sniklas 1105e93f7393Sniklas /* Routines for maintenance of the target structures... 1106e93f7393Sniklas 1107e93f7393Sniklas add_target: Add a target to the list of all possible targets. 1108e93f7393Sniklas 1109e93f7393Sniklas push_target: Make this target the top of the stack of currently used 1110e93f7393Sniklas targets, within its particular stratum of the stack. Result 1111e93f7393Sniklas is 0 if now atop the stack, nonzero if not on top (maybe 1112e93f7393Sniklas should warn user). 1113e93f7393Sniklas 1114e93f7393Sniklas unpush_target: Remove this from the stack of currently used targets, 1115e93f7393Sniklas no matter where it is on the list. Returns 0 if no 1116e93f7393Sniklas change, 1 if removed from stack. 1117e93f7393Sniklas 1118e93f7393Sniklas pop_target: Remove the top thing on the stack of current targets. */ 1119e93f7393Sniklas 1120b725ae77Skettenis extern void add_target (struct target_ops *); 1121e93f7393Sniklas 1122b725ae77Skettenis extern int push_target (struct target_ops *); 1123e93f7393Sniklas 1124b725ae77Skettenis extern int unpush_target (struct target_ops *); 1125e93f7393Sniklas 1126b725ae77Skettenis extern void target_preopen (int); 1127e93f7393Sniklas 1128b725ae77Skettenis extern void pop_target (void); 1129e93f7393Sniklas 1130e93f7393Sniklas /* Struct section_table maps address ranges to file sections. It is 1131e93f7393Sniklas mostly used with BFD files, but can be used without (e.g. for handling 1132e93f7393Sniklas raw disks, or files not in formats handled by BFD). */ 1133e93f7393Sniklas 1134b725ae77Skettenis struct section_table 1135b725ae77Skettenis { 1136e93f7393Sniklas CORE_ADDR addr; /* Lowest address in section */ 1137e93f7393Sniklas CORE_ADDR endaddr; /* 1+highest address in section */ 1138e93f7393Sniklas 1139b725ae77Skettenis struct bfd_section *the_bfd_section; 1140e93f7393Sniklas 1141e93f7393Sniklas bfd *bfd; /* BFD file pointer */ 1142e93f7393Sniklas }; 1143e93f7393Sniklas 1144b725ae77Skettenis /* Return the "section" containing the specified address. */ 1145b725ae77Skettenis struct section_table *target_section_by_addr (struct target_ops *target, 1146b725ae77Skettenis CORE_ADDR addr); 1147e93f7393Sniklas 1148e93f7393Sniklas 1149e93f7393Sniklas /* From mem-break.c */ 1150e93f7393Sniklas 1151b725ae77Skettenis extern int memory_remove_breakpoint (CORE_ADDR, char *); 1152e93f7393Sniklas 1153b725ae77Skettenis extern int memory_insert_breakpoint (CORE_ADDR, char *); 1154b725ae77Skettenis 1155b725ae77Skettenis extern int default_memory_remove_breakpoint (CORE_ADDR, char *); 1156b725ae77Skettenis 1157b725ae77Skettenis extern int default_memory_insert_breakpoint (CORE_ADDR, char *); 1158b725ae77Skettenis 1159e93f7393Sniklas 1160e93f7393Sniklas /* From target.c */ 1161e93f7393Sniklas 1162b725ae77Skettenis extern void initialize_targets (void); 1163e93f7393Sniklas 1164b725ae77Skettenis extern void noprocess (void); 1165e93f7393Sniklas 1166b725ae77Skettenis extern void find_default_attach (char *, int); 1167e93f7393Sniklas 1168*63addd46Skettenis extern void find_default_create_inferior (char *, char *, char **, int); 1169e93f7393Sniklas 1170b725ae77Skettenis extern struct target_ops *find_run_target (void); 1171b725ae77Skettenis 1172b725ae77Skettenis extern struct target_ops *find_core_target (void); 1173b725ae77Skettenis 1174b725ae77Skettenis extern struct target_ops *find_target_beneath (struct target_ops *); 1175b725ae77Skettenis 1176b725ae77Skettenis extern int target_resize_to_sections (struct target_ops *target, 1177b725ae77Skettenis int num_added); 1178b725ae77Skettenis 1179b725ae77Skettenis extern void remove_target_sections (bfd *abfd); 1180b725ae77Skettenis 1181e93f7393Sniklas 1182e93f7393Sniklas /* Stuff that should be shared among the various remote targets. */ 1183e93f7393Sniklas 1184e93f7393Sniklas /* Debugging level. 0 is off, and non-zero values mean to print some debug 1185e93f7393Sniklas information (higher values, more information). */ 1186e93f7393Sniklas extern int remote_debug; 1187e93f7393Sniklas 1188e93f7393Sniklas /* Speed in bits per second, or -1 which means don't mess with the speed. */ 1189e93f7393Sniklas extern int baud_rate; 1190e93f7393Sniklas /* Timeout limit for response from target. */ 1191e93f7393Sniklas extern int remote_timeout; 1192b725ae77Skettenis 1193e93f7393Sniklas 1194e93f7393Sniklas /* Functions for helping to write a native target. */ 1195e93f7393Sniklas 1196e93f7393Sniklas /* This is for native targets which use a unix/POSIX-style waitstatus. */ 1197b725ae77Skettenis extern void store_waitstatus (struct target_waitstatus *, int); 1198e93f7393Sniklas 1199b725ae77Skettenis /* Predicate to target_signal_to_host(). Return non-zero if the enum 1200b725ae77Skettenis targ_signal SIGNO has an equivalent ``host'' representation. */ 1201b725ae77Skettenis /* FIXME: cagney/1999-11-22: The name below was chosen in preference 1202b725ae77Skettenis to the shorter target_signal_p() because it is far less ambigious. 1203b725ae77Skettenis In this context ``target_signal'' refers to GDB's internal 1204b725ae77Skettenis representation of the target's set of signals while ``host signal'' 1205b725ae77Skettenis refers to the target operating system's signal. Confused? */ 1206b725ae77Skettenis 1207b725ae77Skettenis extern int target_signal_to_host_p (enum target_signal signo); 1208b725ae77Skettenis 1209b725ae77Skettenis /* Convert between host signal numbers and enum target_signal's. 1210b725ae77Skettenis target_signal_to_host() returns 0 and prints a warning() on GDB's 1211b725ae77Skettenis console if SIGNO has no equivalent host representation. */ 1212b725ae77Skettenis /* FIXME: cagney/1999-11-22: Here ``host'' is used incorrectly, it is 1213b725ae77Skettenis refering to the target operating system's signal numbering. 1214b725ae77Skettenis Similarly, ``enum target_signal'' is named incorrectly, ``enum 1215b725ae77Skettenis gdb_signal'' would probably be better as it is refering to GDB's 1216b725ae77Skettenis internal representation of a target operating system's signal. */ 1217b725ae77Skettenis 1218b725ae77Skettenis extern enum target_signal target_signal_from_host (int); 1219b725ae77Skettenis extern int target_signal_to_host (enum target_signal); 1220e93f7393Sniklas 1221e93f7393Sniklas /* Convert from a number used in a GDB command to an enum target_signal. */ 1222b725ae77Skettenis extern enum target_signal target_signal_from_command (int); 1223e93f7393Sniklas 1224b725ae77Skettenis /* Any target can call this to switch to remote protocol (in remote.c). */ 1225b725ae77Skettenis extern void push_remote_target (char *name, int from_tty); 1226e93f7393Sniklas 1227e93f7393Sniklas /* Imported from machine dependent code */ 1228e93f7393Sniklas 1229b725ae77Skettenis /* Blank target vector entries are initialized to target_ignore. */ 1230b725ae77Skettenis void target_ignore (void); 1231e93f7393Sniklas 1232*63addd46Skettenis extern struct target_ops deprecated_child_ops; 1233*63addd46Skettenis 1234e93f7393Sniklas #endif /* !defined (TARGET_H) */ 1235