RDI code busy-waiting on running target?

Grant Edwards grante@visi.com
Fri Jul 12 11:04:00 GMT 2002


On Fri, Jul 12, 2002 at 10:26:53AM -0500, Grant Edwards wrote:
> > I've noticed that gdb uses all the CPU it can get while the
> > target is running (e.g. busy-waiting 'till target stops).
>
> Here's a patch that fixes it.

Thanks to Dan Kegel for pointing out that an auto struct with
initializer isn't kosher.  One more try...

-- 
Grant Edwards
grante@visi.com
-------------- next part --------------
diff -r -U8 gdb-5.2-orig/gdb/ChangeLog gdb-5.2/gdb/ChangeLog
--- gdb-5.2-orig/gdb/ChangeLog	Fri Apr 26 20:05:21 2002
+++ gdb-5.2/gdb/ChangeLog	Fri Jul 12 10:22:38 2002
@@ -1,8 +1,13 @@
+2002-07-11  Grant Edwards <grante@visi.com>
+
+        * rdi-share/ardi.c: add 10ms sleep to busy-wait loop
+        when target is running.
+
 2002-04-26  GDB Administrator  <gdbadmin@sourceware.cygnus.com>
 
 	GDB 5.2 Released.
 	* version.in: Update to version 5.2.
 
 2002-04-26  Michal Ludvig  <mludvig@suse.cz>
 
 	* x86-64-tdep.c (x86_64_skip_prologue): Print note when debugging
diff -r -U8 gdb-5.2-orig/gdb/rdi-share/ardi.c gdb-5.2/gdb/rdi-share/ardi.c
--- gdb-5.2-orig/gdb/rdi-share/ardi.c	Thu Oct 12 17:56:31 2000
+++ gdb-5.2/gdb/rdi-share/ardi.c	Fri Jul 12 13:03:35 2002
@@ -1409,16 +1409,22 @@
 #endif
 
   interrupt_request = FALSE;
   stop_request = FALSE;
   
   signal(SIGINT, ardi_sigint_handler);
   while( executing )
   {
+    struct timeval timeout;
+    timeout.tv_sec = 0;
+    timeout.tv_usec = 10000;
+
+    select(0,0,0,0,&timeout);
+    
     if (ui_loop_hook)
       ui_loop_hook(0);
     
     if (interrupt_request || stop_request)
       {
         interrupt_target();
         interrupt_request = FALSE;
         stop_request = FALSE;


More information about the Gdb-patches mailing list