From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22615 invoked by alias); 28 Nov 2009 17:07:59 -0000 Received: (qmail 22602 invoked by uid 22791); 28 Nov 2009 17:07:58 -0000 X-SWARE-Spam-Status: No, hits=-2.6 required=5.0 tests=BAYES_00,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (38.113.113.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 28 Nov 2009 17:07:53 +0000 Received: (qmail 26263 invoked from network); 28 Nov 2009 17:07:51 -0000 Received: from unknown (HELO wind.localnet) (vladimir@127.0.0.2) by mail.codesourcery.com with ESMTPA; 28 Nov 2009 17:07:51 -0000 From: Vladimir Prus To: gdb-patches@sources.redhat.com Subject: Fix async mode with remote targets Date: Sat, 28 Nov 2009 17:07:00 -0000 User-Agent: KMail/1.12.2 (Linux/2.6.31-14-generic-pae; KDE/4.3.2; i686; ; ) MIME-Version: 1.0 Content-Type: Text/Plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Message-Id: <200911282007.49122.vladimir@codesourcery.com> Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2009-11/txt/msg00588.txt.bz2 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