[RFC,10/17] Move event-loop.[ch] to common/

Message ID 20190224165153.5062-11-tom@tromey.com
State New
Headers show
Series
  • Merge event loop implementations
Related show

Commit Message

Tom Tromey Feb. 24, 2019, 4:51 p.m.
This moves event-loop.[ch] to common and updates the uses in gdb.

gdb/ChangeLog
2019-02-24  Tom Tromey  <tom@tromey.com>

	* tui/tui-win.c: Update include.
	* tui/tui-io.c: Update include.
	* tui/tui-interp.c: Update include.
	* tui/tui-hooks.c: Update include.
	* top.h: Update include.
	* top.c: Update include.
	* ser-base.c: Update include.
	* remote.c: Update include.
	* remote-notif.c: Update include.
	* remote-fileio.c: Update include.
	* record-full.c: Update include.
	* record-btrace.c: Update include.
	* python/python.c: Update include.
	* posix-hdep.c: Update include.
	* mingw-hdep.c: Update include.
	* mi/mi-main.c: Update include.
	* mi/mi-interp.c: Update include.
	* main.c: Update include.
	* linux-nat.c: Update include.
	* interps.c: Update include.
	* infrun.c: Update include.
	* inf-loop.c: Update include.
	* event-top.c: Update include.
	* event-loop.c: Move...
	* common/event-loop.c: ... here.
	* event-loop.h: Move...
	* common/event-loop.h: ... here.
	* async-event.h: Update include.
	* Makefile.in (COMMON_SFILES, HFILES_NO_SRCDIR): Update.
---
 gdb/ChangeLog                 | 32 ++++++++++++++++++++++++++++++++
 gdb/Makefile.in               |  4 ++--
 gdb/async-event.h             |  2 +-
 gdb/{ => common}/event-loop.c |  4 ++--
 gdb/{ => common}/event-loop.h |  2 ++
 gdb/event-top.c               |  2 +-
 gdb/inf-loop.c                |  2 +-
 gdb/infrun.c                  |  2 +-
 gdb/interps.c                 |  2 +-
 gdb/linux-nat.c               |  2 +-
 gdb/main.c                    |  2 +-
 gdb/mi/mi-interp.c            |  2 +-
 gdb/mi/mi-main.c              |  2 +-
 gdb/mingw-hdep.c              |  2 +-
 gdb/posix-hdep.c              |  2 +-
 gdb/python/python.c           |  2 +-
 gdb/record-btrace.c           |  2 +-
 gdb/record-full.c             |  2 +-
 gdb/remote-fileio.c           |  2 +-
 gdb/remote-notif.c            |  2 +-
 gdb/remote.c                  |  2 +-
 gdb/ser-base.c                |  2 +-
 gdb/top.c                     |  2 +-
 gdb/top.h                     |  2 +-
 gdb/tui/tui-hooks.c           |  2 +-
 gdb/tui/tui-interp.c          |  2 +-
 gdb/tui/tui-io.c              |  2 +-
 gdb/tui/tui-win.c             |  2 +-
 28 files changed, 62 insertions(+), 28 deletions(-)
 rename gdb/{ => common}/event-loop.c (99%)
 rename gdb/{ => common}/event-loop.h (99%)

-- 
2.17.2

Comments

Pedro Alves Sept. 26, 2019, 2:06 p.m. | #1
On 2/24/19 4:51 PM, Tom Tromey wrote:
> --- a/gdb/event-loop.h

> +++ b/gdb/common/event-loop.h

> @@ -70,6 +70,8 @@

>  

>     Corollary tasks are the creation and deletion of event sources.  */

>  

> +#include "common/function-view.h"

> +


Is this needed here?

>  typedef void *gdb_client_data;

>  typedef void (handler_func) (int, gdb_client_data);

>  typedef void (timer_handler_func) (gdb_client_data);


Thanks,
Pedro Alves
Tom Tromey Oct. 4, 2019, 10:06 p.m. | #2
>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:


>> +#include "common/function-view.h"

>> +


Pedro> Is this needed here?

Nope.  I removed it.

Tom

Patch

diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index c7a9cb62d10..af0d2e95ef8 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -961,6 +961,7 @@  COMMON_SFILES = \
 	common/common-utils.c \
 	common/errors.c \
 	common/environ.c \
+	common/event-loop.c \
 	common/fileio.c \
 	common/filestuff.c \
 	common/format.c \
@@ -1011,7 +1012,6 @@  COMMON_SFILES = \
 	dwarf2loc.c \
 	dwarf2read.c \
 	eval.c \
-	event-loop.c \
 	event-top.c \
 	exceptions.c \
 	exec.c \
@@ -1240,7 +1240,6 @@  HFILES_NO_SRCDIR = \
 	dwarf2expr.h \
 	dwarf2loc.h \
 	dwarf2read.h \
-	event-loop.h \
 	event-top.h \
 	exceptions.h \
 	exec.h \
@@ -1452,6 +1451,7 @@  HFILES_NO_SRCDIR = \
 	common/job-control.h \
 	common/errors.h \
 	common/environ.h \
+	common/event-loop.h \
 	common/fileio.h \
 	common/format.h \
 	common/gdb_assert.h \
diff --git a/gdb/async-event.h b/gdb/async-event.h
index 408f7764f7c..45b4daf3f18 100644
--- a/gdb/async-event.h
+++ b/gdb/async-event.h
@@ -19,7 +19,7 @@ 
 #ifndef ASYNC_EVENT_H
 #define ASYNC_EVENT_H
 
-#include "event-loop.h"
+#include "common/event-loop.h"
 
 struct async_signal_handler;
 struct async_event_handler;
diff --git a/gdb/event-loop.c b/gdb/common/event-loop.c
similarity index 99%
rename from gdb/event-loop.c
rename to gdb/common/event-loop.c
index 08536f57902..a2563414dfd 100644
--- a/gdb/event-loop.c
+++ b/gdb/common/event-loop.c
@@ -17,8 +17,8 @@ 
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#include "defs.h"
-#include "event-loop.h"
+#include "common/common-defs.h"
+#include "common/event-loop.h"
 
 #include <chrono>
 
diff --git a/gdb/event-loop.h b/gdb/common/event-loop.h
similarity index 99%
rename from gdb/event-loop.h
rename to gdb/common/event-loop.h
index 16bde6474db..1eec1ed2cd9 100644
--- a/gdb/event-loop.h
+++ b/gdb/common/event-loop.h
@@ -70,6 +70,8 @@ 
 
    Corollary tasks are the creation and deletion of event sources.  */
 
+#include "common/function-view.h"
+
 typedef void *gdb_client_data;
 typedef void (handler_func) (int, gdb_client_data);
 typedef void (timer_handler_func) (gdb_client_data);
diff --git a/gdb/event-top.c b/gdb/event-top.c
index 5829957e513..1a66721540e 100644
--- a/gdb/event-top.c
+++ b/gdb/event-top.c
@@ -25,7 +25,7 @@ 
 #include "infrun.h"
 #include "target.h"
 #include "terminal.h"		/* for job_control */
-#include "event-loop.h"
+#include "common/event-loop.h"
 #include "event-top.h"
 #include "interps.h"
 #include <signal.h>
diff --git a/gdb/inf-loop.c b/gdb/inf-loop.c
index d0e19d5f824..34db6a4bce4 100644
--- a/gdb/inf-loop.c
+++ b/gdb/inf-loop.c
@@ -20,7 +20,7 @@ 
 #include "defs.h"
 #include "inferior.h"
 #include "infrun.h"
-#include "event-loop.h"
+#include "common/event-loop.h"
 #include "event-top.h"
 #include "inf-loop.h"
 #include "remote.h"
diff --git a/gdb/infrun.c b/gdb/infrun.c
index 0eaf1b608b6..029c75bae73 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -61,7 +61,7 @@ 
 #include "target-dcache.h"
 #include "terminal.h"
 #include "solist.h"
-#include "event-loop.h"
+#include "common/event-loop.h"
 #include "thread-fsm.h"
 #include "common/enum-flags.h"
 #include "progspace-and-thread.h"
diff --git a/gdb/interps.c b/gdb/interps.c
index b62e33339a2..540786e578a 100644
--- a/gdb/interps.c
+++ b/gdb/interps.c
@@ -32,7 +32,7 @@ 
 #include "defs.h"
 #include "gdbcmd.h"
 #include "ui-out.h"
-#include "event-loop.h"
+#include "common/event-loop.h"
 #include "event-top.h"
 #include "interps.h"
 #include "completer.h"
diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
index 063afe26666..4ce78aaceee 100644
--- a/gdb/linux-nat.c
+++ b/gdb/linux-nat.c
@@ -47,7 +47,7 @@ 
 #include <sys/stat.h>		/* for struct stat */
 #include <fcntl.h>		/* for O_RDONLY */
 #include "inf-loop.h"
-#include "event-loop.h"
+#include "common/event-loop.h"
 #include "event-top.h"
 #include <pwd.h>
 #include <sys/types.h>
diff --git a/gdb/main.c b/gdb/main.c
index f60f0d0a092..043e7b03830 100644
--- a/gdb/main.c
+++ b/gdb/main.c
@@ -28,7 +28,7 @@ 
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <ctype.h>
-#include "event-loop.h"
+#include "common/event-loop.h"
 #include "ui-out.h"
 
 #include "interps.h"
diff --git a/gdb/mi/mi-interp.c b/gdb/mi/mi-interp.c
index 3e9f36897a8..ea8d6d54907 100644
--- a/gdb/mi/mi-interp.c
+++ b/gdb/mi/mi-interp.c
@@ -20,7 +20,7 @@ 
 #include "defs.h"
 #include "interps.h"
 #include "event-top.h"
-#include "event-loop.h"
+#include "common/event-loop.h"
 #include "inferior.h"
 #include "infrun.h"
 #include "ui-out.h"
diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c
index 46bc928d9fe..a39749f1a7c 100644
--- a/gdb/mi/mi-main.c
+++ b/gdb/mi/mi-main.c
@@ -33,7 +33,7 @@ 
 #include "ui-out.h"
 #include "mi-out.h"
 #include "interps.h"
-#include "event-loop.h"
+#include "common/event-loop.h"
 #include "event-top.h"
 #include "gdbcore.h"		/* For write_memory().  */
 #include "value.h"
diff --git a/gdb/mingw-hdep.c b/gdb/mingw-hdep.c
index 2fa82d1d484..08f1632f4ba 100644
--- a/gdb/mingw-hdep.c
+++ b/gdb/mingw-hdep.c
@@ -20,7 +20,7 @@ 
 #include "defs.h"
 #include "main.h"
 #include "serial.h"
-#include "event-loop.h"
+#include "common/event-loop.h"
 
 #include "common/gdb_select.h"
 #include "readline/readline.h"
diff --git a/gdb/posix-hdep.c b/gdb/posix-hdep.c
index 97fd9b535a6..b02a76c59c2 100644
--- a/gdb/posix-hdep.c
+++ b/gdb/posix-hdep.c
@@ -18,7 +18,7 @@ 
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include "defs.h"
-#include "event-loop.h"
+#include "common/event-loop.h"
 
 #include "common/gdb_select.h"
 
diff --git a/gdb/python/python.c b/gdb/python/python.c
index c23db2c1261..154c6023070 100644
--- a/gdb/python/python.c
+++ b/gdb/python/python.c
@@ -27,7 +27,7 @@ 
 #include "objfiles.h"
 #include "value.h"
 #include "language.h"
-#include "event-loop.h"
+#include "common/event-loop.h"
 #include "serial.h"
 #include "readline/tilde.h"
 #include "python.h"
diff --git a/gdb/record-btrace.c b/gdb/record-btrace.c
index 5319a1b2bb8..d79244129d7 100644
--- a/gdb/record-btrace.c
+++ b/gdb/record-btrace.c
@@ -36,7 +36,7 @@ 
 #include "frame-unwind.h"
 #include "hashtab.h"
 #include "infrun.h"
-#include "event-loop.h"
+#include "common/event-loop.h"
 #include "inf-loop.h"
 #include "common/vec.h"
 #include "inferior.h"
diff --git a/gdb/record-full.c b/gdb/record-full.c
index 95ccc2c797e..10a5146f4be 100644
--- a/gdb/record-full.c
+++ b/gdb/record-full.c
@@ -31,7 +31,7 @@ 
 #include "record-full.h"
 #include "elf-bfd.h"
 #include "gcore.h"
-#include "event-loop.h"
+#include "common/event-loop.h"
 #include "inf-loop.h"
 #include "gdb_bfd.h"
 #include "observable.h"
diff --git a/gdb/remote-fileio.c b/gdb/remote-fileio.c
index 91caa2b0726..3db68b8bfc8 100644
--- a/gdb/remote-fileio.c
+++ b/gdb/remote-fileio.c
@@ -25,7 +25,7 @@ 
 #include "common/gdb_wait.h"
 #include <sys/stat.h>
 #include "remote-fileio.h"
-#include "event-loop.h"
+#include "common/event-loop.h"
 #include "target.h"
 #include "filenames.h"
 #include "common/filestuff.h"
diff --git a/gdb/remote-notif.c b/gdb/remote-notif.c
index 72916023420..d2ffe34efc4 100644
--- a/gdb/remote-notif.c
+++ b/gdb/remote-notif.c
@@ -35,7 +35,7 @@ 
 #include "remote.h"
 #include "remote-notif.h"
 #include "observable.h"
-#include "event-loop.h"
+#include "common/event-loop.h"
 #include "target.h"
 #include "inferior.h"
 #include "infrun.h"
diff --git a/gdb/remote.c b/gdb/remote.c
index d6561dda61f..c5bc52137a1 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -49,7 +49,7 @@ 
 
 #include "common/gdb_sys_time.h"
 
-#include "event-loop.h"
+#include "common/event-loop.h"
 #include "event-top.h"
 #include "inf-loop.h"
 
diff --git a/gdb/ser-base.c b/gdb/ser-base.c
index 6411ad7b2f7..8388bec3a7d 100644
--- a/gdb/ser-base.c
+++ b/gdb/ser-base.c
@@ -20,7 +20,7 @@ 
 #include "defs.h"
 #include "serial.h"
 #include "ser-base.h"
-#include "event-loop.h"
+#include "common/event-loop.h"
 
 #include "common/gdb_select.h"
 #include "common/gdb_sys_time.h"
diff --git a/gdb/top.c b/gdb/top.c
index 91989609c07..9ad4b5a7c04 100644
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -42,7 +42,7 @@ 
 #include "common/version.h"
 #include "serial.h"
 #include "main.h"
-#include "event-loop.h"
+#include "common/event-loop.h"
 #include "gdbthread.h"
 #include "extension.h"
 #include "interps.h"
diff --git a/gdb/top.h b/gdb/top.h
index 025d9389d60..9c9af1af3e9 100644
--- a/gdb/top.h
+++ b/gdb/top.h
@@ -21,7 +21,7 @@ 
 #define TOP_H
 
 #include "common/buffer.h"
-#include "event-loop.h"
+#include "common/event-loop.h"
 #include "value.h"
 
 struct tl_interp_info;
diff --git a/gdb/tui/tui-hooks.c b/gdb/tui/tui-hooks.c
index 98c6fd651fa..0e9dbdfc4f4 100644
--- a/gdb/tui/tui-hooks.c
+++ b/gdb/tui/tui-hooks.c
@@ -26,7 +26,7 @@ 
 #include "objfiles.h"
 #include "target.h"
 #include "gdbcore.h"
-#include "event-loop.h"
+#include "common/event-loop.h"
 #include "event-top.h"
 #include "frame.h"
 #include "breakpoint.h"
diff --git a/gdb/tui/tui-interp.c b/gdb/tui/tui-interp.c
index 14215b83dea..e8f3a69df68 100644
--- a/gdb/tui/tui-interp.c
+++ b/gdb/tui/tui-interp.c
@@ -22,7 +22,7 @@ 
 #include "interps.h"
 #include "top.h"
 #include "event-top.h"
-#include "event-loop.h"
+#include "common/event-loop.h"
 #include "ui-out.h"
 #include "cli-out.h"
 #include "tui/tui-data.h"
diff --git a/gdb/tui/tui-io.c b/gdb/tui/tui-io.c
index d006e41cabb..bb0bc904f1a 100644
--- a/gdb/tui/tui-io.c
+++ b/gdb/tui/tui-io.c
@@ -21,7 +21,7 @@ 
 
 #include "defs.h"
 #include "target.h"
-#include "event-loop.h"
+#include "common/event-loop.h"
 #include "event-top.h"
 #include "command.h"
 #include "top.h"
diff --git a/gdb/tui/tui-win.c b/gdb/tui/tui-win.c
index fa1ee89603d..1df21df026d 100644
--- a/gdb/tui/tui-win.c
+++ b/gdb/tui/tui-win.c
@@ -32,7 +32,7 @@ 
 #include "cli/cli-cmds.h"
 #include "top.h"
 #include "source.h"
-#include "event-loop.h"
+#include "common/event-loop.h"
 #include "async-event.h"
 
 #include "tui/tui.h"