Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* Fix async mode with remote targets
@ 2009-11-28 17:07 Vladimir Prus
       [not found] ` <20091128172915.GG18125@adacore.com>
  0 siblings, 1 reply; 2+ messages in thread
From: Vladimir Prus @ 2009-11-28 17:07 UTC (permalink / raw)
  To: gdb-patches


CodeSourcery has received a bug report that async mode does not work with
remote targets -- that is, if one does "continue &", GDB no longer accepts
input. 

What is happening is that resume does:

      /* Install inferior's terminal modes.  */
      target_terminal_inferior ();

      ...

      target_resume (resume_ptid, step, sig);

Where target_terminal_inferior is:

        void
        target_terminal_inferior (void)
        {
          /* A background resume (``run&'') should leave GDB in control of the
             terminal.  */
          if (target_is_async_p () && !sync_execution)
            return;

          /* If GDB is resuming the inferior in the foreground, install
         inferior's terminal modes.  */
          (*current_target.to_terminal_inferior) ();
        }

and remote_terminal_inferior has this:

         delete_file_handler (input_fd);

In all-stop mode, target_is_async_p returns false until remote_resume does this:

          if (target_can_async_p ())
            target_async (inferior_event_handler, 0);

But this happens after target_terminal_inferior is called, and disabled stdin.

This patch fixes the problem. Approved off-list by Pedro and checked in.

There's a reasonable question why testsuite did not catch the problem. I'll get to
that shortly.

- Volodya


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Fix async mode with remote targets
       [not found] ` <20091128172915.GG18125@adacore.com>
@ 2009-11-28 17:40   ` Vladimir Prus
  0 siblings, 0 replies; 2+ messages in thread
From: Vladimir Prus @ 2009-11-28 17:40 UTC (permalink / raw)
  To: Joel Brobecker, gdb-patches

[-- Attachment #1: Type: Text/Plain, Size: 114 bytes --]

On Saturday 28 November 2009 20:29:15 Joel Brobecker wrote:

> ENOPATCH :)
> 
> 

Sorry, here it goes.

- Volodya

[-- Attachment #2: final.diff --]
[-- Type: text/x-patch, Size: 1369 bytes --]

Index: ChangeLog
===================================================================
RCS file: /cvs/src/src/gdb/ChangeLog,v
retrieving revision 1.11117
diff -u -p -r1.11117 ChangeLog
--- ChangeLog	27 Nov 2009 16:11:56 -0000	1.11117
+++ ChangeLog	28 Nov 2009 16:57:39 -0000
@@ -1,3 +1,8 @@
+2009-11-28  Vladimir Prus  <vladimir@codesourcery.com>
+
+	* target.c (target_terminal_inferior): Use target_can_async_p, not
+	target_is_async_p.
+
 2009-11-27  Ulrich Weigand  <uweigand@de.ibm.com>
 
 	* s390-nat.c (s390_can_use_hw_breakpoint): Only support breakpoints
Index: target.c
===================================================================
RCS file: /cvs/src/src/gdb/target.c,v
retrieving revision 1.233
diff -u -p -r1.233 target.c
--- target.c	20 Nov 2009 17:23:38 -0000	1.233
+++ target.c	28 Nov 2009 16:57:39 -0000
@@ -481,8 +481,10 @@ void
 target_terminal_inferior (void)
 {
   /* A background resume (``run&'') should leave GDB in control of the
-     terminal.  */
-  if (target_is_async_p () && !sync_execution)
+     terminal. Use target_can_async_p, not target_is_async_p, since at
+     this point the target is not async yet.  However, if sync_execution
+     is not set, we know it will become async prior to resume.  */
+  if (target_can_async_p () && !sync_execution)
     return;
 
   /* If GDB is resuming the inferior in the foreground, install

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-11-28 17:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-11-28 17:07 Fix async mode with remote targets Vladimir Prus
     [not found] ` <20091128172915.GG18125@adacore.com>
2009-11-28 17:40   ` Vladimir Prus

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox