/* Interface between GDB and target environments, including files and processes
- Copyright (C) 1990-2016 Free Software Foundation, Inc.
+ Copyright (C) 1990-2017 Free Software Foundation, Inc.
Contributed by Cygnus Support. Written by John Gilmore.
#include "infrun.h" /* For enum exec_direction_kind. */
#include "breakpoint.h" /* For enum bptype. */
+#include "common/scoped_restore.h"
/* This include file defines the interface between the main part
of the debugger, and the part which is target-specific, or
#include "vec.h"
#include "gdb_signals.h"
#include "btrace.h"
+#include "record.h"
#include "command.h"
+#include "disasm.h"
#include "break-common.h" /* For enum target_hw_bp_type. */
const char *name;
};
-/* 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 *);
-
/* Return a pretty printed form of TARGET_OPTIONS.
Space for the result is malloc'd, caller must free. */
extern char *target_options_to_string (int target_options);
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);
+ const char *, const std::string &,
+ char **, int);
void (*to_post_startup_inferior) (struct target_ops *, ptid_t)
TARGET_DEFAULT_IGNORE ();
int (*to_insert_fork_catchpoint) (struct target_ops *, int)
TARGET_DEFAULT_RETURN (0);
void (*to_update_thread_list) (struct target_ops *)
TARGET_DEFAULT_IGNORE ();
- char *(*to_pid_to_str) (struct target_ops *, ptid_t)
+ const char *(*to_pid_to_str) (struct target_ops *, ptid_t)
TARGET_DEFAULT_FUNC (default_pid_to_str);
- char *(*to_extra_thread_info) (struct target_ops *, struct thread_info *)
+ const char *(*to_extra_thread_info) (struct target_ops *, struct thread_info *)
TARGET_DEFAULT_RETURN (NULL);
const char *(*to_thread_name) (struct target_ops *, struct thread_info *)
TARGET_DEFAULT_RETURN (NULL);
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
+ /* Request that OPS transfer up to LEN addressable units of the target's
+ OBJECT. When reading from a memory object, the size of an addressable
+ unit is architecture dependent and can be found using
+ gdbarch_addressable_memory_unit_size. Otherwise, an addressable unit is
+ 1 byte long. The OFFSET, for a seekable object, specifies the
starting point. The ANNEX can be used to provide additional
data-specific information to the target.
Return the transferred status, error or OK (an
- 'enum target_xfer_status' value). Save the number of bytes
+ 'enum target_xfer_status' value). Save the number of addressable units
actually transferred in *XFERED_LEN if transfer is successful
- (TARGET_XFER_OK) or the number unavailable bytes if the requested
+ (TARGET_XFER_OK) or the number unavailable units if the requested
data is unavailable (TARGET_XFER_UNAVAILABLE). *XFERED_LEN
smaller than LEN does not indicate the end of the object, only
the end of the transfer; higher level code should continue
transferring if desired. This is handled in target.c.
The interface does not support a "retry" mechanism. Instead it
- assumes that at least one byte will be transfered on each
+ assumes that at least one addressable unit will be transfered on each
successful call.
NOTE: cagney/2003-10-17: The current interface can lead to
const struct btrace_target_info *)
TARGET_DEFAULT_RETURN (NULL);
+ /* Current recording method. */
+ enum record_method (*to_record_method) (struct target_ops *, ptid_t ptid)
+ TARGET_DEFAULT_RETURN (RECORD_METHOD_NONE);
+
/* Stop trace recording. */
void (*to_stop_recording) (struct target_ops *)
TARGET_DEFAULT_IGNORE ();
the current position.
If SIZE < 0, disassemble abs (SIZE) preceding instructions; otherwise,
disassemble SIZE succeeding instructions. */
- void (*to_insn_history) (struct target_ops *, int size, int flags)
+ void (*to_insn_history) (struct target_ops *, int size,
+ gdb_disassembly_flags flags)
TARGET_DEFAULT_NORETURN (tcomplain ());
/* Disassemble SIZE instructions in the recorded execution trace around
If SIZE < 0, disassemble abs (SIZE) instructions before FROM; otherwise,
disassemble SIZE instructions after FROM. */
void (*to_insn_history_from) (struct target_ops *,
- ULONGEST from, int size, int flags)
+ ULONGEST from, int size,
+ gdb_disassembly_flags flags)
TARGET_DEFAULT_NORETURN (tcomplain ());
/* Disassemble a section of the recorded execution trace from instruction
BEGIN (inclusive) to instruction END (inclusive). */
void (*to_insn_history_range) (struct target_ops *,
- ULONGEST begin, ULONGEST end, int flags)
+ ULONGEST begin, ULONGEST end,
+ gdb_disassembly_flags flags)
TARGET_DEFAULT_NORETURN (tcomplain ());
/* Print a function trace of the recorded execution trace.
is returned. */
VEC(mem_region_s) *target_memory_map (void);
+/* Erases all flash memory regions on the target. */
+void flash_erase_command (char *cmd, int from_tty);
+
/* Erase the specified flash region. */
void target_flash_erase (ULONGEST address, LONGEST length);
struct bp_target_info *bp_tgt,
enum remove_bp_reason reason);
-/* Returns true if the terminal settings of the inferior are in
- effect. */
-
-extern int target_terminal_is_inferior (void);
-
-/* Returns true if our terminal settings are in effect. */
-
-extern int target_terminal_is_ours (void);
-
-/* Initialize the terminal settings we record for the inferior,
- before we actually run the inferior. */
-
-extern void target_terminal_init (void);
-
-/* Put the inferior's terminal settings into effect. This is
- preparation for starting or resuming the inferior. This is a no-op
- unless called with the main UI as current UI. */
-
-extern void target_terminal_inferior (void);
-
-/* Put some of our terminal settings into effect, enough to get proper
- results from our output, but do not change into or out of RAW mode
- so that no input is discarded. This is a no-op if terminal_ours
- was most recently called. This is a no-op unless called with the main
- UI as current UI. */
-
-extern void target_terminal_ours_for_output (void);
-
-/* Put our terminal settings into effect. First record the inferior's
- terminal settings so they can be restored properly later. This is
- a no-op unless called with the main UI as current UI. */
-
-extern void target_terminal_ours (void);
-
/* Return true if the target stack has a non-default
"to_terminal_ours" method. */
extern int target_supports_terminal_ours (void);
-/* Make a cleanup that restores the state of the terminal to the current
- state. */
-extern struct cleanup *make_cleanup_restore_target_terminal (void);
-
-/* Print useful information about our terminal status, if such a thing
- exists. */
-
-#define target_terminal_info(arg, from_tty) \
- (*current_target.to_terminal_info) (¤t_target, arg, from_tty)
-
/* Kill the inferior process. Make it go away. */
extern void target_kill (void);
`process xyz', but on some systems it may contain
`process xyz thread abc'. */
-extern char *target_pid_to_str (ptid_t ptid);
+extern const char *target_pid_to_str (ptid_t ptid);
-extern char *normal_pid_to_str (ptid_t ptid);
+extern const char *normal_pid_to_str (ptid_t ptid);
/* Return a short string describing extra information about PID,
e.g. "sleeping", "runnable", "running on LWP 3". Null return value
/* Adds a command ALIAS for target T and marks it deprecated. This is useful
for maintaining backwards compatibility when renaming targets. */
-extern void add_deprecated_target_alias (struct target_ops *t, char *alias);
+extern void add_deprecated_target_alias (struct target_ops *t,
+ const char *alias);
extern void push_target (struct target_ops *);
\f
-/* Set the show memory breakpoints mode to show, and installs a cleanup
- to restore it back to the current value. */
-extern struct cleanup *make_show_memory_breakpoints_cleanup (int show);
+/* Set the show memory breakpoints mode to show, and return a
+ scoped_restore to restore it back to the current value. */
+extern scoped_restore_tmpl<int>
+ make_scoped_restore_show_memory_breakpoints (int show);
extern int may_write_registers;
extern int may_write_memory;
/* See to_delete_record in struct target_ops. */
extern void target_delete_record (void);
+/* See to_record_method. */
+extern enum record_method target_record_method (ptid_t ptid);
+
/* See to_record_is_replaying in struct target_ops. */
extern int target_record_is_replaying (ptid_t ptid);
extern void target_goto_record (ULONGEST insn);
/* See to_insn_history. */
-extern void target_insn_history (int size, int flags);
+extern void target_insn_history (int size, gdb_disassembly_flags flags);
/* See to_insn_history_from. */
-extern void target_insn_history_from (ULONGEST from, int size, int flags);
+extern void target_insn_history_from (ULONGEST from, int size,
+ gdb_disassembly_flags flags);
/* See to_insn_history_range. */
-extern void target_insn_history_range (ULONGEST begin, ULONGEST end, int flags);
+extern void target_insn_history_range (ULONGEST begin, ULONGEST end,
+ gdb_disassembly_flags flags);
/* See to_call_history. */
extern void target_call_history (int size, int flags);