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]

[PATCH] Move ensure_not_running from infrun.c to infcmd.c


Hi,
Both error_is_running and ensure_not_running are only called by
functions in infcmd.c, but they are defined in infrun.c.  It is better
to move them to infcmd.c, and make them static.  This is what this
patch does.  Is it OK?

gdb:

2012-11-30  Yao Qi  <yao@codesourcery.com>

	* infrun.c (error_is_running, ensure_not_running): Move them to ...
	* infcmd.c (error_is_running, ensure_not_running): ... here.
	Make them 'static'.
	* inferior.h: Remove declarations of error_is_running and
	ensure_not_running.
---
 gdb/infcmd.c   |   18 ++++++++++++++++++
 gdb/inferior.h |    6 ------
 gdb/infrun.c   |   14 --------------
 3 files changed, 18 insertions(+), 20 deletions(-)

diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index 7a08e31..db9b9b5 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -708,6 +708,24 @@ ensure_not_tfind_mode (void)
     error (_("Cannot execute this command while looking at trace frames."));
 }
 
+/* Throw an error indicating the current thread is running.  */
+
+static void
+error_is_running (void)
+{
+  error (_("Cannot execute this command while "
+	   "the selected thread is running."));
+}
+
+/* Calls error_is_running if the current thread is running.  */
+
+static void
+ensure_not_running (void)
+{
+  if (is_running (inferior_ptid))
+    error_is_running ();
+}
+
 void
 continue_1 (int all_threads)
 {
diff --git a/gdb/inferior.h b/gdb/inferior.h
index 19548c4..ff74880 100644
--- a/gdb/inferior.h
+++ b/gdb/inferior.h
@@ -228,12 +228,6 @@ extern void get_last_target_status(ptid_t *ptid,
 
 extern void follow_inferior_reset_breakpoints (void);
 
-/* Throw an error indicating the current thread is running.  */
-extern void error_is_running (void);
-
-/* Calls error_is_running if the current thread is running.  */
-extern void ensure_not_running (void);
-
 void set_step_info (struct frame_info *frame, struct symtab_and_line sal);
 
 /* From infcmd.c */
diff --git a/gdb/infrun.c b/gdb/infrun.c
index 3e48c04..e70dab0 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -3040,20 +3040,6 @@ init_infwait_state (void)
   infwait_state = infwait_normal_state;
 }
 
-void
-error_is_running (void)
-{
-  error (_("Cannot execute this command while "
-	   "the selected thread is running."));
-}
-
-void
-ensure_not_running (void)
-{
-  if (is_running (inferior_ptid))
-    error_is_running ();
-}
-
 static int
 stepped_in_from (struct frame_info *frame, struct frame_id step_frame_id)
 {
-- 
1.7.7.6


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