This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[RFA] use gdb_usleep instead of sleep in remote-mips.c (was Missing sleep function for mingw hosts)
- From: "Pierre Muller" <pierre dot muller at ics-cnrs dot unistra dot fr>
- To: "'Pedro Alves'" <pedro at codesourcery dot com>, <gdb-patches at sourceware dot org>
- Cc: "'Eli Zaretskii'" <eliz at gnu dot org>
- Date: Tue, 29 Mar 2011 17:30:39 +0200
- Subject: [RFA] use gdb_usleep instead of sleep in remote-mips.c (was Missing sleep function for mingw hosts)
- References: <004701cbede4$0ee18c20$2ca4a460$@muller@ics-cnrs.unistra.fr> <E1Q4Y9z-0004UD-1Y@fencepost.gnu.org> <003001cbee11$49bb0880$dd311980$@muller@ics-cnrs.unistra.fr> <201103291523.46954.pedro@codesourcery.com>
> I have no clue why that `sleep' is necessary, but in any case, can't
> we use already existing `gdb_usleep' function instead and be done
> with it?
Simply because I didn't know that gdb_usleep even existed...
This makes things much easier indeed.
Is the patch below OK?
Pierre
2011-03-29 Pierre Muller <muller@ics.u-strasbg.fr>
Fix mingw compilation with --enable-targets=all.
* remote-mips.c (gdb_usleep.h): Include header.
(mips_enter_debug): Use gdb_usleep instead of sleep.
Index: remote-mips.c
===================================================================
RCS file: /cvs/src/src/gdb/remote-mips.c,v
retrieving revision 1.120
diff -u -p -r1.120 remote-mips.c
--- remote-mips.c 16 Mar 2011 17:59:02 -0000 1.120
+++ remote-mips.c 29 Mar 2011 14:52:12 -0000
@@ -33,6 +33,7 @@
#include "exceptions.h"
#include "gdb_string.h"
#include "gdb_stat.h"
+#include "gdb_usleep.h"
#include "regcache.h"
#include <ctype.h>
#include "mips-tdep.h"
@@ -1350,7 +1351,7 @@ mips_enter_debug (void)
else /* Assume IDT monitor by default. */
mips_send_command ("db tty0\r", 0);
- sleep (1);
+ gdb_usleep (1000000);
serial_write (mips_desc, "\r", sizeof "\r" - 1);
/* We don't need to absorb any spurious characters here, since the