gdbserver: turn target op 'request_interrupt' into a method
[binutils-gdb.git] / gdbserver / target.h
index 923c92c7cb8d4085b6f365904dc8afe342fdd4b5..234a183427e7b85e6b844a05f5a38c672fa8f7f6 100644 (file)
@@ -70,84 +70,6 @@ class process_target;
    shared code.  */
 struct process_stratum_target
 {
-  /* Resume the inferior process.  */
-
-  void (*resume) (struct thread_resume *resume_info, size_t n);
-
-  /* Wait for the inferior process or thread to change state.  Store
-     status through argument pointer STATUS.
-
-     PTID = -1 to wait for any pid to do something, PTID(pid,0,0) to
-     wait for any thread of process pid to do something.  Return ptid
-     of child, or -1 in case of error; store status through argument
-     pointer STATUS.  OPTIONS is a bit set of options defined as
-     TARGET_W* above.  If options contains TARGET_WNOHANG and there's
-     no child stop to report, return is
-     null_ptid/TARGET_WAITKIND_IGNORE.  */
-
-  ptid_t (*wait) (ptid_t ptid, struct target_waitstatus *status, int options);
-
-  /* Fetch registers from the inferior process.
-
-     If REGNO is -1, fetch all registers; otherwise, fetch at least REGNO.  */
-
-  void (*fetch_registers) (struct regcache *regcache, int regno);
-
-  /* Store registers to the inferior process.
-
-     If REGNO is -1, store all registers; otherwise, store at least REGNO.  */
-
-  void (*store_registers) (struct regcache *regcache, int regno);
-
-  /* Prepare to read or write memory from the inferior process.
-     Targets use this to do what is necessary to get the state of the
-     inferior such that it is possible to access memory.
-
-     This should generally only be called from client facing routines,
-     such as gdb_read_memory/gdb_write_memory, or the GDB breakpoint
-     insertion routine.
-
-     Like `read_memory' and `write_memory' below, returns 0 on success
-     and errno on failure.  */
-
-  int (*prepare_to_access_memory) (void);
-
-  /* Undo the effects of prepare_to_access_memory.  */
-
-  void (*done_accessing_memory) (void);
-
-  /* Read memory from the inferior process.  This should generally be
-     called through read_inferior_memory, which handles breakpoint shadowing.
-
-     Read LEN bytes at MEMADDR into a buffer at MYADDR.
-  
-     Returns 0 on success and errno on failure.  */
-
-  int (*read_memory) (CORE_ADDR memaddr, unsigned char *myaddr, int len);
-
-  /* Write memory to the inferior process.  This should generally be
-     called through target_write_memory, which handles breakpoint shadowing.
-
-     Write LEN bytes from the buffer at MYADDR to MEMADDR.
-
-     Returns 0 on success and errno on failure.  */
-
-  int (*write_memory) (CORE_ADDR memaddr, const unsigned char *myaddr,
-                      int len);
-
-  /* Query GDB for the values of any symbols we're interested in.
-     This function is called whenever we receive a "qSymbols::"
-     query, which corresponds to every time more symbols (might)
-     become available.  NULL if we aren't interested in any
-     symbols.  */
-
-  void (*look_up_symbols) (void);
-
-  /* Send an interrupt request to the inferior process,
-     however is appropriate.  */
-
-  void (*request_interrupt) (void);
-
   /* Read auxiliary vector data from the inferior process.
 
      Read LEN bytes at OFFSET into a buffer at MYADDR.  */
@@ -483,6 +405,75 @@ public:
 
   /* Return true iff the thread with process ID PID is alive.  */
   virtual bool thread_alive (ptid_t pid) = 0;
+
+  /* Resume the inferior process.  */
+  virtual void resume (thread_resume *resume_info, size_t n) = 0;
+
+  /* Wait for the inferior process or thread to change state.  Store
+     status through argument pointer STATUS.
+
+     PTID = -1 to wait for any pid to do something, PTID(pid,0,0) to
+     wait for any thread of process pid to do something.  Return ptid
+     of child, or -1 in case of error; store status through argument
+     pointer STATUS.  OPTIONS is a bit set of options defined as
+     TARGET_W* above.  If options contains TARGET_WNOHANG and there's
+     no child stop to report, return is
+     null_ptid/TARGET_WAITKIND_IGNORE.  */
+  virtual ptid_t wait (ptid_t ptid, target_waitstatus *status,
+                      int options) = 0;
+
+  /* Fetch registers from the inferior process.
+
+     If REGNO is -1, fetch all registers; otherwise, fetch at least REGNO.  */
+  virtual void fetch_registers (regcache *regcache, int regno) = 0;
+
+  /* Store registers to the inferior process.
+
+     If REGNO is -1, store all registers; otherwise, store at least REGNO.  */
+  virtual void store_registers (regcache *regcache, int regno) = 0;
+
+  /* Prepare to read or write memory from the inferior process.
+     Targets use this to do what is necessary to get the state of the
+     inferior such that it is possible to access memory.
+
+     This should generally only be called from client facing routines,
+     such as gdb_read_memory/gdb_write_memory, or the GDB breakpoint
+     insertion routine.
+
+     Like `read_memory' and `write_memory' below, returns 0 on success
+     and errno on failure.  */
+  virtual int prepare_to_access_memory ();
+
+  /* Undo the effects of prepare_to_access_memory.  */
+  virtual void done_accessing_memory ();
+
+  /* Read memory from the inferior process.  This should generally be
+     called through read_inferior_memory, which handles breakpoint shadowing.
+
+     Read LEN bytes at MEMADDR into a buffer at MYADDR.
+
+     Returns 0 on success and errno on failure.  */
+  virtual int read_memory (CORE_ADDR memaddr, unsigned char *myaddr,
+                          int len) = 0;
+
+  /* Write memory to the inferior process.  This should generally be
+     called through target_write_memory, which handles breakpoint shadowing.
+
+     Write LEN bytes from the buffer at MYADDR to MEMADDR.
+
+     Returns 0 on success and errno on failure.  */
+  virtual int write_memory (CORE_ADDR memaddr, const unsigned char *myaddr,
+                           int len) = 0;
+
+  /* Query GDB for the values of any symbols we're interested in.
+     This function is called whenever we receive a "qSymbols::"
+     query, which corresponds to every time more symbols (might)
+     become available.  */
+  virtual void look_up_symbols ();
+
+  /* Send an interrupt request to the inferior process,
+     however is appropriate.  */
+  virtual void request_interrupt () = 0;
 };
 
 extern process_stratum_target *the_target;
@@ -526,10 +517,10 @@ int kill_inferior (process_info *proc);
   the_target->pt->thread_alive (pid)
 
 #define fetch_inferior_registers(regcache, regno)      \
-  (*the_target->fetch_registers) (regcache, regno)
+  the_target->pt->fetch_registers (regcache, regno)
 
 #define store_inferior_registers(regcache, regno) \
-  (*the_target->store_registers) (regcache, regno)
+  the_target->pt->store_registers (regcache, regno)
 
 #define join_inferior(pid) \
   the_target->pt->join (pid)