This is the mail archive of the mailing list for the GDB project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

linux-nat.c, async, fix endless stream of TARGET_WAITKIND_NO_RESUMED events

Start a program with async on till it stops:

$./gdb ~/gdb/tests/threads -ex "set target-async on" -ex "set non-stop 1"
(gdb) start
Temporary breakpoint 1 at 0x40068c: file threads.c, line 35.
Starting program: /home/pedro/gdb/tests/threads 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/".

Temporary breakpoint 1, 
During symbol reading, incomplete CFI data; unspecified registers (e.g., rax) at 0x400688.
main () at threads.c:35
35          long i = 0;

and all looks quiet, but if you do:

(gdb) set debug infrun 1

you'll see a constant stream of:

infrun: prepare_to_wait
infrun: target_wait (-1, status) =
infrun:   -1 [process -1],
infrun:   status->kind = no-resumed

here, constantly waking up the event loop, only to find no event to
report, rinse repeat.

Everything was still working fine, except that gdb was eating
100% CPU.  :-)


Pedro Alves

2011-11-10  Pedro Alves  <>

	* linux-nat.c (linux_nat_wait): Don't force waking up the event
	loop when returning a TARGET_WAITKIND_NO_RESUMED.

 gdb/linux-nat.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Index: src/gdb/linux-nat.c
--- src.orig/gdb/linux-nat.c	2011-11-07 12:37:38.833988237 +0000
+++ src/gdb/linux-nat.c	2011-11-07 12:40:30.903988178 +0000
@@ -3980,7 +3980,8 @@ linux_nat_wait (struct target_ops *ops,
      may be more.  If we requested a specific lwp or process, also
      assume there may be more.  */
   if (target_can_async_p ()
-      && (ourstatus->kind != TARGET_WAITKIND_IGNORE
+      && ((ourstatus->kind != TARGET_WAITKIND_IGNORE
+	   && ourstatus->kind != TARGET_WAITKIND_NO_RESUMED)
 	  || !ptid_equal (ptid, minus_one_ptid)))
     async_file_mark ();

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]