Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Grant Edwards <grante@visi.com>
To: gdb@sources.redhat.com
Cc: gdb-patches@sources.redhat.com
Subject: Re: RDI code busy-waiting on running target?
Date: Fri, 12 Jul 2002 08:24:00 -0000	[thread overview]
Message-ID: <20020712102650.A6637@visi.com> (raw)
In-Reply-To: <20020711184343.A4472@visi.com>; from grante@visi.com on Thu, Jul 11, 2002 at 06:43:43PM -0500

[-- Attachment #1: Type: text/plain, Size: 369 bytes --]

On Thu, Jul 11, 2002 at 06:43:43PM -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.

Here's a new version of the patch that does the sleep
unconditionally and uses select() instead of usleep().

-- 
Grant Edwards
grante@visi.com

[-- Attachment #2: rdi-busy-wait.patch --]
[-- Type: text/plain, Size: 1211 bytes --]

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 10:17:37 2002
@@ -1409,16 +1409,20 @@
 #endif
 
   interrupt_request = FALSE;
   stop_request = FALSE;
   
   signal(SIGINT, ardi_sigint_handler);
   while( executing )
   {
+    struct timeval timeout = {0,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;

  parent reply	other threads:[~2002-07-12 15:23 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20020711175854.A29971@visi.com>
2002-07-11 16:53 ` Grant Edwards
2002-07-11 17:28   ` Keith Seitz
2002-07-11 17:44     ` Grant Edwards
2002-07-12  8:24   ` Grant Edwards [this message]
2002-07-12 11:04     ` Grant Edwards
2002-07-14 10:04       ` Andrew Cagney
2002-07-14 10:10         ` Momchil Velikov
2002-07-14 11:28           ` Andrew Cagney
2002-07-15  0:28             ` Grant Edwards
2002-07-15  9:42               ` Andrew Cagney
2002-07-15 10:59                 ` Grant Edwards
2002-07-11 19:08 Dan Kegel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20020712102650.A6637@visi.com \
    --to=grante@visi.com \
    --cc=gdb-patches@sources.redhat.com \
    --cc=gdb@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox