diff options
author | Daniel Jacobowitz <drow@false.org> | 2009-11-13 22:54:42 +0000 |
---|---|---|
committer | Daniel Jacobowitz <drow@false.org> | 2009-11-13 22:54:42 +0000 |
commit | ad960ed22e5c049c6e700a2f04c0231534e35177 (patch) | |
tree | c122880043c7496bfa2a5b33748e82ff34cbf4db /gdb | |
parent | f6838f814769c627c1d61f6905f69f704b334af6 (diff) | |
download | gdb-ad960ed22e5c049c6e700a2f04c0231534e35177.zip gdb-ad960ed22e5c049c6e700a2f04c0231534e35177.tar.gz gdb-ad960ed22e5c049c6e700a2f04c0231534e35177.tar.bz2 |
* ui-file.c (stdio_file_read): Call gdb_select before read.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 4 | ||||
-rw-r--r-- | gdb/ui-file.c | 14 |
2 files changed, 18 insertions, 0 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index aaa0af4..f6aa0cf 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,7 @@ +2009-11-13 Daniel Jacobowitz <dan@codesourcery.com> + + * ui-file.c (stdio_file_read): Call gdb_select before read. + 2009-11-13 Maciej W. Rozycki <macro@codesourcery.com> * mips-tdep.c (mips_insn16_frame_this_id): Mark the outermost diff --git a/gdb/ui-file.c b/gdb/ui-file.c index 527917c..b9ddbb5 100644 --- a/gdb/ui-file.c +++ b/gdb/ui-file.c @@ -23,6 +23,7 @@ #include "defs.h" #include "ui-file.h" #include "gdb_string.h" +#include "gdb_select.h" #include <errno.h> @@ -471,6 +472,19 @@ stdio_file_read (struct ui_file *file, char *buf, long length_buf) if (stdio->magic != &stdio_file_magic) internal_error (__FILE__, __LINE__, _("stdio_file_read: bad magic number")); + + /* For the benefit of Windows, call gdb_select before reading from + the file. Wait until at least one byte of data is available. + Control-C can interrupt gdb_select, but not read. */ + { + int fd = fileno (stdio->file); + fd_set readfds; + FD_ZERO (&readfds); + FD_SET (fd, &readfds); + if (gdb_select (fd + 1, &readfds, NULL, NULL, NULL) == -1) + return -1; + } + return read (fileno (stdio->file), buf, length_buf); } |