to xfree everything (including the "struct target_ops"). */
void (*to_xclose) (struct target_ops *targ);
void (*to_close) (struct target_ops *);
- void (*to_attach) (struct target_ops *ops, char *, int)
- TARGET_DEFAULT_FUNC (find_default_attach);
+ /* Attaches to a process on the target side. Arguments are as
+ passed to the `attach' command by the user. This routine can
+ be called when the target is not on the target-stack, if the
+ target_can_run routine returns 1; in that case, it must push
+ itself onto the stack. Upon exit, the target should be ready
+ for normal operations, and should be ready to deliver the
+ status of the process immediately (without waiting) to an
+ upcoming target_wait call. */
+ void (*to_attach) (struct target_ops *ops, const char *, int);
void (*to_post_attach) (struct target_ops *, int)
TARGET_DEFAULT_IGNORE ();
void (*to_detach) (struct target_ops *ops, const char *, int)
TARGET_DEFAULT_IGNORE ();
- void (*to_disconnect) (struct target_ops *, char *, int)
+ void (*to_disconnect) (struct target_ops *, const char *, int)
TARGET_DEFAULT_NORETURN (tcomplain ());
void (*to_resume) (struct target_ops *, ptid_t, int, enum gdb_signal)
TARGET_DEFAULT_NORETURN (noprocess ());
TARGET_DEFAULT_FUNC (default_terminal_info);
void (*to_kill) (struct target_ops *)
TARGET_DEFAULT_NORETURN (noprocess ());
- void (*to_load) (struct target_ops *, char *, int)
+ void (*to_load) (struct target_ops *, const char *, int)
TARGET_DEFAULT_NORETURN (tcomplain ());
+ /* Start an inferior process and set inferior_ptid to its pid.
+ EXEC_FILE is the file to run.
+ ALLARGS is a string containing the arguments to the program.
+ ENV is the environment vector to pass. Errors reported with error().
+ On VxWorks and various standalone systems, we ignore exec_file. */
void (*to_create_inferior) (struct target_ops *,
char *, char *, char **, int);
void (*to_post_startup_inferior) (struct target_ops *, ptid_t)
TARGET_DEFAULT_RETURN (0);
void (*to_mourn_inferior) (struct target_ops *)
TARGET_DEFAULT_FUNC (default_mourn_inferior);
+ /* Note that to_can_run is special and can be invoked on an
+ unpushed target. Targets defining this method must also define
+ to_can_async_p and to_supports_non_stop. */
int (*to_can_run) (struct target_ops *)
TARGET_DEFAULT_RETURN (0);
void (*to_stop) (struct target_ops *, ptid_t)
TARGET_DEFAULT_IGNORE ();
void (*to_rcmd) (struct target_ops *,
- char *command, struct ui_file *output)
+ const char *command, struct ui_file *output)
TARGET_DEFAULT_FUNC (default_rcmd);
char *(*to_pid_to_exec_file) (struct target_ops *, int pid)
TARGET_DEFAULT_RETURN (NULL);
int (*to_has_execution) (struct target_ops *, ptid_t);
int to_has_thread_control; /* control thread execution */
int to_attach_no_wait;
- /* ASYNC target controls */
+ /* This method must be implemented in some situations. See the
+ comment on 'to_can_run'. */
int (*to_can_async_p) (struct target_ops *)
- TARGET_DEFAULT_FUNC (find_default_can_async_p);
+ TARGET_DEFAULT_RETURN (0);
int (*to_is_async_p) (struct target_ops *)
- TARGET_DEFAULT_FUNC (find_default_is_async_p);
+ TARGET_DEFAULT_RETURN (0);
void (*to_async) (struct target_ops *, async_callback_ftype *, void *)
TARGET_DEFAULT_NORETURN (tcomplain ());
- int (*to_supports_non_stop) (struct target_ops *);
+ /* This method must be implemented in some situations. See the
+ comment on 'to_can_run'. */
+ int (*to_supports_non_stop) (struct target_ops *)
+ TARGET_DEFAULT_RETURN (0);
/* find_memory_regions support method for gcore */
int (*to_find_memory_regions) (struct target_ops *,
find_memory_region_ftype func, void *data)
char * (*to_make_corefile_notes) (struct target_ops *, bfd *, int *)
TARGET_DEFAULT_FUNC (dummy_make_corefile_notes);
/* get_bookmark support method for bookmarks */
- gdb_byte * (*to_get_bookmark) (struct target_ops *, char *, int)
+ gdb_byte * (*to_get_bookmark) (struct target_ops *, const char *, int)
TARGET_DEFAULT_NORETURN (tcomplain ());
/* goto_bookmark support method for bookmarks */
- void (*to_goto_bookmark) (struct target_ops *, gdb_byte *, int)
+ void (*to_goto_bookmark) (struct target_ops *, const gdb_byte *, int)
TARGET_DEFAULT_NORETURN (tcomplain ());
/* Return the thread-local address at OFFSET in the
thread-local storage for the thread PTID and the shared library
or executable file given by OBJFILE. If that block of
thread-local storage hasn't been allocated yet, this function
- may return an error. */
+ may return an error. LOAD_MODULE_ADDR may be zero for statically
+ linked multithreaded inferiors. */
CORE_ADDR (*to_get_thread_local_address) (struct target_ops *ops,
ptid_t ptid,
CORE_ADDR load_module_addr,
- CORE_ADDR offset);
+ CORE_ADDR offset)
+ TARGET_DEFAULT_NORETURN (generic_tls_error ());
/* Request that OPS transfer up to LEN 8-bit bytes of the target's
OBJECT. The OFFSET, for a seekable object, specifies the
The default implementation always returns the inferior's
address space. */
struct address_space *(*to_thread_address_space) (struct target_ops *,
- ptid_t);
+ ptid_t)
+ TARGET_DEFAULT_FUNC (default_thread_address_space);
/* Target file operations. */
/* Implement the "info proc" command. */
- void (*to_info_proc) (struct target_ops *, char *, enum info_proc_what);
+ void (*to_info_proc) (struct target_ops *, const char *,
+ enum info_proc_what);
/* Tracepoint-related operations. */
encountered while reading memory. */
int (*to_verify_memory) (struct target_ops *, const gdb_byte *data,
CORE_ADDR memaddr, ULONGEST size)
- TARGET_DEFAULT_NORETURN (tcomplain ());
+ TARGET_DEFAULT_FUNC (default_verify_memory);
/* Return the address of the start of the Thread Information Block
a Windows OS specific feature. */
TARGET_DEFAULT_IGNORE ();
/* Print information about the recording. */
- void (*to_info_record) (struct target_ops *);
+ void (*to_info_record) (struct target_ops *)
+ TARGET_DEFAULT_IGNORE ();
/* Save the recorded execution trace into a file. */
void (*to_save_record) (struct target_ops *, const char *filename)
struct gdbarch *gdbarch)
TARGET_DEFAULT_FUNC (default_target_decr_pc_after_break);
+ /* Prepare to generate a core file. */
+ void (*to_prepare_to_generate_core) (struct target_ops *)
+ TARGET_DEFAULT_IGNORE ();
+
+ /* Cleanup after generating a core file. */
+ void (*to_done_generating_core) (struct target_ops *)
+ TARGET_DEFAULT_IGNORE ();
+
int to_magic;
/* Need sub-structure for target machine related rather than comm related?
*/
void target_close (struct target_ops *targ);
-/* Attaches to a process on the target side. Arguments are as passed
- to the `attach' command by the user. This routine can be called
- when the target is not on the target-stack, if the target_can_run
- routine returns 1; in that case, it must push itself onto the stack.
- Upon exit, the target should be ready for normal operations, and
- should be ready to deliver the status of the process immediately
- (without waiting) to an upcoming target_wait call. */
+/* Find the correct target to use for "attach". If a target on the
+ current stack supports attaching, then it is returned. Otherwise,
+ the default run target is returned. */
+
+extern struct target_ops *find_attach_target (void);
+
+/* Find the correct target to use for "run". If a target on the
+ current stack supports creating a new inferior, then it is
+ returned. Otherwise, the default run target is returned. */
-void target_attach (char *, int);
+extern struct target_ops *find_run_target (void);
/* Some targets don't generate traps when attaching to the inferior,
or their target_attach implementation takes care of the waiting.
/* Disconnect from the current target without resuming it (leaving it
waiting for a debugger). */
-extern void target_disconnect (char *, int);
+extern void target_disconnect (const char *, int);
/* Resume execution of the target process PTID (or a group of
threads). STEP says whether to single-step or to run free; SIGGNAL
an error was encountered while attempting to handle the
request. */
-int target_info_proc (char *, enum info_proc_what);
+int target_info_proc (const char *, enum info_proc_what);
/* Returns true if this target can debug multiple processes
simultaneously. */
#define target_files_info() \
(*current_target.to_files_info) (¤t_target)
-/* Insert a hardware breakpoint at address BP_TGT->placed_address in
+/* Insert a breakpoint at address BP_TGT->placed_address in
the target machine. Returns 0 for success, and returns non-zero or
throws an error (with a detailed failure reason error code and
message) otherwise. */
sections. The target may define switches, or other non-switch
arguments, as it pleases. */
-extern void target_load (char *arg, int from_tty);
-
-/* Start an inferior process and set inferior_ptid to its pid.
- EXEC_FILE is the file to run.
- ALLARGS is a string containing the arguments to the program.
- ENV is the environment vector to pass. Errors reported with error().
- On VxWorks and various standalone systems, we ignore exec_file. */
-
-void target_create_inferior (char *exec_file, char *args,
- char **env, int from_tty);
+extern void target_load (const char *arg, int from_tty);
/* Some targets (such as ttrace-based HPUX) don't allow us to request
notification of inferior events such as fork and vork immediately
target is currently executing; for some targets, that's the same as
whether or not the target is capable of execution, but there are
also targets which can be current while not executing. In that
- case this will become true after target_create_inferior or
- target_attach. */
+ case this will become true after to_create_inferior or
+ to_attach. */
extern int target_has_execution_1 (ptid_t);
#define target_can_lock_scheduler \
(current_target.to_has_thread_control & tc_schedlock)
-/* Should the target enable async mode if it is supported? Temporary
- cludge until async mode is a strict superset of sync mode. */
+/* Controls whether async mode is permitted. */
extern int target_async_permitted;
/* Can the target support asynchronous execution? */
/* Is the target in asynchronous execution mode? */
#define target_is_async_p() (current_target.to_is_async_p (¤t_target))
-int target_supports_non_stop (void);
-
/* Put the target in async mode with the specified callback function. */
#define target_async(CALLBACK,CONTEXT) \
(current_target.to_async (¤t_target, (CALLBACK), (CONTEXT)))
/* See to_get_tailcall_unwinder in struct target_ops. */
extern const struct frame_unwind *target_get_tailcall_unwinder (void);
+/* This implements basic memory verification, reading target memory
+ and performing the comparison here (as opposed to accelerated
+ verification making use of the qCRC packet, for example). */
+
+extern int simple_verify_memory (struct target_ops* ops,
+ const gdb_byte *data,
+ CORE_ADDR memaddr, ULONGEST size);
+
/* Verify that the memory in the [MEMADDR, MEMADDR+SIZE) range matches
the contents of [DATA,DATA+SIZE). Returns 1 if there's a match, 0
if there's a mismatch, and -1 if an error is encountered while
extern int memory_insert_breakpoint (struct target_ops *, struct gdbarch *,
struct bp_target_info *);
+/* Check whether the memory at the breakpoint's placed address still
+ contains the expected breakpoint instruction. */
+
+extern int memory_validate_breakpoint (struct gdbarch *gdbarch,
+ struct bp_target_info *bp_tgt);
+
extern int default_memory_remove_breakpoint (struct gdbarch *,
struct bp_target_info *);
extern void target_require_runnable (void);
-extern void find_default_attach (struct target_ops *, char *, int);
+extern void find_default_attach (struct target_ops *, const char *, int);
extern void find_default_create_inferior (struct target_ops *,
char *, char *, char **, int);
/* See to_stop_recording in struct target_ops. */
extern void target_stop_recording (void);
-/* See to_info_record in struct target_ops. */
-extern void target_info_record (void);
-
/* See to_save_record in struct target_ops. */
extern void target_save_record (const char *filename);
/* See to_decr_pc_after_break. */
extern CORE_ADDR target_decr_pc_after_break (struct gdbarch *gdbarch);
+/* See to_prepare_to_generate_core. */
+extern void target_prepare_to_generate_core (void);
+
+/* See to_done_generating_core. */
+extern void target_done_generating_core (void);
+
#endif /* !defined (TARGET_H) */