/* Interface between GDB and target environments, including files and processes
Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
+ 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
Free Software Foundation, Inc.
Contributed by Cygnus Support. Written by John Gilmore.
#include "dcache.h"
#include "memattr.h"
#include "vec.h"
+#include "gdb_signals.h"
enum strata
{
value;
};
+/* Return a pretty printed form of target_waitstatus.
+ Space for the result is malloc'd, caller must free. */
+extern char *target_waitstatus_to_string (const struct target_waitstatus *);
+
/* Possible types of events that the inferior handler will have to
deal with. */
enum inferior_event_type
'step n' like commands. */
INF_EXEC_CONTINUE
};
-
-/* Return the string for a signal. */
-extern char *target_signal_to_string (enum target_signal);
-
-/* Return the name (SIGHUP, etc.) for a signal. */
-extern char *target_signal_to_name (enum target_signal);
-
-/* Given a name (SIGHUP, etc.), return its signal. */
-enum target_signal target_signal_from_name (char *);
\f
/* Target objects which can be transfered using target_read,
target_write, et cetera. */
TARGET_OBJECT_LIBRARIES,
/* Get OS specific data. The ANNEX specifies the type (running
processes, etc.). */
- TARGET_OBJECT_OSDATA
+ TARGET_OBJECT_OSDATA,
+ /* Extra signal info. Usually the contents of `siginfo_t' on unix
+ platforms. */
+ TARGET_OBJECT_SIGNAL_INFO,
/* Possible future objects: TARGET_OBJECT_FILE, ... */
};
void (*to_post_attach) (int);
void (*to_detach) (struct target_ops *ops, char *, int);
void (*to_disconnect) (struct target_ops *, char *, int);
- void (*to_resume) (ptid_t, int, enum target_signal);
- ptid_t (*to_wait) (ptid_t, struct target_waitstatus *);
- void (*to_fetch_registers) (struct regcache *, int);
- void (*to_store_registers) (struct regcache *, int);
+ void (*to_resume) (struct target_ops *, ptid_t, int, enum target_signal);
+ ptid_t (*to_wait) (struct target_ops *,
+ ptid_t, struct target_waitstatus *);
+ void (*to_fetch_registers) (struct target_ops *, struct regcache *, int);
+ void (*to_store_registers) (struct target_ops *, struct regcache *, int);
void (*to_prepare_to_store) (struct regcache *);
/* Transfer LEN bytes of memory between GDB address MYADDR and
void (*to_terminal_ours) (void);
void (*to_terminal_save_ours) (void);
void (*to_terminal_info) (char *, int);
- void (*to_kill) (void);
+ void (*to_kill) (struct target_ops *);
void (*to_load) (char *, int);
int (*to_lookup_symbol) (char *, CORE_ADDR *);
void (*to_create_inferior) (struct target_ops *,
void (*to_mourn_inferior) (struct target_ops *);
int (*to_can_run) (void);
void (*to_notice_signals) (ptid_t ptid);
- int (*to_thread_alive) (ptid_t ptid);
- void (*to_find_new_threads) (void);
- char *(*to_pid_to_str) (ptid_t);
+ int (*to_thread_alive) (struct target_ops *, ptid_t ptid);
+ void (*to_find_new_threads) (struct target_ops *);
+ char *(*to_pid_to_str) (struct target_ops *, ptid_t);
char *(*to_extra_thread_info) (struct thread_info *);
void (*to_stop) (ptid_t);
void (*to_rcmd) (char *command, struct ui_file *output);
or executable file given by OBJFILE. If that block of
thread-local storage hasn't been allocated yet, this function
may return an error. */
- CORE_ADDR (*to_get_thread_local_address) (ptid_t ptid,
+ CORE_ADDR (*to_get_thread_local_address) (struct target_ops *ops,
+ ptid_t ptid,
CORE_ADDR load_module_addr,
CORE_ADDR offset);
CORE_ADDR *found_addrp);
/* Can target execute in reverse? */
- int (*to_can_execute_reverse) ();
+ int (*to_can_execute_reverse) (void);
/* Does this target support debugging multiple processes
simultaneously? */
to the prompt with a debugging target but without the frame cache,
stop_pc, etc., set up. */
-#define target_wait(ptid, status) \
- (*current_target.to_wait) (ptid, status)
+extern ptid_t target_wait (ptid_t ptid, struct target_waitstatus *status);
/* Fetch at least register REGNO, or all regs if regno == -1. No result. */
-#define target_fetch_registers(regcache, regno) \
- (*current_target.to_fetch_registers) (regcache, regno)
+extern void target_fetch_registers (struct regcache *regcache, int regno);
/* Store at least register REGNO, or all regs if REGNO == -1.
It can store as many registers as it wants to, so target_prepare_to_store
must have been previously called. Calls error() if there are problems. */
-#define target_store_registers(regcache, regs) \
- (*current_target.to_store_registers) (regcache, regs)
+extern void target_store_registers (struct regcache *regcache, int regs);
/* Get ready to modify the registers array. On machines which store
individual registers, this doesn't need to do anything. On machines
/* Kill the inferior process. Make it go away. */
-#define target_kill() \
- (*current_target.to_kill) ()
+extern void target_kill (void);
/* Load an executable file into the target process. This is expected
to not only bring new code into the target process, but also to
/* Check to see if a thread is still alive. */
-#define target_thread_alive(ptid) \
- (*current_target.to_thread_alive) (ptid)
+extern int target_thread_alive (ptid_t ptid);
/* Query for new threads and add them to the thread list. */
-#define target_find_new_threads() \
- (*current_target.to_find_new_threads) ()
+extern void target_find_new_threads (void);
/* Make target stop in a continuable fashion. (For instance, under
Unix, this should act like SIGSTOP). This function is normally
`process xyz', but on some systems it may contain
`process xyz thread abc'. */
-#undef target_pid_to_str
-#define target_pid_to_str(PID) current_target.to_pid_to_str (PID)
+extern char *target_pid_to_str (ptid_t ptid);
-#ifndef target_tid_to_str
-#define target_tid_to_str(PID) \
- target_pid_to_str (PID)
extern char *normal_pid_to_str (ptid_t ptid);
-#endif
/* Return a short string describing extra information about PID,
e.g. "sleeping", "runnable", "running on LWP 3". Null return value
#define target_make_corefile_notes(BFD, SIZE_P) \
(current_target.to_make_corefile_notes) (BFD, SIZE_P)
-/* Thread-local values. */
-#define target_get_thread_local_address \
- (current_target.to_get_thread_local_address)
-#define target_get_thread_local_address_p() \
- (target_get_thread_local_address != NULL)
-
-
/* Hardware watchpoint interfaces. */
/* Returns non-zero if we were stopped by a hardware watchpoint (memory read or
(*current_target.to_remove_hw_breakpoint) (bp_tgt)
#endif
-extern int target_stopped_data_address_p (struct target_ops *);
-
#ifndef target_stopped_data_address
#define target_stopped_data_address(target, x) \
(*target.to_stopped_data_address) (target, x)
-#else
-/* Horrible hack to get around existing macros :-(. */
-#define target_stopped_data_address_p(CURRENT_TARGET) (1)
#endif
#define target_watchpoint_addr_within_range(target, addr, start, length) \
extern void initialize_targets (void);
-extern void noprocess (void);
+extern NORETURN void noprocess (void) ATTR_NORETURN;
extern void target_require_runnable (void);
/* This is for native targets which use a unix/POSIX-style waitstatus. */
extern void store_waitstatus (struct target_waitstatus *, int);
-/* Predicate to target_signal_to_host(). Return non-zero if the enum
- targ_signal SIGNO has an equivalent ``host'' representation. */
-/* FIXME: cagney/1999-11-22: The name below was chosen in preference
- to the shorter target_signal_p() because it is far less ambigious.
- In this context ``target_signal'' refers to GDB's internal
- representation of the target's set of signals while ``host signal''
- refers to the target operating system's signal. Confused? */
-
-extern int target_signal_to_host_p (enum target_signal signo);
-
-/* Convert between host signal numbers and enum target_signal's.
- target_signal_to_host() returns 0 and prints a warning() on GDB's
- console if SIGNO has no equivalent host representation. */
-/* FIXME: cagney/1999-11-22: Here ``host'' is used incorrectly, it is
- refering to the target operating system's signal numbering.
- Similarly, ``enum target_signal'' is named incorrectly, ``enum
- gdb_signal'' would probably be better as it is refering to GDB's
- internal representation of a target operating system's signal. */
-
-extern enum target_signal target_signal_from_host (int);
-extern int target_signal_to_host (enum target_signal);
-
+/* These are in common/signals.c, but they're only used by gdb. */
extern enum target_signal default_target_signal_from_host (struct gdbarch *,
int);
extern int default_target_signal_to_host (struct gdbarch *,
/* Convert from a number used in a GDB command to an enum target_signal. */
extern enum target_signal target_signal_from_command (int);
+/* End of files in common/signals.c. */
/* Set the show memory breakpoints mode to show, and installs a cleanup
to restore it back to the current value. */