• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Aucun tag

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

GNU Binutils with patches for OS216


Commit MetaInfo

Révision55e254b4a206ddad3fe1dda316e8a510f03bc30b (tree)
l'heure2005-03-29 04:10:24
AuteurMark Mitchell <mark@code...>
CommiterMark Mitchell

Message de Log

* gdb/configure.ac: No tgetent on MinGW.
* gdb/event-loop.c (struct gdb_notifier): Add "handles" for Windows.
(create_file_handler): On Windows, update handles, rather than
check_masks and ready_masks.
(delete_file_handler): Likewise.
(gdb_wait_for_event): Use WaitForMultipleObjects, not select, on
Windows.
* gdb/event-top.c (gdb_setup_readline): Put console into
character-at-a-time mode under Windows.

Change Summary

Modification

--- a/ChangeLog.csl
+++ b/ChangeLog.csl
@@ -1,3 +1,15 @@
1+2005-03-28 Mark Mitchell <mark@codesourcery.com>
2+
3+ * gdb/configure.ac: No tgetent on MinGW.
4+ * gdb/event-loop.c (struct gdb_notifier): Add "handles" for Windows.
5+ (create_file_handler): On Windows, update handles, rather than
6+ check_masks and ready_masks.
7+ (delete_file_handler): Likewise.
8+ (gdb_wait_for_event): Use WaitForMultipleObjects, not select, on
9+ Windows.
10+ * gdb/event-top.c (gdb_setup_readline): Put console into
11+ character-at-a-time mode under Windows.
12+
113 2005-03-25 Mark Mitchell <mark@codesourcery.com>
214
315 * gdb/configure.ac: Link with -lws2_32 on mingw.
--- a/gdb/configure
+++ b/gdb/configure
@@ -8189,7 +8189,7 @@ case $host_os in
81898189 LIBS="../libtermcap/libtermcap.a $LIBS"
81908190 ac_cv_search_tgetent="../libtermcap/libtermcap.a"
81918191 fi ;;
8192- go32* | *djgpp*)
8192+ go32* | *djgpp* | *mingw32* )
81938193 ac_cv_search_tgetent="none required"
81948194 ;;
81958195 esac
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -329,7 +329,7 @@ case $host_os in
329329 LIBS="../libtermcap/libtermcap.a $LIBS"
330330 ac_cv_search_tgetent="../libtermcap/libtermcap.a"
331331 fi ;;
332- go32* | *djgpp*)
332+ go32* | *djgpp* | *mingw32* )
333333 ac_cv_search_tgetent="none required"
334334 ;;
335335 esac
--- a/gdb/event-loop.c
+++ b/gdb/event-loop.c
@@ -133,6 +133,11 @@ event_queue;
133133
134134 static unsigned char use_poll = USE_POLL;
135135
136+#ifdef WINAPI
137+#include <windows.h>
138+#include <io.h>
139+#endif
140+
136141 static struct
137142 {
138143 /* Ptr to head of file handler list. */
@@ -146,15 +151,19 @@ static struct
146151 int poll_timeout;
147152 #endif
148153
154+#ifdef WINAPI
155+ HANDLE handles[MAXIMUM_WAIT_OBJECTS];
156+#else
149157 /* Masks to be used in the next call to select.
150158 Bits are set in response to calls to create_file_handler. */
151159 fd_set check_masks[3];
152160
153161 /* What file descriptors were found ready by select. */
154162 fd_set ready_masks[3];
155-
163+#endif
156164 /* Number of file descriptors to monitor. (for poll) */
157165 /* Number of valid bits (highest fd value + 1). (for select) */
166+ /* Number of handles (for Windows). */
158167 int num_fds;
159168
160169 /* Time structure for calls to select(). */
@@ -524,6 +533,10 @@ create_file_handler (int fd, int mask, handler_func * proc, gdb_client_data clie
524533 }
525534 else
526535 {
536+#ifdef WINAPI
537+ gdb_notifier.handles[gdb_notifier.num_fds++]
538+ = (HANDLE) _get_osfhandle (fd);
539+#else
527540 if (mask & GDB_READABLE)
528541 FD_SET (fd, &gdb_notifier.check_masks[0]);
529542 else
@@ -541,6 +554,7 @@ create_file_handler (int fd, int mask, handler_func * proc, gdb_client_data clie
541554
542555 if (gdb_notifier.num_fds <= fd)
543556 gdb_notifier.num_fds = fd + 1;
557+#endif
544558 }
545559 }
546560
@@ -602,6 +616,16 @@ delete_file_handler (int fd)
602616 }
603617 else
604618 {
619+#ifdef WINAPI
620+ HANDLE h = (HANDLE) _get_osfhandle (fd);
621+ for (i = 0; i < gdb_notifier.num_fds; ++i)
622+ if (gdb_notifier.handles[i] == h)
623+ {
624+ gdb_notifier.handles[i] =
625+ gdb_notifier.handles[gdb_notifier.num_fds--];
626+ break;
627+ }
628+#else
605629 if (file_ptr->mask & GDB_READABLE)
606630 FD_CLR (fd, &gdb_notifier.check_masks[0]);
607631 if (file_ptr->mask & GDB_WRITABLE)
@@ -623,6 +647,7 @@ delete_file_handler (int fd)
623647 }
624648 gdb_notifier.num_fds = i;
625649 }
650+#endif
626651 }
627652
628653 /* Deactivate the file descriptor, by clearing its mask,
@@ -737,7 +762,11 @@ gdb_wait_for_event (void)
737762 {
738763 file_handler *file_ptr;
739764 gdb_event *file_event_ptr;
765+#ifdef WINAPI
766+ DWORD event = 0;
767+#else
740768 int num_found = 0;
769+#endif
741770 int i;
742771
743772 /* Make sure all output is done before getting another event. */
@@ -766,6 +795,16 @@ gdb_wait_for_event (void)
766795 }
767796 else
768797 {
798+#ifdef WINAPI
799+ event
800+ = WaitForMultipleObjects(gdb_notifier.num_fds,
801+ gdb_notifier.handles,
802+ FALSE,
803+ gdb_notifier.timeout_valid
804+ ? (gdb_notifier.select_timeout.tv_sec * 1000
805+ + gdb_notifier.select_timeout.tv_usec)
806+ : INFINITE);
807+#else
769808 gdb_notifier.ready_masks[0] = gdb_notifier.check_masks[0];
770809 gdb_notifier.ready_masks[1] = gdb_notifier.check_masks[1];
771810 gdb_notifier.ready_masks[2] = gdb_notifier.check_masks[2];
@@ -786,6 +825,7 @@ gdb_wait_for_event (void)
786825 if (errno != EINTR)
787826 perror_with_name (("select"));
788827 }
828+#endif
789829 }
790830
791831 /* Enqueue all detected file events. */
@@ -828,6 +868,20 @@ gdb_wait_for_event (void)
828868 }
829869 else
830870 {
871+#ifdef WINAPI
872+ HANDLE h;
873+
874+ h = gdb_notifier.handles[event - WAIT_OBJECT_0];
875+ file_ptr = gdb_notifier.first_file_handler;
876+ while ((HANDLE) _get_osfhandle (file_ptr->fd) != h)
877+ file_ptr = file_ptr->next_file;
878+ if (file_ptr->ready_mask == 0)
879+ {
880+ file_event_ptr = create_file_event (file_ptr->fd);
881+ async_queue_event (file_event_ptr, TAIL);
882+ }
883+ file_ptr->ready_mask = GDB_READABLE;
884+#else
831885 for (file_ptr = gdb_notifier.first_file_handler;
832886 (file_ptr != NULL) && (num_found > 0);
833887 file_ptr = file_ptr->next_file)
@@ -856,6 +910,7 @@ gdb_wait_for_event (void)
856910 }
857911 file_ptr->ready_mask = mask;
858912 }
913+#endif
859914 }
860915 return 0;
861916 }
--- a/gdb/event-top.c
+++ b/gdb/event-top.c
@@ -40,6 +40,11 @@
4040 #include "readline/readline.h"
4141 #include "readline/history.h"
4242
43+#ifdef __MINGW32__
44+#include <windows.h>
45+#include <io.h>
46+#endif
47+
4348 /* readline defines this. */
4449 #undef savestring
4550
@@ -1128,6 +1133,20 @@ gdb_setup_readline (void)
11281133 /* When a character is detected on instream by select or poll,
11291134 readline will be invoked via this callback function. */
11301135 call_readline = rl_callback_read_char_wrapper;
1136+#ifdef WINAPI
1137+ /* Set the console to character-at-a-time (as opposed to
1138+ line-at-a-time) mode. Otherwise, we will get only a single
1139+ keyboard event for the entire line, and readline will not
1140+ see each character as it arrives. */
1141+ {
1142+ DWORD mode;
1143+ HANDLE console_handle;
1144+ console_handle = (HANDLE) _get_osfhandle (fileno (instream));
1145+ GetConsoleMode(console_handle, &mode);
1146+ mode &= ~ENABLE_LINE_INPUT;
1147+ SetConsoleMode(console_handle, mode);
1148+ }
1149+#endif
11311150 }
11321151 else
11331152 {