Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@redhat.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tromey@redhat.com>
Subject: [RFC v2 20/38] convert to_load
Date: Thu, 06 Feb 2014 20:58:00 -0000	[thread overview]
Message-ID: <1391720136-2121-21-git-send-email-tromey@redhat.com> (raw)
In-Reply-To: <1391720136-2121-1-git-send-email-tromey@redhat.com>

2014-02-06  Tom Tromey  <tromey@redhat.com>

	* target-delegates.c: Rebuild.
	* target.c (update_current_target): Don't inherit or default
	to_load.
	* target.h (struct target_ops) <to_load>: Use
	TARGET_DEFAULT_NORETURN.

convert to_post_startup_inferior

2014-02-06  Tom Tromey  <tromey@redhat.com>

	* target-delegates.c: Rebuild.
	* target.c (update_current_target): Don't inherit or default
	to_post_startup_inferior.
	* target.h (struct target_ops) <to_post_startup_inferior>: Use
	TARGET_DEFAULT_IGNORE.

convert to_insert_fork_catchpoint

2014-02-06  Tom Tromey  <tromey@redhat.com>

	* target-delegates.c: Rebuild.
	* target.c (update_current_target): Don't inherit or default
	to_insert_fork_catchpoint.
	* target.h (struct target_ops) <to_insert_fork_catchpoint>: Use
	TARGET_DEFAULT_RETURN.

convert to_remove_fork_catchpoint

2014-02-06  Tom Tromey  <tromey@redhat.com>

	* target-delegates.c: Rebuild.
	* target.c (update_current_target): Don't inherit or default
	to_remove_fork_catchpoint.
	* target.h (struct target_ops) <to_remove_fork_catchpoint>: Use
	TARGET_DEFAULT_RETURN.

convert to_insert_vfork_catchpoint

2014-02-06  Tom Tromey  <tromey@redhat.com>

	* target-delegates.c: Rebuild.
	* target.c (update_current_target): Don't inherit or default
	to_insert_vfork_catchpoint.
	* target.h (struct target_ops) <to_insert_vfork_catchpoint>: Use
	TARGET_DEFAULT_RETURN.

convert to_remove_vfork_catchpoint

2014-02-06  Tom Tromey  <tromey@redhat.com>

	* target-delegates.c: Rebuild.
	* target.c (update_current_target): Don't inherit or default
	to_remove_vfork_catchpoint.
	* target.h (struct target_ops) <to_remove_vfork_catchpoint>: Use
	TARGET_DEFAULT_RETURN.

convert to_insert_exec_catchpoint

2014-02-06  Tom Tromey  <tromey@redhat.com>

	* target-delegates.c: Rebuild.
	* target.c (update_current_target): Don't inherit or default
	to_insert_exec_catchpoint.
	* target.h (struct target_ops) <to_insert_exec_catchpoint>: Use
	TARGET_DEFAULT_RETURN.

convert to_remove_exec_catchpoint

2014-02-06  Tom Tromey  <tromey@redhat.com>

	* target-delegates.c: Rebuild.
	* target.c (update_current_target): Don't inherit or default
	to_insert_exec_catchpoint.
	* target.h (struct target_ops) <to_insert_exec_catchpoint>: Use
	TARGET_DEFAULT_RETURN.

convert to_set_syscall_catchpoint

2014-02-06  Tom Tromey  <tromey@redhat.com>

	* target-delegates.c: Rebuild.
	* target.c (update_current_target): Don't inherit or default
	to_set_syscall_catchpoint.
	(return_one): Remove.
	* target.h (struct target_ops) <to_set_syscall_catchpoint>: Use
	TARGET_DEFAULT_RETURN.

convert to_has_exited

2014-02-06  Tom Tromey  <tromey@redhat.com>

	* target-delegates.c: Rebuild.
	* target.c (update_current_target): Don't inherit or default
	to_has_exited.
	* target.h (struct target_ops) <to_has_exited>: Use
	TARGET_DEFAULT_RETURN..
---
 gdb/ChangeLog          |  81 +++++++++++++++++++++++++
 gdb/target-delegates.c | 159 +++++++++++++++++++++++++++++++++++++++++++++++++
 gdb/target.c           |  58 ++++--------------
 gdb/target.h           |  30 ++++++----
 4 files changed, 270 insertions(+), 58 deletions(-)

diff --git a/gdb/target-delegates.c b/gdb/target-delegates.c
index 7a673ee..1ac0fc2 100644
--- a/gdb/target-delegates.c
+++ b/gdb/target-delegates.c
@@ -298,6 +298,135 @@ delegate_terminal_info (struct target_ops *self, const char *arg1, int arg2)
 }
 
 static void
+delegate_load (struct target_ops *self, char *arg1, int arg2)
+{
+  self = self->beneath;
+  self->to_load (self, arg1, arg2);
+}
+
+static void
+tdefault_load (struct target_ops *self, char *arg1, int arg2)
+{
+  tcomplain ();
+}
+
+static void
+delegate_post_startup_inferior (struct target_ops *self, ptid_t arg1)
+{
+  self = self->beneath;
+  self->to_post_startup_inferior (self, arg1);
+}
+
+static void
+tdefault_post_startup_inferior (struct target_ops *self, ptid_t arg1)
+{
+}
+
+static int
+delegate_insert_fork_catchpoint (struct target_ops *self, int arg1)
+{
+  self = self->beneath;
+  return self->to_insert_fork_catchpoint (self, arg1);
+}
+
+static int
+tdefault_insert_fork_catchpoint (struct target_ops *self, int arg1)
+{
+  return 1;
+}
+
+static int
+delegate_remove_fork_catchpoint (struct target_ops *self, int arg1)
+{
+  self = self->beneath;
+  return self->to_remove_fork_catchpoint (self, arg1);
+}
+
+static int
+tdefault_remove_fork_catchpoint (struct target_ops *self, int arg1)
+{
+  return 1;
+}
+
+static int
+delegate_insert_vfork_catchpoint (struct target_ops *self, int arg1)
+{
+  self = self->beneath;
+  return self->to_insert_vfork_catchpoint (self, arg1);
+}
+
+static int
+tdefault_insert_vfork_catchpoint (struct target_ops *self, int arg1)
+{
+  return 1;
+}
+
+static int
+delegate_remove_vfork_catchpoint (struct target_ops *self, int arg1)
+{
+  self = self->beneath;
+  return self->to_remove_vfork_catchpoint (self, arg1);
+}
+
+static int
+tdefault_remove_vfork_catchpoint (struct target_ops *self, int arg1)
+{
+  return 1;
+}
+
+static int
+delegate_insert_exec_catchpoint (struct target_ops *self, int arg1)
+{
+  self = self->beneath;
+  return self->to_insert_exec_catchpoint (self, arg1);
+}
+
+static int
+tdefault_insert_exec_catchpoint (struct target_ops *self, int arg1)
+{
+  return 1;
+}
+
+static int
+delegate_remove_exec_catchpoint (struct target_ops *self, int arg1)
+{
+  self = self->beneath;
+  return self->to_remove_exec_catchpoint (self, arg1);
+}
+
+static int
+tdefault_remove_exec_catchpoint (struct target_ops *self, int arg1)
+{
+  return 1;
+}
+
+static int
+delegate_set_syscall_catchpoint (struct target_ops *self, int arg1, int arg2, int arg3, int arg4, int *arg5)
+{
+  self = self->beneath;
+  return self->to_set_syscall_catchpoint (self, arg1, arg2, arg3, arg4, arg5);
+}
+
+static int
+tdefault_set_syscall_catchpoint (struct target_ops *self, int arg1, int arg2, int arg3, int arg4, int *arg5)
+{
+  return 1;
+}
+
+static int
+delegate_has_exited (struct target_ops *self, int arg1, int arg2, int *arg3)
+{
+  self = self->beneath;
+  return self->to_has_exited (self, arg1, arg2, arg3);
+}
+
+static int
+tdefault_has_exited (struct target_ops *self, int arg1, int arg2, int *arg3)
+{
+  return 0;
+}
+
+static void
 delegate_rcmd (struct target_ops *self, char *arg1, struct ui_file *arg2)
 {
   self = self->beneath;
@@ -412,6 +541,26 @@ install_delegators (struct target_ops *ops)
     ops->to_terminal_save_ours = delegate_terminal_save_ours;
   if (ops->to_terminal_info == NULL)
     ops->to_terminal_info = delegate_terminal_info;
+  if (ops->to_load == NULL)
+    ops->to_load = delegate_load;
+  if (ops->to_post_startup_inferior == NULL)
+    ops->to_post_startup_inferior = delegate_post_startup_inferior;
+  if (ops->to_insert_fork_catchpoint == NULL)
+    ops->to_insert_fork_catchpoint = delegate_insert_fork_catchpoint;
+  if (ops->to_remove_fork_catchpoint == NULL)
+    ops->to_remove_fork_catchpoint = delegate_remove_fork_catchpoint;
+  if (ops->to_insert_vfork_catchpoint == NULL)
+    ops->to_insert_vfork_catchpoint = delegate_insert_vfork_catchpoint;
+  if (ops->to_remove_vfork_catchpoint == NULL)
+    ops->to_remove_vfork_catchpoint = delegate_remove_vfork_catchpoint;
+  if (ops->to_insert_exec_catchpoint == NULL)
+    ops->to_insert_exec_catchpoint = delegate_insert_exec_catchpoint;
+  if (ops->to_remove_exec_catchpoint == NULL)
+    ops->to_remove_exec_catchpoint = delegate_remove_exec_catchpoint;
+  if (ops->to_set_syscall_catchpoint == NULL)
+    ops->to_set_syscall_catchpoint = delegate_set_syscall_catchpoint;
+  if (ops->to_has_exited == NULL)
+    ops->to_has_exited = delegate_has_exited;
   if (ops->to_rcmd == NULL)
     ops->to_rcmd = delegate_rcmd;
   if (ops->to_can_async_p == NULL)
@@ -455,6 +604,16 @@ install_dummy_methods (struct target_ops *ops)
   ops->to_terminal_ours = tdefault_terminal_ours;
   ops->to_terminal_save_ours = tdefault_terminal_save_ours;
   ops->to_terminal_info = default_terminal_info;
+  ops->to_load = tdefault_load;
+  ops->to_post_startup_inferior = tdefault_post_startup_inferior;
+  ops->to_insert_fork_catchpoint = tdefault_insert_fork_catchpoint;
+  ops->to_remove_fork_catchpoint = tdefault_remove_fork_catchpoint;
+  ops->to_insert_vfork_catchpoint = tdefault_insert_vfork_catchpoint;
+  ops->to_remove_vfork_catchpoint = tdefault_remove_vfork_catchpoint;
+  ops->to_insert_exec_catchpoint = tdefault_insert_exec_catchpoint;
+  ops->to_remove_exec_catchpoint = tdefault_remove_exec_catchpoint;
+  ops->to_set_syscall_catchpoint = tdefault_set_syscall_catchpoint;
+  ops->to_has_exited = tdefault_has_exited;
   ops->to_rcmd = default_rcmd;
   ops->to_can_async_p = find_default_can_async_p;
   ops->to_is_async_p = find_default_is_async_p;
diff --git a/gdb/target.c b/gdb/target.c
index 0c31f47..9def149 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -63,8 +63,6 @@ static int nomemory (CORE_ADDR, char *, int, int, struct target_ops *);
 
 static int return_zero (void);
 
-static int return_one (void);
-
 static int return_minus_one (void);
 
 static void *return_null (void);
@@ -627,18 +625,18 @@ update_current_target (void)
       /* Do not inherit to_terminal_save_ours.  */
       /* Do not inherit to_terminal_info.  */
       /* Do not inherit to_kill.  */
-      INHERIT (to_load, t);
+      /* Do not inherit to_load.  */
       /* Do no inherit to_create_inferior.  */
-      INHERIT (to_post_startup_inferior, t);
-      INHERIT (to_insert_fork_catchpoint, t);
-      INHERIT (to_remove_fork_catchpoint, t);
-      INHERIT (to_insert_vfork_catchpoint, t);
-      INHERIT (to_remove_vfork_catchpoint, t);
+      /* Do not inherit to_post_startup_inferior.  */
+      /* Do not inherit to_insert_fork_catchpoint.  */
+      /* Do not inherit to_remove_fork_catchpoint.  */
+      /* Do not inherit to_insert_vfork_catchpoint.  */
+      /* Do not inherit to_remove_vfork_catchpoint.  */
       /* Do not inherit to_follow_fork.  */
-      INHERIT (to_insert_exec_catchpoint, t);
-      INHERIT (to_remove_exec_catchpoint, t);
-      INHERIT (to_set_syscall_catchpoint, t);
-      INHERIT (to_has_exited, t);
+      /* Do not inherit to_insert_exec_catchpoint.  */
+      /* Do not inherit to_remove_exec_catchpoint.  */
+      /* Do not inherit to_set_syscall_catchpoint.  */
+      /* Do not inherit to_has_exited.  */
       /* Do not inherit to_mourn_inferior.  */
       INHERIT (to_can_run, t);
       /* Do not inherit to_pass_signals.  */
@@ -734,36 +732,6 @@ update_current_target (void)
 	    (int (*) (CORE_ADDR, gdb_byte *, int, int,
 		      struct mem_attrib *, struct target_ops *))
 	    nomemory);
-  de_fault (to_load,
-	    (void (*) (struct target_ops *, char *, int))
-	    tcomplain);
-  de_fault (to_post_startup_inferior,
-	    (void (*) (struct target_ops *, ptid_t))
-	    target_ignore);
-  de_fault (to_insert_fork_catchpoint,
-	    (int (*) (struct target_ops *, int))
-	    return_one);
-  de_fault (to_remove_fork_catchpoint,
-	    (int (*) (struct target_ops *, int))
-	    return_one);
-  de_fault (to_insert_vfork_catchpoint,
-	    (int (*) (struct target_ops *, int))
-	    return_one);
-  de_fault (to_remove_vfork_catchpoint,
-	    (int (*) (struct target_ops *, int))
-	    return_one);
-  de_fault (to_insert_exec_catchpoint,
-	    (int (*) (struct target_ops *, int))
-	    return_one);
-  de_fault (to_remove_exec_catchpoint,
-	    (int (*) (struct target_ops *, int))
-	    return_one);
-  de_fault (to_set_syscall_catchpoint,
-	    (int (*) (struct target_ops *, int, int, int, int, int *))
-	    return_one);
-  de_fault (to_has_exited,
-	    (int (*) (struct target_ops *, int, int, int *))
-	    return_zero);
   de_fault (to_can_run,
 	    (int (*) (struct target_ops *))
 	    return_zero);
@@ -3554,12 +3522,6 @@ return_zero (void)
 }
 
 static int
-return_one (void)
-{
-  return 1;
-}
-
-static int
 return_minus_one (void)
 {
   return -1;
diff --git a/gdb/target.h b/gdb/target.h
index 001b161..98f8687 100644
--- a/gdb/target.h
+++ b/gdb/target.h
@@ -504,20 +504,30 @@ struct target_ops
     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 *);
 
-- 
1.8.1.4


  parent reply	other threads:[~2014-02-06 20:58 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-06 20:55 [RFC v2 00/38] clean up target delegation Tom Tromey
2014-02-06 20:55 ` [RFC v2 16/38] Add target_ops argument to to_static_tracepoint_markers_by_strid Tom Tromey
2014-02-06 20:55 ` [RFC v2 03/38] add make-target-delegates Tom Tromey
2014-02-06 20:55 ` [RFC v2 09/38] Add target_ops argument to to_insert_vfork_catchpoint Tom Tromey
2014-02-06 20:55 ` [RFC v2 08/38] Add target_ops argument to to_terminal_init Tom Tromey
2014-02-06 20:55 ` [RFC v2 02/38] introduce and use find_target_at Tom Tromey
2014-02-07 15:43   ` Pedro Alves
2014-02-07 21:54     ` Tom Tromey
2014-02-10 14:28       ` Pedro Alves
2014-02-06 20:56 ` [RFC v2 29/38] convert to_search_memory Tom Tromey
2014-02-06 20:56 ` [RFC v2 35/38] remove some calls to INHERIT and de_fault Tom Tromey
2014-02-06 20:56 ` [RFC v2 01/38] add "this" pointers to more target APIs Tom Tromey
2014-02-08  5:19   ` Doug Evans
2014-02-10 22:36     ` Doug Evans
2014-02-10 23:01       ` Doug Evans
2014-02-12 19:56       ` Tom Tromey
2014-02-12 20:22         ` Doug Evans
2014-02-06 20:56 ` [RFC v2 22/38] convert to_thread_architecture Tom Tromey
2014-02-06 20:56 ` [RFC v2 07/38] Add target_ops argument to to_close Tom Tromey
2014-02-08  3:00   ` Yao Qi
2014-02-10 17:50     ` Tom Tromey
2014-02-06 20:56 ` [RFC v2 37/38] fix buglet in nto-procfs.c Tom Tromey
2014-02-07 16:01   ` Pedro Alves
2014-02-06 20:56 ` [RFC v2 27/38] convert to_get_section_table Tom Tromey
2014-02-06 20:56 ` [RFC v2 28/38] convert to_insn_history Tom Tromey
2014-02-06 20:56 ` [RFC v2 23/38] convert to_disable_tracepoint Tom Tromey
2014-02-06 20:56 ` [RFC v2 10/38] Add target_ops argument to to_thread_name Tom Tromey
2014-02-06 20:56 ` [RFC v2 21/38] convert to_extra_thread_info Tom Tromey
2014-02-06 20:56 ` [RFC v2 26/38] convert to_insert_mask_watchpoint Tom Tromey
2014-02-06 20:56 ` [RFC v2 34/38] remove exec_set_find_memory_regions Tom Tromey
2014-02-06 20:56 ` [RFC v2 24/38] convert to_upload_trace_state_variables Tom Tromey
2014-02-06 20:56 ` [RFC v2 32/38] remove function casts from target.c Tom Tromey
2014-02-06 20:56 ` [RFC v2 36/38] convert to_decr_pc_after_break Tom Tromey
2014-02-06 20:58 ` [RFC v2 25/38] convert to_static_tracepoint_markers_by_strid Tom Tromey
2014-02-06 20:58 ` [RFC v2 11/38] Add target_ops argument to to_get_ada_task_ptid Tom Tromey
2014-02-06 20:58 ` [RFC v2 17/38] Add target_ops argument to to_save_record Tom Tromey
2014-02-06 20:58 ` [RFC v2 04/38] add target method delegation Tom Tromey
2014-02-07 15:53   ` Pedro Alves
2014-02-07 21:37     ` Tom Tromey
2014-02-06 20:58 ` Tom Tromey [this message]
2014-02-06 21:23 ` [RFC v2 06/38] introduce remote_load Tom Tromey
2014-02-06 21:23 ` [RFC v2 12/38] Add target_ops argument to to_can_execute_reverse Tom Tromey
2014-02-06 21:23 ` [RFC v2 19/38] convert to_remove_watchpoint Tom Tromey
2014-02-06 21:23 ` [RFC v2 15/38] Add target_ops argument to to_upload_trace_state_variables Tom Tromey
2014-02-06 21:24 ` [RFC v2 31/38] minor cleanups to update_current_target Tom Tromey
2014-02-06 21:24 ` [RFC v2 13/38] Add target_ops argument to to_fileio_pwrite Tom Tromey
2014-02-06 21:24 ` [RFC v2 14/38] Add target_ops argument to to_disable_tracepoint Tom Tromey
2014-02-06 21:24 ` [RFC v2 05/38] convert to_supports_btrace Tom Tromey
2014-02-06 21:38 ` [RFC v2 30/38] change delegation for to_read_description Tom Tromey
2014-02-06 21:38 ` [RFC v2 33/38] pass NULL to TARGET_DEFAULT_RETURN when appropriate Tom Tromey
2014-02-06 21:42 ` [RFC v2 18/38] convert to_detach Tom Tromey
2014-02-06 21:47 ` [RFC v2 38/38] convert to_get_unwinder and to_get_tailcall_unwinder to methods Tom Tromey
2014-02-07 16:02   ` Pedro Alves
2014-02-07 16:47 ` [RFC v2 00/38] clean up target delegation Pedro Alves
2014-02-19 16:35 ` Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1391720136-2121-21-git-send-email-tromey@redhat.com \
    --to=tromey@redhat.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox