This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[patch] event-loop.h cleanup: GDB_READABLE, et.al. -> event-loop.c
- From: dje at google dot com (Doug Evans)
- To: gdb-patches at sourceware dot org
- Date: Thu, 29 Apr 2010 15:08:59 -0700 (PDT)
- Subject: [patch] event-loop.h cleanup: GDB_READABLE, et.al. -> event-loop.c
Hi.
I'm currently working on a fix to gdbserver where it will go to sleep
even though there is data sitting in readchar's buffer.
While doing that I was comparing gdb's event-loop with gdbserver's,
and was wondering why gdb's has these definitions in a .h file.
#define GDB_READABLE (1<<1)
#define GDB_WRITABLE (1<<2)
#define GDB_EXCEPTION (1<<3)
It turns out there's no need to, and in fact there's some cruft
associated with that.
I will check this patch in in a few days if there are no objections.
2010-04-29 Doug Evans <dje@google.com>
* event-loop.h (GDB_READABLE, GDB_WRITABLE, GDB_EXCEPTION): Move to ...
* event-loop.c: ... here.
* tui/tui-io.c (tui_readline_output): Rename parameter `code' to
`error' for clarity.
(tui_getc): Pass correct value for `error' parameter to
tui_readline_output.
Index: event-loop.c
===================================================================
RCS file: /cvs/src/src/gdb/event-loop.c,v
retrieving revision 1.42
diff -u -p -r1.42 event-loop.c
--- event-loop.c 19 Jan 2010 09:39:11 -0000 1.42
+++ event-loop.c 29 Apr 2010 22:01:34 -0000
@@ -38,6 +38,13 @@
#include "gdb_assert.h"
#include "gdb_select.h"
+/* Tell create_file_handler what events we are interested in.
+ This is used by the select version of the event loop. */
+
+#define GDB_READABLE (1<<1)
+#define GDB_WRITABLE (1<<2)
+#define GDB_EXCEPTION (1<<3)
+
/* Data point to pass to the event handler. */
typedef union event_data
{
Index: event-loop.h
===================================================================
RCS file: /cvs/src/src/gdb/event-loop.h,v
retrieving revision 1.12
diff -u -p -r1.12 event-loop.h
--- event-loop.h 1 Jan 2010 07:31:31 -0000 1.12
+++ event-loop.h 29 Apr 2010 22:01:34 -0000
@@ -88,13 +88,6 @@ typedef enum
}
queue_position;
-/* Tell create_file_handler what events we are interested in.
- This is used by the select version of the event loop. */
-
-#define GDB_READABLE (1<<1)
-#define GDB_WRITABLE (1<<2)
-#define GDB_EXCEPTION (1<<3)
-
/* Exported functions from event-loop.c */
extern void start_event_loop (void);
Index: tui/tui-io.c
===================================================================
RCS file: /cvs/src/src/gdb/tui/tui-io.c,v
retrieving revision 1.22
diff -u -p -r1.22 tui-io.c
--- tui/tui-io.c 1 Jan 2010 07:32:07 -0000 1.22
+++ tui/tui-io.c 29 Apr 2010 22:01:34 -0000
@@ -303,7 +303,7 @@ tui_deprep_terminal (void)
/* Read readline output pipe and feed the command window with it.
Should be removed when readline is clean. */
static void
-tui_readline_output (int code, gdb_client_data data)
+tui_readline_output (int error, gdb_client_data data)
{
int size;
char buf[256];
@@ -657,7 +657,7 @@ tui_getc (FILE *fp)
#ifdef TUI_USE_PIPE_FOR_READLINE
/* Flush readline output. */
- tui_readline_output (GDB_READABLE, 0);
+ tui_readline_output (0, 0);
#endif
ch = wgetch (w);