This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFA] Kill exec_error_cleanup


Presently, exec_error_cleanup is used only by async mode,
in order to call async_enable_stdin. It's also somewhat confusing,
because it's run even if there's no error. There's no reason
why we could not call async_enable_stdin ourself, and remove
one level of abstraction. This patch does so.

OK?

- Volodya

---
 gdb/defs.h           |    3 ---
 gdb/event-loop.c     |    2 +-
 gdb/event-top.c      |    7 +------
 gdb/event-top.h      |    2 +-
 gdb/inf-loop.c       |   14 ++++++--------
 gdb/tui/tui-interp.c |    2 +-
 gdb/utils.c          |   20 --------------------
 7 files changed, 10 insertions(+), 40 deletions(-)

diff --git a/gdb/defs.h b/gdb/defs.h
index 3486df8..e4344a7 100644
--- a/gdb/defs.h
+++ b/gdb/defs.h
@@ -319,11 +319,9 @@ extern char *safe_strerror (int);
 extern void do_cleanups (struct cleanup *);
 extern void do_final_cleanups (struct cleanup *);
 extern void do_exec_cleanups (struct cleanup *);
-extern void do_exec_error_cleanups (struct cleanup *);
 
 extern void discard_cleanups (struct cleanup *);
 extern void discard_final_cleanups (struct cleanup *);
-extern void discard_exec_error_cleanups (struct cleanup *);
 extern void discard_my_cleanups (struct cleanup **, struct cleanup *);
 
 /* NOTE: cagney/2000-03-04: This typedef is strictly for the
@@ -354,7 +352,6 @@ extern struct cleanup *make_my_cleanup (struct cleanup **,
 					make_cleanup_ftype *, void *);
 
 extern struct cleanup *make_exec_cleanup (make_cleanup_ftype *, void *);
-extern struct cleanup *make_exec_error_cleanup (make_cleanup_ftype *, void *);
 
 extern struct cleanup *save_cleanups (void);
 extern struct cleanup *save_final_cleanups (void);
diff --git a/gdb/event-loop.c b/gdb/event-loop.c
index 348ffef..5edd669 100644
--- a/gdb/event-loop.c
+++ b/gdb/event-loop.c
@@ -414,7 +414,7 @@ start_event_loop (void)
 	  /* If any exception escaped to here, we better enable
 	     stdin.  Otherwise, any command that calls async_disable_stdin,
 	     and the can throw, will leave stdin inoperable.  */
-	  async_enable_stdin ((void *) 0);
+	  async_enable_stdin ();
 	  /* FIXME: this should really be a call to a hook that is
 	     interface specific, because interfaces can display the
 	     prompt in their own way. */
diff --git a/gdb/event-top.c b/gdb/event-top.c
index 9bd64f8..cec1f91 100644
--- a/gdb/event-top.c
+++ b/gdb/event-top.c
@@ -435,7 +435,7 @@ stdin_event_handler (int error, gdb_client_data client_data)
    the exec operation. */
 
 void
-async_enable_stdin (void *dummy)
+async_enable_stdin (void)
 {
   if (sync_execution)
     {
@@ -463,11 +463,6 @@ async_disable_stdin (void)
      sync/async mode) is refined, the duplicate calls can be
      eliminated (Here or in infcmd.c/infrun.c). */
   target_terminal_inferior ();
-  /* Add the reinstate of stdin to the list of cleanups to be done
-     in case the target errors out and dies. These cleanups are also
-     done in case of normal successful termination of the execution
-     command, by complete_execution(). */
-  make_exec_error_cleanup (async_enable_stdin, NULL);
 }
 
 
diff --git a/gdb/event-top.h b/gdb/event-top.h
index 21831fa..3c6dba7 100644
--- a/gdb/event-top.h
+++ b/gdb/event-top.h
@@ -103,7 +103,7 @@ extern void mark_async_signal_handler_wrapper (void *token);
 extern void async_request_quit (void *arg);
 extern void stdin_event_handler (int error, void *client_data);
 extern void async_disable_stdin (void);
-extern void async_enable_stdin (void *dummy);
+extern void async_enable_stdin (void);
 
 /* Exported variables from event-top.c.
    FIXME: these should really go into top.h.  */
diff --git a/gdb/inf-loop.c b/gdb/inf-loop.c
index f789868..0b90979 100644
--- a/gdb/inf-loop.c
+++ b/gdb/inf-loop.c
@@ -51,7 +51,7 @@ inferior_event_handler (enum inferior_event_type event_type,
       target_async (NULL, 0);
       pop_target ();
       discard_all_continuations ();
-      do_exec_error_cleanups (ALL_CLEANUPS);
+      async_enable_stdin ();
       break;
 
     case INF_REG_EVENT:
@@ -65,7 +65,7 @@ inferior_event_handler (enum inferior_event_type event_type,
 	  target_async (NULL, 0);
 	  pop_target ();
 	  discard_all_continuations ();
-	  do_exec_error_cleanups (ALL_CLEANUPS);
+	  async_enable_stdin ();
 	  display_gdb_prompt (0);
 	}
       break;
@@ -85,13 +85,11 @@ inferior_event_handler (enum inferior_event_type event_type,
       if (target_has_execution)
 	target_async (NULL, 0);
 
-      /* Calls to do_exec_error_cleanup below will call async_enable_stdin,
-	 and that resets 'sync_execution'.  However, if we were running
-	 in sync execution mode, we also need to display the prompt.  */
+      /* The call to async_enable_stdin below resets 'sync_execution'.
+	 However, if sync_execution is 1 now, we also need to show the
+	 prompt below, so save the current value.  */
       was_sync = sync_execution;
-
-      if (was_sync)
-	do_exec_error_cleanups (ALL_CLEANUPS);
+      async_enable_stdin ();
 
       do_all_continuations ();
 
diff --git a/gdb/tui/tui-interp.c b/gdb/tui/tui-interp.c
index dcee46f..86a288e 100644
--- a/gdb/tui/tui-interp.c
+++ b/gdb/tui/tui-interp.c
@@ -167,7 +167,7 @@ tui_command_loop (void *data)
 	  /* If any exception escaped to here, we better enable
 	     stdin.  Otherwise, any command that calls async_disable_stdin,
 	     and the can throw, will leave stdin inoperable.  */
-	  async_enable_stdin ((void *) 0);
+	  async_enable_stdin ();
 	  /* FIXME: this should really be a call to a hook that is
 	     interface specific, because interfaces can display the
 	     prompt in their own way.  */
diff --git a/gdb/utils.c b/gdb/utils.c
index 91c593e..594fc73 100644
--- a/gdb/utils.c
+++ b/gdb/utils.c
@@ -105,8 +105,6 @@ static int debug_timestamp = 0;
 static struct cleanup *cleanup_chain;	/* cleaned up after a failed command */
 static struct cleanup *final_cleanup_chain;	/* cleaned up when gdb exits */
 static struct cleanup *exec_cleanup_chain;	/* cleaned up on each execution command */
-/* cleaned up on each error from within an execution command */
-static struct cleanup *exec_error_cleanup_chain;
 
 /* Pointer to what is left to do for an execution command after the
    target stops. Used only in asynchronous mode, by targets that
@@ -222,12 +220,6 @@ make_exec_cleanup (make_cleanup_ftype *function, void *arg)
   return make_my_cleanup (&exec_cleanup_chain, function, arg);
 }
 
-struct cleanup *
-make_exec_error_cleanup (make_cleanup_ftype *function, void *arg)
-{
-  return make_my_cleanup (&exec_error_cleanup_chain, function, arg);
-}
-
 static void
 do_freeargv (void *arg)
 {
@@ -330,12 +322,6 @@ do_exec_cleanups (struct cleanup *old_chain)
   do_my_cleanups (&exec_cleanup_chain, old_chain);
 }
 
-void
-do_exec_error_cleanups (struct cleanup *old_chain)
-{
-  do_my_cleanups (&exec_error_cleanup_chain, old_chain);
-}
-
 static void
 do_my_cleanups (struct cleanup **pmy_chain,
 		struct cleanup *old_chain)
@@ -365,12 +351,6 @@ discard_final_cleanups (struct cleanup *old_chain)
 }
 
 void
-discard_exec_error_cleanups (struct cleanup *old_chain)
-{
-  discard_my_cleanups (&exec_error_cleanup_chain, old_chain);
-}
-
-void
 discard_my_cleanups (struct cleanup **pmy_chain,
 		     struct cleanup *old_chain)
 {
-- 
1.5.3.5


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]