GDBserver: Pass process_info pointer to target_kill
[deliverable/binutils-gdb.git] / gdb / gdbserver / target.h
index 295e64d7cbc135acdacc162417c80c276f340186..fce54e05adbc3b6509cb2c891a067154cc72cd4f 100644 (file)
@@ -90,21 +90,22 @@ struct target_ops
 
   int (*attach) (unsigned long pid);
 
-  /* Kill inferior PID.  Return -1 on failure, and 0 on success.  */
+  /* Kill process PROC.  Return -1 on failure, and 0 on success.  */
 
-  int (*kill) (int pid);
+  int (*kill) (process_info *proc);
 
-  /* Detach from inferior PID. Return -1 on failure, and 0 on
+  /* Detach from process PROC.  Return -1 on failure, and 0 on
      success.  */
 
-  int (*detach) (int pid);
+  int (*detach) (process_info *proc);
 
   /* The inferior process has died.  Do what is right.  */
 
   void (*mourn) (struct process_info *proc);
 
-  /* Wait for inferior PID to exit.  */
-  void (*join) (int pid);
+  /* Wait for process PROC to exit.  */
+
+  void (*join) (process_info *proc);
 
   /* Return 1 iff the thread with process ID PID is alive.  */
 
@@ -391,9 +392,6 @@ struct target_ops
   /* Return true if target supports debugging agent.  */
   int (*supports_agent) (void);
 
-  /* Check whether the target supports branch tracing.  */
-  int (*supports_btrace) (struct target_ops *, enum btrace_format);
-
   /* Enable branch tracing for PTID based on CONF and allocate a branch trace
      target information struct for reading and for disabling branch trace.  */
   struct btrace_target_info *(*enable_btrace)
@@ -499,7 +497,7 @@ void set_target_ops (struct target_ops *);
 #define myattach(pid) \
   (*the_target->attach) (pid)
 
-int kill_inferior (int);
+int kill_inferior (process_info *proc);
 
 #define target_supports_fork_events() \
   (the_target->supports_fork_events ? \
@@ -520,8 +518,8 @@ int kill_inferior (int);
        (*the_target->handle_new_gdb_connection) ();     \
     } while (0)
 
-#define detach_inferior(pid) \
-  (*the_target->detach) (pid)
+#define detach_inferior(proc) \
+  (*the_target->detach) (proc)
 
 #define mythread_alive(pid) \
   (*the_target->thread_alive) (pid)
@@ -532,8 +530,8 @@ int kill_inferior (int);
 #define store_inferior_registers(regcache, regno) \
   (*the_target->store_registers) (regcache, regno)
 
-#define join_inferior(pid) \
-  (*the_target->join) (pid)
+#define join_inferior(proc) \
+  (*the_target->join) (proc)
 
 #define target_supports_non_stop() \
   (the_target->supports_non_stop ? (*the_target->supports_non_stop ) () : 0)
@@ -623,21 +621,44 @@ int kill_inferior (int);
   (the_target->supports_agent ? \
    (*the_target->supports_agent) () : 0)
 
-#define target_supports_btrace(format)                 \
-  (the_target->supports_btrace                         \
-   ? (*the_target->supports_btrace) (the_target, format) : 0)
+static inline struct btrace_target_info *
+target_enable_btrace (ptid_t ptid, const struct btrace_config *conf)
+{
+  if (the_target->enable_btrace == nullptr)
+    error (_("Target does not support branch tracing."));
 
-#define target_enable_btrace(ptid, conf) \
-  (*the_target->enable_btrace) (ptid, conf)
+  return (*the_target->enable_btrace) (ptid, conf);
+}
+
+static inline int
+target_disable_btrace (struct btrace_target_info *tinfo)
+{
+  if (the_target->disable_btrace == nullptr)
+    error (_("Target does not support branch tracing."));
 
-#define target_disable_btrace(tinfo) \
-  (*the_target->disable_btrace) (tinfo)
+  return (*the_target->disable_btrace) (tinfo);
+}
 
-#define target_read_btrace(tinfo, buffer, type)        \
-  (*the_target->read_btrace) (tinfo, buffer, type)
+static inline int
+target_read_btrace (struct btrace_target_info *tinfo,
+                   struct buffer *buffer,
+                   enum btrace_read_type type)
+{
+  if (the_target->read_btrace == nullptr)
+    error (_("Target does not support branch tracing."));
+
+  return (*the_target->read_btrace) (tinfo, buffer, type);
+}
+
+static inline int
+target_read_btrace_conf (struct btrace_target_info *tinfo,
+                        struct buffer *buffer)
+{
+  if (the_target->read_btrace_conf == nullptr)
+    error (_("Target does not support branch tracing."));
 
-#define target_read_btrace_conf(tinfo, buffer) \
-  (*the_target->read_btrace_conf) (tinfo, buffer)
+  return (*the_target->read_btrace_conf) (tinfo, buffer);
+}
 
 #define target_supports_range_stepping() \
   (the_target->supports_range_stepping ? \
This page took 0.026095 seconds and 4 git commands to generate.