convert to_get_bookmark
[deliverable/binutils-gdb.git] / gdb / target.h
index 16caa29f5a86a1089763837295ed3e6ce6ad72f3..0fb7d8eefbe26f373aeed68b4d60444429db66e2 100644 (file)
@@ -403,9 +403,12 @@ struct target_ops
        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);
-    void (*to_post_attach) (struct target_ops *, int);
-    void (*to_detach) (struct target_ops *ops, const char *, int);
+    void (*to_attach) (struct target_ops *ops, char *, int)
+      TARGET_DEFAULT_FUNC (find_default_attach);
+    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_resume) (struct target_ops *, ptid_t, int, enum gdb_signal)
       TARGET_DEFAULT_NORETURN (noprocess ());
@@ -415,7 +418,8 @@ struct target_ops
     void (*to_fetch_registers) (struct target_ops *, struct regcache *, int);
     void (*to_store_registers) (struct target_ops *, struct regcache *, int)
       TARGET_DEFAULT_NORETURN (noprocess ());
-    void (*to_prepare_to_store) (struct target_ops *, struct regcache *);
+    void (*to_prepare_to_store) (struct target_ops *, struct regcache *)
+      TARGET_DEFAULT_NORETURN (noprocess ());
 
     /* Transfer LEN bytes of memory between GDB address MYADDR and
        target address MEMADDR.  If WRITE, transfer them to the target, else
@@ -443,26 +447,32 @@ struct target_ops
                                   struct mem_attrib *attrib,
                                   struct target_ops *target);
 
-    void (*to_files_info) (struct target_ops *);
+    void (*to_files_info) (struct target_ops *)
+      TARGET_DEFAULT_IGNORE ();
     int (*to_insert_breakpoint) (struct target_ops *, struct gdbarch *,
                                 struct bp_target_info *)
       TARGET_DEFAULT_FUNC (memory_insert_breakpoint);
     int (*to_remove_breakpoint) (struct target_ops *, struct gdbarch *,
                                 struct bp_target_info *)
       TARGET_DEFAULT_FUNC (memory_remove_breakpoint);
-    int (*to_can_use_hw_breakpoint) (struct target_ops *, int, int, int);
+    int (*to_can_use_hw_breakpoint) (struct target_ops *, int, int, int)
+      TARGET_DEFAULT_RETURN (0);
     int (*to_ranged_break_num_registers) (struct target_ops *);
     int (*to_insert_hw_breakpoint) (struct target_ops *,
-                                   struct gdbarch *, struct bp_target_info *);
+                                   struct gdbarch *, struct bp_target_info *)
+      TARGET_DEFAULT_RETURN (-1);
     int (*to_remove_hw_breakpoint) (struct target_ops *,
-                                   struct gdbarch *, struct bp_target_info *);
+                                   struct gdbarch *, struct bp_target_info *)
+      TARGET_DEFAULT_RETURN (-1);
 
     /* Documentation of what the two routines below are expected to do is
        provided with the corresponding target_* macros.  */
     int (*to_remove_watchpoint) (struct target_ops *,
-                                CORE_ADDR, int, int, struct expression *);
+                                CORE_ADDR, int, int, struct expression *)
+      TARGET_DEFAULT_RETURN (-1);
     int (*to_insert_watchpoint) (struct target_ops *,
-                                CORE_ADDR, int, int, struct expression *);
+                                CORE_ADDR, int, int, struct expression *)
+      TARGET_DEFAULT_RETURN (-1);
 
     int (*to_insert_mask_watchpoint) (struct target_ops *,
                                      CORE_ADDR, CORE_ADDR, int);
@@ -475,39 +485,58 @@ struct target_ops
     int (*to_stopped_data_address) (struct target_ops *, CORE_ADDR *)
       TARGET_DEFAULT_RETURN (0);
     int (*to_watchpoint_addr_within_range) (struct target_ops *,
-                                           CORE_ADDR, CORE_ADDR, int);
+                                           CORE_ADDR, CORE_ADDR, int)
+      TARGET_DEFAULT_FUNC (default_watchpoint_addr_within_range);
 
     /* Documentation of this routine is provided with the corresponding
        target_* macro.  */
     int (*to_region_ok_for_hw_watchpoint) (struct target_ops *,
-                                          CORE_ADDR, int);
+                                          CORE_ADDR, int)
+      TARGET_DEFAULT_FUNC (default_region_ok_for_hw_watchpoint);
 
     int (*to_can_accel_watchpoint_condition) (struct target_ops *,
                                              CORE_ADDR, int, int,
-                                             struct expression *);
+                                             struct expression *)
+      TARGET_DEFAULT_RETURN (0);
     int (*to_masked_watch_num_registers) (struct target_ops *,
                                          CORE_ADDR, CORE_ADDR);
-    void (*to_terminal_init) (struct target_ops *);
-    void (*to_terminal_inferior) (struct target_ops *);
-    void (*to_terminal_ours_for_output) (struct target_ops *);
-    void (*to_terminal_ours) (struct target_ops *);
-    void (*to_terminal_save_ours) (struct target_ops *);
-    void (*to_terminal_info) (struct target_ops *, const char *, int);
+    void (*to_terminal_init) (struct target_ops *)
+      TARGET_DEFAULT_IGNORE ();
+    void (*to_terminal_inferior) (struct target_ops *)
+      TARGET_DEFAULT_IGNORE ();
+    void (*to_terminal_ours_for_output) (struct target_ops *)
+      TARGET_DEFAULT_IGNORE ();
+    void (*to_terminal_ours) (struct target_ops *)
+      TARGET_DEFAULT_IGNORE ();
+    void (*to_terminal_save_ours) (struct target_ops *)
+      TARGET_DEFAULT_IGNORE ();
+    void (*to_terminal_info) (struct target_ops *, const char *, int)
+      TARGET_DEFAULT_FUNC (default_terminal_info);
     void (*to_kill) (struct target_ops *);
-    void (*to_load) (struct target_ops *, char *, int);
+    void (*to_load) (struct target_ops *, char *, int)
+      TARGET_DEFAULT_NORETURN (tcomplain ());
     void (*to_create_inferior) (struct target_ops *, 
                                char *, char *, char **, int);
-    void (*to_post_startup_inferior) (struct target_ops *, ptid_t);
-    int (*to_insert_fork_catchpoint) (struct target_ops *, int);
-    int (*to_remove_fork_catchpoint) (struct target_ops *, int);
-    int (*to_insert_vfork_catchpoint) (struct target_ops *, int);
-    int (*to_remove_vfork_catchpoint) (struct target_ops *, 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 (1);
+    int (*to_remove_fork_catchpoint) (struct target_ops *, int)
+      TARGET_DEFAULT_RETURN (1);
+    int (*to_insert_vfork_catchpoint) (struct target_ops *, int)
+      TARGET_DEFAULT_RETURN (1);
+    int (*to_remove_vfork_catchpoint) (struct target_ops *, int)
+      TARGET_DEFAULT_RETURN (1);
     int (*to_follow_fork) (struct target_ops *, int, int);
-    int (*to_insert_exec_catchpoint) (struct target_ops *, int);
-    int (*to_remove_exec_catchpoint) (struct target_ops *, int);
+    int (*to_insert_exec_catchpoint) (struct target_ops *, int)
+      TARGET_DEFAULT_RETURN (1);
+    int (*to_remove_exec_catchpoint) (struct target_ops *, int)
+      TARGET_DEFAULT_RETURN (1);
     int (*to_set_syscall_catchpoint) (struct target_ops *,
-                                     int, int, int, int, int *);
-    int (*to_has_exited) (struct target_ops *, int, int, int *);
+                                     int, int, int, int, int *)
+      TARGET_DEFAULT_RETURN (1);
+    int (*to_has_exited) (struct target_ops *, int, int, int *)
+      TARGET_DEFAULT_RETURN (0);
     void (*to_mourn_inferior) (struct target_ops *);
     int (*to_can_run) (struct target_ops *);
 
@@ -522,13 +551,18 @@ struct target_ops
     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 target_ops *, struct thread_info *);
-    char *(*to_thread_name) (struct target_ops *, struct thread_info *);
+    char *(*to_extra_thread_info) (struct target_ops *, struct thread_info *)
+      TARGET_DEFAULT_RETURN (0);
+    char *(*to_thread_name) (struct target_ops *, struct thread_info *)
+      TARGET_DEFAULT_RETURN (0);
     void (*to_stop) (struct target_ops *, ptid_t);
     void (*to_rcmd) (struct target_ops *,
-                    char *command, struct ui_file *output);
-    char *(*to_pid_to_exec_file) (struct target_ops *, int pid);
-    void (*to_log_command) (struct target_ops *, const char *);
+                    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 (0);
+    void (*to_log_command) (struct target_ops *, const char *)
+      TARGET_DEFAULT_IGNORE ();
     struct target_section_table *(*to_get_section_table) (struct target_ops *);
     enum strata to_stratum;
     int (*to_has_all_memory) (struct target_ops *);
@@ -548,11 +582,14 @@ struct target_ops
     int (*to_supports_non_stop) (struct target_ops *);
     /* find_memory_regions support method for gcore */
     int (*to_find_memory_regions) (struct target_ops *,
-                                  find_memory_region_ftype func, void *data);
+                                  find_memory_region_ftype func, void *data)
+      TARGET_DEFAULT_FUNC (dummy_find_memory_regions);
     /* make_corefile_notes support method for gcore */
-    char * (*to_make_corefile_notes) (struct target_ops *, bfd *, int *);
+    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 *, char *, int)
+      TARGET_DEFAULT_NORETURN (tcomplain ());
     /* goto_bookmark support method for bookmarks */
     void (*to_goto_bookmark) (struct target_ops *, gdb_byte *, int);
     /* Return the thread-local address at OFFSET in the
@@ -811,31 +848,34 @@ struct target_ops
     int (*to_get_trace_state_variable_value) (struct target_ops *,
                                              int tsv, LONGEST *val);
 
-    int (*to_save_trace_data) (const char *filename);
+    int (*to_save_trace_data) (struct target_ops *, const char *filename);
 
-    int (*to_upload_tracepoints) (struct uploaded_tp **utpp);
+    int (*to_upload_tracepoints) (struct target_ops *,
+                                 struct uploaded_tp **utpp);
 
-    int (*to_upload_trace_state_variables) (struct uploaded_tsv **utsvp);
+    int (*to_upload_trace_state_variables) (struct target_ops *,
+                                           struct uploaded_tsv **utsvp);
 
-    LONGEST (*to_get_raw_trace_data) (gdb_byte *buf,
+    LONGEST (*to_get_raw_trace_data) (struct target_ops *, gdb_byte *buf,
                                      ULONGEST offset, LONGEST len);
 
     /* Get the minimum length of instruction on which a fast tracepoint
        may be set on the target.  If this operation is unsupported,
        return -1.  If for some reason the minimum length cannot be
        determined, return 0.  */
-    int (*to_get_min_fast_tracepoint_insn_len) (void);
+    int (*to_get_min_fast_tracepoint_insn_len) (struct target_ops *);
 
     /* Set the target's tracing behavior in response to unexpected
        disconnection - set VAL to 1 to keep tracing, 0 to stop.  */
-    void (*to_set_disconnected_tracing) (int val);
-    void (*to_set_circular_trace_buffer) (int val);
+    void (*to_set_disconnected_tracing) (struct target_ops *, int val);
+    void (*to_set_circular_trace_buffer) (struct target_ops *, int val);
     /* Set the size of trace buffer in the target.  */
-    void (*to_set_trace_buffer_size) (LONGEST val);
+    void (*to_set_trace_buffer_size) (struct target_ops *, LONGEST val);
 
     /* Add/change textual notes about the trace run, returning 1 if
        successful, 0 otherwise.  */
-    int (*to_set_trace_notes) (const char *user, const char *notes,
+    int (*to_set_trace_notes) (struct target_ops *,
+                              const char *user, const char *notes,
                               const char *stopnotes);
 
     /* Return the processor core that thread PTID was last seen on.
@@ -856,20 +896,21 @@ struct target_ops
 
     /* Return the address of the start of the Thread Information Block
        a Windows OS specific feature.  */
-    int (*to_get_tib_address) (ptid_t ptid, CORE_ADDR *addr);
+    int (*to_get_tib_address) (struct target_ops *,
+                              ptid_t ptid, CORE_ADDR *addr);
 
     /* Send the new settings of write permission variables.  */
-    void (*to_set_permissions) (void);
+    void (*to_set_permissions) (struct target_ops *);
 
     /* Look for a static tracepoint marker at ADDR, and fill in MARKER
        with its details.  Return 1 on success, 0 on failure.  */
-    int (*to_static_tracepoint_marker_at) (CORE_ADDR,
+    int (*to_static_tracepoint_marker_at) (struct target_ops *, CORE_ADDR,
                                           struct static_tracepoint_marker *marker);
 
     /* Return a vector of all tracepoints markers string id ID, or all
        markers if ID is NULL.  */
     VEC(static_tracepoint_marker_p) *(*to_static_tracepoint_markers_by_strid)
-      (const char *id);
+      (struct target_ops *, const char *id);
 
     /* Return a traceframe info object describing the current
        traceframe's contents.  If the target doesn't support
@@ -884,14 +925,14 @@ struct target_ops
        is available in the read-only sections.  This method should not
        cache data; higher layers take care of caching, invalidating,
        and re-fetching when necessary.  */
-    struct traceframe_info *(*to_traceframe_info) (void);
+    struct traceframe_info *(*to_traceframe_info) (struct target_ops *);
 
     /* Ask the target to use or not to use agent according to USE.  Return 1
        successful, 0 otherwise.  */
-    int (*to_use_agent) (int use);
+    int (*to_use_agent) (struct target_ops *, int use);
 
     /* Is the target able to use agent in current state?  */
-    int (*to_can_use_agent) (void);
+    int (*to_can_use_agent) (struct target_ops *);
 
     /* Check whether the target supports branch tracing.  */
     int (*to_supports_btrace) (struct target_ops *)
@@ -899,83 +940,91 @@ struct target_ops
 
     /* Enable branch tracing for PTID and allocate a branch trace target
        information struct for reading and for disabling branch trace.  */
-    struct btrace_target_info *(*to_enable_btrace) (ptid_t ptid);
+    struct btrace_target_info *(*to_enable_btrace) (struct target_ops *,
+                                                   ptid_t ptid);
 
     /* Disable branch tracing and deallocate TINFO.  */
-    void (*to_disable_btrace) (struct btrace_target_info *tinfo);
+    void (*to_disable_btrace) (struct target_ops *,
+                              struct btrace_target_info *tinfo);
 
     /* Disable branch tracing and deallocate TINFO.  This function is similar
        to to_disable_btrace, except that it is called during teardown and is
        only allowed to perform actions that are safe.  A counter-example would
        be attempting to talk to a remote target.  */
-    void (*to_teardown_btrace) (struct btrace_target_info *tinfo);
+    void (*to_teardown_btrace) (struct target_ops *,
+                               struct btrace_target_info *tinfo);
 
     /* Read branch trace data for the thread indicated by BTINFO into DATA.
        DATA is cleared before new trace is added.
        The branch trace will start with the most recent block and continue
        towards older blocks.  */
-    enum btrace_error (*to_read_btrace) (VEC (btrace_block_s) **data,
+    enum btrace_error (*to_read_btrace) (struct target_ops *self,
+                                        VEC (btrace_block_s) **data,
                                         struct btrace_target_info *btinfo,
                                         enum btrace_read_type type);
 
     /* Stop trace recording.  */
-    void (*to_stop_recording) (void);
+    void (*to_stop_recording) (struct target_ops *);
 
     /* Print information about the recording.  */
-    void (*to_info_record) (void);
+    void (*to_info_record) (struct target_ops *);
 
     /* Save the recorded execution trace into a file.  */
-    void (*to_save_record) (const char *filename);
+    void (*to_save_record) (struct target_ops *, const char *filename);
 
     /* Delete the recorded execution trace from the current position onwards.  */
-    void (*to_delete_record) (void);
+    void (*to_delete_record) (struct target_ops *);
 
     /* Query if the record target is currently replaying.  */
-    int (*to_record_is_replaying) (void);
+    int (*to_record_is_replaying) (struct target_ops *);
 
     /* Go to the begin of the execution trace.  */
-    void (*to_goto_record_begin) (void);
+    void (*to_goto_record_begin) (struct target_ops *);
 
     /* Go to the end of the execution trace.  */
-    void (*to_goto_record_end) (void);
+    void (*to_goto_record_end) (struct target_ops *);
 
     /* Go to a specific location in the recorded execution trace.  */
-    void (*to_goto_record) (ULONGEST insn);
+    void (*to_goto_record) (struct target_ops *, ULONGEST insn);
 
     /* Disassemble SIZE instructions in the recorded execution trace from
        the current position.
        If SIZE < 0, disassemble abs (SIZE) preceding instructions; otherwise,
        disassemble SIZE succeeding instructions.  */
-    void (*to_insn_history) (int size, int flags);
+    void (*to_insn_history) (struct target_ops *, int size, int flags);
 
     /* Disassemble SIZE instructions in the recorded execution trace around
        FROM.
        If SIZE < 0, disassemble abs (SIZE) instructions before FROM; otherwise,
        disassemble SIZE instructions after FROM.  */
-    void (*to_insn_history_from) (ULONGEST from, int size, int flags);
+    void (*to_insn_history_from) (struct target_ops *,
+                                 ULONGEST from, int size, int flags);
 
     /* Disassemble a section of the recorded execution trace from instruction
        BEGIN (inclusive) to instruction END (inclusive).  */
-    void (*to_insn_history_range) (ULONGEST begin, ULONGEST end, int flags);
+    void (*to_insn_history_range) (struct target_ops *,
+                                  ULONGEST begin, ULONGEST end, int flags);
 
     /* Print a function trace of the recorded execution trace.
        If SIZE < 0, print abs (SIZE) preceding functions; otherwise, print SIZE
        succeeding functions.  */
-    void (*to_call_history) (int size, int flags);
+    void (*to_call_history) (struct target_ops *, int size, int flags);
 
     /* Print a function trace of the recorded execution trace starting
        at function FROM.
        If SIZE < 0, print abs (SIZE) functions before FROM; otherwise, print
        SIZE functions after FROM.  */
-    void (*to_call_history_from) (ULONGEST begin, int size, int flags);
+    void (*to_call_history_from) (struct target_ops *,
+                                 ULONGEST begin, int size, int flags);
 
     /* Print a function trace of an execution trace section from function BEGIN
        (inclusive) to function END (inclusive).  */
-    void (*to_call_history_range) (ULONGEST begin, ULONGEST end, int flags);
+    void (*to_call_history_range) (struct target_ops *,
+                                  ULONGEST begin, ULONGEST end, int flags);
 
     /* Nonzero if TARGET_OBJECT_LIBRARIES_SVR4 may be read with a
        non-empty annex.  */
-    int (*to_augmented_libraries_svr4_read) (void);
+    int (*to_augmented_libraries_svr4_read) (struct target_ops *);
 
     /* Those unwinders are tried before any other arch unwinders.  Use NULL if
        it is not used.  */
@@ -1829,64 +1878,64 @@ extern char *target_fileio_read_stralloc (const char *filename);
                                                       (tsv), (val))
 
 #define target_save_trace_data(filename) \
-  (*current_target.to_save_trace_data) (filename)
+  (*current_target.to_save_trace_data) (&current_target, filename)
 
 #define target_upload_tracepoints(utpp) \
-  (*current_target.to_upload_tracepoints) (utpp)
+  (*current_target.to_upload_tracepoints) (&current_target, utpp)
 
 #define target_upload_trace_state_variables(utsvp) \
-  (*current_target.to_upload_trace_state_variables) (utsvp)
+  (*current_target.to_upload_trace_state_variables) (&current_target, utsvp)
 
 #define target_get_raw_trace_data(buf,offset,len) \
-  (*current_target.to_get_raw_trace_data) ((buf), (offset), (len))
+  (*current_target.to_get_raw_trace_data) (&current_target,    \
+                                          (buf), (offset), (len))
 
 #define target_get_min_fast_tracepoint_insn_len() \
-  (*current_target.to_get_min_fast_tracepoint_insn_len) ()
+  (*current_target.to_get_min_fast_tracepoint_insn_len) (&current_target)
 
 #define target_set_disconnected_tracing(val) \
-  (*current_target.to_set_disconnected_tracing) (val)
+  (*current_target.to_set_disconnected_tracing) (&current_target, val)
 
 #define        target_set_circular_trace_buffer(val)   \
-  (*current_target.to_set_circular_trace_buffer) (val)
+  (*current_target.to_set_circular_trace_buffer) (&current_target, val)
 
 #define        target_set_trace_buffer_size(val)       \
-  (*current_target.to_set_trace_buffer_size) (val)
+  (*current_target.to_set_trace_buffer_size) (&current_target, val)
 
 #define        target_set_trace_notes(user,notes,stopnotes)            \
-  (*current_target.to_set_trace_notes) ((user), (notes), (stopnotes))
+  (*current_target.to_set_trace_notes) (&current_target,       \
+                                       (user), (notes), (stopnotes))
 
 #define target_get_tib_address(ptid, addr) \
-  (*current_target.to_get_tib_address) ((ptid), (addr))
+  (*current_target.to_get_tib_address) (&current_target, (ptid), (addr))
 
 #define target_set_permissions() \
-  (*current_target.to_set_permissions) ()
+  (*current_target.to_set_permissions) (&current_target)
 
 #define target_static_tracepoint_marker_at(addr, marker) \
-  (*current_target.to_static_tracepoint_marker_at) (addr, marker)
+  (*current_target.to_static_tracepoint_marker_at) (&current_target,   \
+                                                   addr, marker)
 
 #define target_static_tracepoint_markers_by_strid(marker_id) \
-  (*current_target.to_static_tracepoint_markers_by_strid) (marker_id)
+  (*current_target.to_static_tracepoint_markers_by_strid) (&current_target, \
+                                                          marker_id)
 
 #define target_traceframe_info() \
-  (*current_target.to_traceframe_info) ()
+  (*current_target.to_traceframe_info) (&current_target)
 
 #define target_use_agent(use) \
-  (*current_target.to_use_agent) (use)
+  (*current_target.to_use_agent) (&current_target, use)
 
 #define target_can_use_agent() \
-  (*current_target.to_can_use_agent) ()
+  (*current_target.to_can_use_agent) (&current_target)
 
 #define target_augmented_libraries_svr4_read() \
-  (*current_target.to_augmented_libraries_svr4_read) ()
+  (*current_target.to_augmented_libraries_svr4_read) (&current_target)
 
 /* Command logging facility.  */
 
-#define target_log_command(p)                                          \
-  do                                                                   \
-    if (current_target.to_log_command)                                 \
-      (*current_target.to_log_command) (&current_target,               \
-                                       p);                             \
-  while (0)
+#define target_log_command(p)                                  \
+  (*current_target.to_log_command) (&current_target, p)
 
 
 extern int target_core_of_thread (ptid_t ptid);
This page took 0.030792 seconds and 4 git commands to generate.