/* Interface between GDB and target environments, including files and processes
- Copyright (C) 1990-2020 Free Software Foundation, Inc.
+ Copyright (C) 1990-2021 Free Software Foundation, Inc.
Contributed by Cygnus Support. Written by John Gilmore.
struct bp_location;
struct bp_target_info;
struct regcache;
-struct target_section_table;
struct trace_state_variable;
struct trace_status;
struct uploaded_tsv;
virtual void attach (const char *, int);
virtual void post_attach (int)
TARGET_DEFAULT_IGNORE ();
+
+ /* Detaches from the inferior. Note that on targets that support
+ async execution (i.e., targets where it is possible to detach
+ from programs with threads running), the target is responsible
+ for removing breakpoints from the program before the actual
+ detach, otherwise the program dies when it hits one. */
virtual void detach (inferior *, int)
TARGET_DEFAULT_IGNORE ();
+
virtual void disconnect (const char *, int)
TARGET_DEFAULT_NORETURN (tcomplain ());
virtual void resume (ptid_t,
TARGET_DEFAULT_RETURN (NULL);
virtual void log_command (const char *)
TARGET_DEFAULT_IGNORE ();
- virtual struct target_section_table *get_section_table ()
- TARGET_DEFAULT_RETURN (NULL);
+ virtual const target_section_table *get_section_table ()
+ TARGET_DEFAULT_RETURN (default_get_section_table ());
/* Provide default values for all "must have" methods. */
virtual bool has_all_memory () { return false; }
virtual int find_memory_regions (find_memory_region_ftype func, void *data)
TARGET_DEFAULT_FUNC (dummy_find_memory_regions);
/* make_corefile_notes support method for gcore */
- virtual char *make_corefile_notes (bfd *, int *)
+ virtual gdb::unique_xmalloc_ptr<char> make_corefile_notes (bfd *, int *)
TARGET_DEFAULT_FUNC (dummy_make_corefile_notes);
/* get_bookmark support method for bookmarks */
virtual gdb_byte *get_bookmark (const char *, int)
/* Is the target in non-stop mode? Some targets control the inferior
in non-stop mode even with "set non-stop off". Always true if "set
non-stop" is on. */
-extern int target_is_non_stop_p (void);
+extern bool target_is_non_stop_p ();
/* Return true if at least one inferior has a non-stop target. */
extern bool exists_non_stop_target ();
/* Main entry point for searching memory. */
extern int target_search_memory (CORE_ADDR start_addr,
- ULONGEST search_space_len,
- const gdb_byte *pattern,
- ULONGEST pattern_len,
- CORE_ADDR *found_addrp);
+ ULONGEST search_space_len,
+ const gdb_byte *pattern,
+ ULONGEST pattern_len,
+ CORE_ADDR *found_addrp);
/* Target file operations. */
extern int unpush_target (struct target_ops *);
+/* A unique_ptr helper to unpush a target. */
+
+struct target_unpusher
+{
+ void operator() (struct target_ops *ops) const
+ {
+ unpush_target (ops);
+ }
+};
+
+/* A unique_ptr that unpushes a target on destruction. */
+
+typedef std::unique_ptr<struct target_ops, target_unpusher> target_unpush_up;
+
extern void target_pre_inferior (int);
extern void target_preopen (int);
CORE_ADDR offset);
/* Return the "section" containing the specified address. */
-struct target_section *target_section_by_addr (struct target_ops *target,
- CORE_ADDR addr);
+const struct target_section *target_section_by_addr (struct target_ops *target,
+ CORE_ADDR addr);
/* Return the target section table this target (or the targets
beneath) currently manipulate. */
-extern struct target_section_table *target_get_section_table
+extern const target_section_table *target_get_section_table
(struct target_ops *target);
+/* Default implementation of get_section_table for dummy_target. */
+
+extern const target_section_table *default_get_section_table ();
+
/* From mem-break.c */
extern int memory_remove_breakpoint (struct target_ops *,
/* Stuff that should be shared among the various remote targets. */
-/* Debugging level. 0 is off, and non-zero values mean to print some debug
- information (higher values, more information). */
-extern int remote_debug;
-
-/* Speed in bits per second, or -1 which means don't mess with the speed. */
-extern int baud_rate;
-
-/* Parity for serial port */
-extern int serial_parity;
/* Timeout limit for response from target. */
extern int remote_timeout;