convert to_terminal_init
[deliverable/binutils-gdb.git] / gdb / target.h
index c46b42ba58b50ec53001a1cd3533ab921f69f0f9..7eba273e543dd4bae041bd7b0dc75f09057c9e47 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,19 +485,23 @@ 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_init) (struct target_ops *)
+      TARGET_DEFAULT_IGNORE ();
     void (*to_terminal_inferior) (struct target_ops *);
     void (*to_terminal_ours_for_output) (struct target_ops *);
     void (*to_terminal_ours) (struct target_ops *);
@@ -526,7 +540,8 @@ struct target_ops
     char *(*to_thread_name) (struct target_ops *, struct thread_info *);
     void (*to_stop) (struct target_ops *, ptid_t);
     void (*to_rcmd) (struct target_ops *,
-                    char *command, struct ui_file *output);
+                    char *command, struct ui_file *output)
+      TARGET_DEFAULT_FUNC (default_rcmd);
     char *(*to_pid_to_exec_file) (struct target_ops *, int pid);
     void (*to_log_command) (struct target_ops *, const char *);
     struct target_section_table *(*to_get_section_table) (struct target_ops *);
@@ -784,55 +799,61 @@ struct target_ops
     void (*to_trace_set_readonly_regions) (struct target_ops *);
 
     /* Start a trace run.  */
-    void (*to_trace_start) (void);
+    void (*to_trace_start) (struct target_ops *);
 
     /* Get the current status of a tracing run.  */
-    int (*to_get_trace_status) (struct trace_status *ts);
+    int (*to_get_trace_status) (struct target_ops *, struct trace_status *ts);
 
-    void (*to_get_tracepoint_status) (struct breakpoint *tp,
+    void (*to_get_tracepoint_status) (struct target_ops *,
+                                     struct breakpoint *tp,
                                      struct uploaded_tp *utp);
 
     /* Stop a trace run.  */
-    void (*to_trace_stop) (void);
+    void (*to_trace_stop) (struct target_ops *);
 
    /* Ask the target to find a trace frame of the given type TYPE,
       using NUM, ADDR1, and ADDR2 as search parameters.  Returns the
       number of the trace frame, and also the tracepoint number at
       TPP.  If no trace frame matches, return -1.  May throw if the
       operation fails.  */
-    int (*to_trace_find) (enum trace_find_type type, int num,
+    int (*to_trace_find) (struct target_ops *,
+                         enum trace_find_type type, int num,
                          CORE_ADDR addr1, CORE_ADDR addr2, int *tpp);
 
     /* Get the value of the trace state variable number TSV, returning
        1 if the value is known and writing the value itself into the
        location pointed to by VAL, else returning 0.  */
-    int (*to_get_trace_state_variable_value) (int tsv, LONGEST *val);
+    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.
@@ -853,20 +874,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
@@ -881,14 +903,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 *)
@@ -896,83 +918,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.  */
@@ -1803,76 +1833,82 @@ extern char *target_fileio_read_stralloc (const char *filename);
   (*current_target.to_disable_tracepoint) (&current_target, loc)
 
 #define target_trace_start() \
-  (*current_target.to_trace_start) ()
+  (*current_target.to_trace_start) (&current_target)
 
 #define target_trace_set_readonly_regions() \
   (*current_target.to_trace_set_readonly_regions) (&current_target)
 
 #define target_get_trace_status(ts) \
-  (*current_target.to_get_trace_status) (ts)
+  (*current_target.to_get_trace_status) (&current_target, ts)
 
 #define target_get_tracepoint_status(tp,utp)           \
-  (*current_target.to_get_tracepoint_status) (tp, utp)
+  (*current_target.to_get_tracepoint_status) (&current_target, tp, utp)
 
 #define target_trace_stop() \
-  (*current_target.to_trace_stop) ()
+  (*current_target.to_trace_stop) (&current_target)
 
 #define target_trace_find(type,num,addr1,addr2,tpp) \
-  (*current_target.to_trace_find) ((type), (num), (addr1), (addr2), (tpp))
+  (*current_target.to_trace_find) (&current_target, \
+                                  (type), (num), (addr1), (addr2), (tpp))
 
 #define target_get_trace_state_variable_value(tsv,val) \
-  (*current_target.to_get_trace_state_variable_value) ((tsv), (val))
+  (*current_target.to_get_trace_state_variable_value) (&current_target,        \
+                                                      (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.  */
 
This page took 0.031051 seconds and 4 git commands to generate.