*** empty log message ***
[deliverable/binutils-gdb.git] / gdb / target.h
index 8894ac6ab9a5456c6cb2d0c2a3228425e9899938..582fa789a675104936762a86b44ccac745bf9c87 100644 (file)
@@ -35,8 +35,8 @@ struct target_ops;
    specific to the communications interface between us and the
    target.
 
-   A TARGET is an interface between the debugger and a particular 
-   kind of file or process.  Targets can be STACKED in STRATA, 
+   A TARGET is an interface between the debugger and a particular
+   kind of file or process.  Targets can be STACKED in STRATA,
    so that more than one target can potentially respond to a request.
    In particular, memory accesses will walk down the stack of targets
    until they find a target that is interested in handling that particular
@@ -155,7 +155,7 @@ enum inferior_event_type
     INF_QUIT_REQ,
     /* Process a normal inferior event which will result in target_wait
        being called.  */
-    INF_REG_EVENT, 
+    INF_REG_EVENT,
     /* Deal with an error on the inferior.  */
     INF_ERROR,
     /* We are called because a timer went off.  */
@@ -186,7 +186,7 @@ enum target_signal target_signal_from_name (char *);
    Return the number of bytes actually transfered, zero when no
    further transfer is possible, and -1 when the transfer is not
    supported.
-   
+
    NOTE: cagney/2003-10-17: The current interface does not support a
    "retry" mechanism.  Instead it assumes that at least one byte will
    be transfered on each call.
@@ -226,29 +226,33 @@ enum target_object
   TARGET_OBJECT_MEMORY,
   /* Kernel Unwind Table.  See "ia64-tdep.c".  */
   TARGET_OBJECT_UNWIND_TABLE,
-  /* Possible future objects: TARGET_OBJECT_FILE, TARGET_OBJECT_PROC,
-     TARGET_OBJECT_AUXV, ...  */
+  /* Transfer auxilliary vector.  */
+  TARGET_OBJECT_AUXV,
+  /* StackGhost cookie.  See "sparc-tdep.c".  */
+  TARGET_OBJECT_WCOOKIE
+
+  /* Possible future objects: TARGET_OBJECT_FILE, TARGET_OBJECT_PROC, ... */
 };
 
 extern LONGEST target_read_partial (struct target_ops *ops,
                                    enum target_object object,
-                                   const char *annex, void *buf,
+                                   const char *annex, gdb_byte *buf,
                                    ULONGEST offset, LONGEST len);
 
 extern LONGEST target_write_partial (struct target_ops *ops,
                                     enum target_object object,
-                                    const char *annex, const void *buf,
+                                    const char *annex, const gdb_byte *buf,
                                     ULONGEST offset, LONGEST len);
 
 /* Wrappers to perform the full transfer.  */
 extern LONGEST target_read (struct target_ops *ops,
                            enum target_object object,
-                           const char *annex, void *buf,
+                           const char *annex, gdb_byte *buf,
                            ULONGEST offset, LONGEST len);
 
 extern LONGEST target_write (struct target_ops *ops,
                             enum target_object object,
-                            const char *annex, const void *buf,
+                            const char *annex, const gdb_byte *buf,
                             ULONGEST offset, LONGEST len);
 
 /* Wrappers to target read/write that perform memory transfers.  They
@@ -259,7 +263,7 @@ extern LONGEST target_write (struct target_ops *ops,
    which in turn lifted it from read_memory.  */
 
 extern void get_target_memory (struct target_ops *ops, CORE_ADDR addr,
-                              void *buf, LONGEST len);
+                              gdb_byte *buf, LONGEST len);
 extern ULONGEST get_target_memory_unsigned (struct target_ops *ops,
                                            CORE_ADDR addr, int len);
 \f
@@ -300,7 +304,6 @@ struct target_ops
     void (*to_disconnect) (char *, int);
     void (*to_resume) (ptid_t, int, enum target_signal);
     ptid_t (*to_wait) (ptid_t, struct target_waitstatus *);
-    void (*to_post_wait) (ptid_t, int);
     void (*to_fetch_registers) (int);
     void (*to_store_registers) (int);
     void (*to_prepare_to_store) (void);
@@ -321,24 +324,27 @@ struct target_ops
 
        negative (call its absolute value N) means that we cannot
        transfer right at MEMADDR, but we could transfer at least
-       something at MEMADDR + N.  */
+       something at MEMADDR + N.
 
-    int (*to_xfer_memory) (CORE_ADDR memaddr, char *myaddr,
-                          int len, int write, 
-                          struct mem_attrib *attrib,
-                          struct target_ops *target);
+       NOTE: cagney/2004-10-01: This has been entirely superseeded by
+       to_xfer_partial and inferior inheritance.  */
+
+    int (*deprecated_xfer_memory) (CORE_ADDR memaddr, gdb_byte *myaddr,
+                                  int len, int write,
+                                  struct mem_attrib *attrib,
+                                  struct target_ops *target);
 
     void (*to_files_info) (struct target_ops *);
-    int (*to_insert_breakpoint) (CORE_ADDR, char *);
-    int (*to_remove_breakpoint) (CORE_ADDR, char *);
+    int (*to_insert_breakpoint) (CORE_ADDR, gdb_byte *);
+    int (*to_remove_breakpoint) (CORE_ADDR, gdb_byte *);
     int (*to_can_use_hw_breakpoint) (int, int, int);
-    int (*to_insert_hw_breakpoint) (CORE_ADDR, char *);
-    int (*to_remove_hw_breakpoint) (CORE_ADDR, char *);
+    int (*to_insert_hw_breakpoint) (CORE_ADDR, gdb_byte *);
+    int (*to_remove_hw_breakpoint) (CORE_ADDR, gdb_byte *);
     int (*to_remove_watchpoint) (CORE_ADDR, int, int);
     int (*to_insert_watchpoint) (CORE_ADDR, int, int);
     int (*to_stopped_by_watchpoint) (void);
     int to_have_continuable_watchpoint;
-    CORE_ADDR (*to_stopped_data_address) (void);
+    int (*to_stopped_data_address) (struct target_ops *, CORE_ADDR *);
     int (*to_region_size_ok_for_hw_watchpoint) (int);
     void (*to_terminal_init) (void);
     void (*to_terminal_inferior) (void);
@@ -349,15 +355,15 @@ struct target_ops
     void (*to_kill) (void);
     void (*to_load) (char *, int);
     int (*to_lookup_symbol) (char *, CORE_ADDR *);
-    void (*to_create_inferior) (char *, char *, char **);
+    void (*to_create_inferior) (char *, char *, char **, int);
     void (*to_post_startup_inferior) (ptid_t);
     void (*to_acknowledge_created_inferior) (int);
-    int (*to_insert_fork_catchpoint) (int);
+    void (*to_insert_fork_catchpoint) (int);
     int (*to_remove_fork_catchpoint) (int);
-    int (*to_insert_vfork_catchpoint) (int);
+    void (*to_insert_vfork_catchpoint) (int);
     int (*to_remove_vfork_catchpoint) (int);
     int (*to_follow_fork) (int);
-    int (*to_insert_exec_catchpoint) (int);
+    void (*to_insert_exec_catchpoint) (int);
     int (*to_remove_exec_catchpoint) (int);
     int (*to_reported_exec_events_per_exec_call) (void);
     int (*to_has_exited) (int, int, int *);
@@ -392,10 +398,10 @@ struct target_ops
     void (*to_async) (void (*cb) (enum inferior_event_type, void *context),
                      void *context);
     int to_async_mask_value;
-    int (*to_find_memory_regions) (int (*) (CORE_ADDR, 
-                                           unsigned long, 
-                                           int, int, int, 
-                                           void *), 
+    int (*to_find_memory_regions) (int (*) (CORE_ADDR,
+                                           unsigned long,
+                                           int, int, int,
+                                           void *),
                                   void *);
     char * (*to_make_corefile_notes) (bfd *, int *);
 
@@ -405,7 +411,7 @@ struct target_ops
        thread-local storage hasn't been allocated yet, this function
        may return an error.  */
     CORE_ADDR (*to_get_thread_local_address) (ptid_t ptid,
-                                             struct objfile *objfile,
+                                             CORE_ADDR load_module_addr,
                                              CORE_ADDR offset);
 
     /* Perform partial transfers on OBJECT.  See target_read_partial
@@ -413,7 +419,7 @@ struct target_ops
        only one, of readbuf or writebuf must be non-NULL.  */
     LONGEST (*to_xfer_partial) (struct target_ops *ops,
                                enum target_object object, const char *annex,
-                               void *readbuf, const void *writebuf, 
+                               gdb_byte *readbuf, const gdb_byte *writebuf,
                                ULONGEST offset, LONGEST len);
 
     int to_magic;
@@ -451,9 +457,9 @@ void target_close (struct target_ops *targ, int quitting);
 /* 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.  
+   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 
+   should be ready to deliver the status of the process immediately
    (without waiting) to an upcoming target_wait call.  */
 
 #define        target_attach(args, from_tty)   \
@@ -503,19 +509,6 @@ extern void target_disconnect (char *, int);
 #define        target_wait(ptid, status)               \
      (*current_target.to_wait) (ptid, status)
 
-/* The target_wait operation waits for a process event to occur, and
-   thereby stop the process.
-
-   On some targets, certain events may happen in sequences.  gdb's
-   correct response to any single event of such a sequence may require
-   knowledge of what earlier events in the sequence have been seen.
-
-   This operation provides a target-specific hook that allows the
-   necessary bookkeeping to be performed to track such sequences.  */
-
-#define target_post_wait(ptid, status) \
-     (*current_target.to_post_wait) (ptid, status)
-
 /* Fetch at least register REGNO, or all regs if regno == -1.  No result.  */
 
 #define        target_fetch_registers(regno)   \
@@ -539,19 +532,20 @@ extern void target_disconnect (char *, int);
 
 extern DCACHE *target_dcache;
 
-extern int do_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write,
-                          struct mem_attrib *attrib);
+extern int do_xfer_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len,
+                          int write, struct mem_attrib *attrib);
 
 extern int target_read_string (CORE_ADDR, char **, int, int *);
 
-extern int target_read_memory (CORE_ADDR memaddr, char *myaddr, int len);
+extern int target_read_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len);
 
-extern int target_write_memory (CORE_ADDR memaddr, char *myaddr, int len);
+extern int target_write_memory (CORE_ADDR memaddr, const gdb_byte *myaddr,
+                               int len);
 
-extern int xfer_memory (CORE_ADDR, char *, int, int, 
+extern int xfer_memory (CORE_ADDR, gdb_byte *, int, int,
                        struct mem_attrib *, struct target_ops *);
 
-extern int child_xfer_memory (CORE_ADDR, char *, int, int, 
+extern int child_xfer_memory (CORE_ADDR, gdb_byte *, int, int,
                              struct mem_attrib *, struct target_ops *);
 
 /* Make a single attempt at transfering LEN bytes.  On a successful
@@ -574,17 +568,15 @@ extern char *child_core_file_to_sym_file (char *);
 extern void child_post_attach (int);
 #endif
 
-extern void child_post_wait (ptid_t, int);
-
 extern void child_post_startup_inferior (ptid_t);
 
 extern void child_acknowledge_created_inferior (int);
 
-extern int child_insert_fork_catchpoint (int);
+extern void child_insert_fork_catchpoint (int);
 
 extern int child_remove_fork_catchpoint (int);
 
-extern int child_insert_vfork_catchpoint (int);
+extern void child_insert_vfork_catchpoint (int);
 
 extern int child_remove_vfork_catchpoint (int);
 
@@ -592,7 +584,7 @@ extern void child_acknowledge_created_inferior (int);
 
 extern int child_follow_fork (int);
 
-extern int child_insert_exec_catchpoint (int);
+extern void child_insert_exec_catchpoint (int);
 
 extern int child_remove_exec_catchpoint (int);
 
@@ -629,8 +621,8 @@ extern void print_section_info (struct target_ops *, bfd *);
      (*current_target.to_insert_breakpoint) (addr, save)
 
 /* Remove a breakpoint at address ADDR in the target machine.
-   SAVE is a pointer to the same save area 
-   that was previously passed to target_insert_breakpoint.  
+   SAVE is a pointer to the same save area
+   that was previously passed to target_insert_breakpoint.
    Result is 0 for success, or an errno value.  */
 
 #define        target_remove_breakpoint(addr, save)    \
@@ -708,8 +700,8 @@ extern void target_load (char *arg, int from_tty);
    ENV is the environment vector to pass.  Errors reported with error().
    On VxWorks and various standalone systems, we ignore exec_file.  */
 
-#define        target_create_inferior(exec_file, args, env)    \
-     (*current_target.to_create_inferior) (exec_file, args, env)
+#define        target_create_inferior(exec_file, args, env, FROM_TTY)  \
+     (*current_target.to_create_inferior) (exec_file, args, env, (FROM_TTY))
 
 
 /* Some targets (such as ttrace-based HPUX) don't allow us to request
@@ -782,7 +774,7 @@ extern void target_load (char *arg, int from_tty);
      (*current_target.to_has_exited) (pid,wait_status,exit_status)
 
 /* The debugger has completed a blocking wait() call.  There is now
-   some process event that must be processed.  This function should 
+   some process event that must be processed.  This function should
    be defined by those targets that require the debugger to perform
    cleanup or internal state changes in response to the process event.  */
 
@@ -826,7 +818,7 @@ extern void target_load (char *arg, int from_tty);
 
 
 /* Get the symbol information for a breakpointable routine called when
-   an exception event occurs. 
+   an exception event occurs.
    Intended mainly for C++, and for those
    platforms/implementations where such a callback mechanism is available,
    e.g. HP-UX with ANSI C++ (aCC).  Some compilers (e.g. g++) support
@@ -910,9 +902,7 @@ extern void target_load (char *arg, int from_tty);
 #define        target_async_mask_value \
      (current_target.to_async_mask_value)
 
-extern int target_async_mask (int mask);     
-
-extern void target_link (char *, CORE_ADDR *);
+extern int target_async_mask (int mask);
 
 /* Converts a process id to a string.  Usually, the string just contains
    `process xyz', but on some systems it may contain
@@ -938,26 +928,26 @@ extern char *normal_pid_to_str (ptid_t ptid);
  * New Objfile Event Hook:
  *
  * Sometimes a GDB component wants to get notified whenever a new
- * objfile is loaded.  Mainly this is used by thread-debugging 
+ * objfile is loaded.  Mainly this is used by thread-debugging
  * implementations that need to know when symbols for the target
  * thread implemenation are available.
  *
  * The old way of doing this is to define a macro 'target_new_objfile'
  * that points to the function that you want to be called on every
  * objfile/shlib load.
- *
- * The new way is to grab the function pointer, 'target_new_objfile_hook',
- * and point it to the function that you want to be called on every
- * objfile/shlib load.
- *
- * If multiple clients are willing to be cooperative, they can each
- * save a pointer to the previous value of target_new_objfile_hook
- * before modifying it, and arrange for their function to call the
- * previous function in the chain.  In that way, multiple clients
- * can receive this notification (something like with signal handlers).
- */
 
-extern void (*target_new_objfile_hook) (struct objfile *);
+   The new way is to grab the function pointer,
+   'deprecated_target_new_objfile_hook', and point it to the function
+   that you want to be called on every objfile/shlib load.
+
+   If multiple clients are willing to be cooperative, they can each
+   save a pointer to the previous value of
+   deprecated_target_new_objfile_hook before modifying it, and arrange
+   for their function to call the previous function in the chain.  In
+   that way, multiple clients can receive this notification (something
+   like with signal handlers).  */
+
+extern void (*deprecated_target_new_objfile_hook) (struct objfile *);
 
 #ifndef target_pid_or_tid_to_str
 #define target_pid_or_tid_to_str(ID) \
@@ -983,7 +973,7 @@ extern void (*target_new_objfile_hook) (struct objfile *);
  * Iterator function for target memory regions.
  * Calls a callback function once for each memory region 'mapped'
  * in the child process.  Defined as a simple macro rather than
- * as a function macro so that it can be tested for nullity.  
+ * as a function macro so that it can be tested for nullity.
  */
 
 #define target_find_memory_regions(FUNC, DATA) \
@@ -1026,21 +1016,9 @@ extern void (*target_new_objfile_hook) (struct objfile *);
    (current_target.to_have_continuable_watchpoint)
 #endif
 
-/* HP-UX supplies these operations, which respectively disable and enable
-   the memory page-protections that are used to implement hardware watchpoints
-   on that platform.  See wait_for_inferior's use of these.  */
-
-#if !defined(TARGET_DISABLE_HW_WATCHPOINTS)
-#define TARGET_DISABLE_HW_WATCHPOINTS(pid)
-#endif
-
-#if !defined(TARGET_ENABLE_HW_WATCHPOINTS)
-#define TARGET_ENABLE_HW_WATCHPOINTS(pid)
-#endif
-
 /* Provide defaults for hardware watchpoint functions.  */
 
-/* If the *_hw_beakpoint functions have not been defined 
+/* If the *_hw_beakpoint functions have not been defined
    elsewhere use the definitions in the target vector.  */
 
 /* Returns non-zero if we can set a hardware watchpoint of type TYPE.  TYPE is
@@ -1079,18 +1057,14 @@ extern void (*target_new_objfile_hook) (struct objfile *);
      (*current_target.to_remove_hw_breakpoint) (addr, save)
 #endif
 
-#ifndef target_stopped_data_address
-#define target_stopped_data_address() \
-    (*current_target.to_stopped_data_address) ()
-#endif
-
-/* Sometimes gdb may pick up what appears to be a valid target address
-   from a minimal symbol, but the value really means, essentially,
-   "This is an index into a table which is populated when the inferior
-   is run.  Therefore, do not attempt to use this as a PC."  */
+extern int target_stopped_data_address_p (struct target_ops *);
 
-#if !defined(PC_REQUIRES_RUN_BEFORE_USE)
-#define PC_REQUIRES_RUN_BEFORE_USE(pc) (0)
+#ifndef target_stopped_data_address
+#define target_stopped_data_address(target, x) \
+    (*target.to_stopped_data_address) (target, x)
+#else
+/* Horrible hack to get around existing macros :-(.  */
+#define target_stopped_data_address_p(CURRENT_TARGET) (1)
 #endif
 
 /* This will only be defined by a target that supports catching vfork events,
@@ -1161,13 +1135,13 @@ struct section_table *target_section_by_addr (struct target_ops *target,
 
 /* From mem-break.c */
 
-extern int memory_remove_breakpoint (CORE_ADDR, char *);
+extern int memory_remove_breakpoint (CORE_ADDR, gdb_byte *);
 
-extern int memory_insert_breakpoint (CORE_ADDR, char *);
+extern int memory_insert_breakpoint (CORE_ADDR, gdb_byte *);
 
-extern int default_memory_remove_breakpoint (CORE_ADDR, char *);
+extern int default_memory_remove_breakpoint (CORE_ADDR, gdb_byte *);
 
-extern int default_memory_insert_breakpoint (CORE_ADDR, char *);
+extern int default_memory_insert_breakpoint (CORE_ADDR, gdb_byte *);
 
 
 /* From target.c */
@@ -1178,7 +1152,7 @@ extern void noprocess (void);
 
 extern void find_default_attach (char *, int);
 
-extern void find_default_create_inferior (char *, char *, char **);
+extern void find_default_create_inferior (char *, char *, char **, int);
 
 extern struct target_ops *find_run_target (void);
 
@@ -1242,4 +1216,6 @@ extern void push_remote_target (char *name, int from_tty);
 /* Blank target vector entries are initialized to target_ignore. */
 void target_ignore (void);
 
+extern struct target_ops deprecated_child_ops;
+
 #endif /* !defined (TARGET_H) */
This page took 0.033977 seconds and 4 git commands to generate.