From patchwork Thu Jul 31 18:53:11 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Evans X-Patchwork-Id: 2259 Received: (qmail 8781 invoked by alias); 31 Jul 2014 18:53:17 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 8770 invoked by uid 89); 31 Jul 2014 18:53:16 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.2 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-ob0-f202.google.com Received: from mail-ob0-f202.google.com (HELO mail-ob0-f202.google.com) (209.85.214.202) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Thu, 31 Jul 2014 18:53:14 +0000 Received: by mail-ob0-f202.google.com with SMTP id wp18so745366obc.1 for ; Thu, 31 Jul 2014 11:53:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:mime-version:content-type :content-transfer-encoding:message-id:date:to:cc:subject:in-reply-to :references; bh=UFF3d604ldvoPvWvY3CfclmOGcZnNw8ohbt1HJQM/Mk=; b=KifXzh4uLY+VXI5bw3Bc5MnxO7XGLbbHHjNEU2zHF7LGCz4cq2GyDWIS7HxyqIOx86 RNX2l5UzGt722/tCcfRxIqF7lNe4Hv8nDDFoTlGWia+5GKHs+0lf5C9mApWwIVHOWHma SyN6gq6XCyvpnXMA5ikkEF1rmalbySUSNGODYOOuTQqhAdk1bqszDR5LqJq7fkqitGiZ Abjvr3hlD1EE4Y/fcN10kYj1SanHXhXoyZ0CnpdeSwDpBUVXkazhjQvdjFZU8RSz1Wmm p+9tmwg59tbdt226mU/rvqE06SQehSGztFYSgcb3ExVDl984Lt0MGwAqohOVErAyJR1j olSQ== X-Gm-Message-State: ALoCoQlZ63UBmDQHwHnP1uT1bN3D7NYUuGBpXQtaRRFpHvKAT6Jjf19R3t4j3YBD+JsMwe8kAhHi X-Received: by 10.182.125.37 with SMTP id mn5mr42333obb.49.1406832792619; Thu, 31 Jul 2014 11:53:12 -0700 (PDT) Received: from corp2gmr1-2.hot.corp.google.com (corp2gmr1-2.hot.corp.google.com [172.24.189.93]) by gmr-mx.google.com with ESMTPS id j43si395146yhh.5.2014.07.31.11.53.12 for (version=TLSv1.1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 31 Jul 2014 11:53:12 -0700 (PDT) Received: from ruffy.mtv.corp.google.com (ruffy.mtv.corp.google.com [172.17.128.44]) by corp2gmr1-2.hot.corp.google.com (Postfix) with ESMTP id 0B9A85A43FD; Thu, 31 Jul 2014 11:53:11 -0700 (PDT) From: Doug Evans MIME-Version: 1.0 Message-ID: <21466.37015.504297.930677@ruffy.mtv.corp.google.com> Date: Thu, 31 Jul 2014 11:53:11 -0700 To: Pedro Alves Cc: gdb-patches@sourceware.org Subject: Re: [PATCH] Add comments to terminal_ours/inferior functions In-Reply-To: <53D93C1C.5020703@redhat.com> References: <53D93C1C.5020703@redhat.com> X-IsSubscribed: yes Pedro Alves writes: > On 07/30/2014 07:26 PM, Doug Evans wrote: > > > > > 2014-07-30 Doug Evans > > > > * inflow.c (child_terminal_inferior): Add comment. > > (child_terminal_ours_for_output): Add comment. > > (child_terminal_ours): Add comment. > > * linux-nat.c (linux_nat_terminal_inferior): Add comment. > > (linux_nat_terminal_ours): Add comment. > > > > Looks good. > > Thanks, > Pedro Alves > There was a cut-n-paste error in the comment for child_terminal_inferior. Here is what I checked in. Thanks. 2014-07-31 Doug Evans * inflow.c (child_terminal_inferior): Add comment. (child_terminal_ours_for_output): Add comment. (child_terminal_ours): Add comment. * linux-nat.c (linux_nat_terminal_inferior): Add comment. (linux_nat_terminal_ours): Add comment. diff --git a/gdb/inflow.c b/gdb/inflow.c index 5f81de2..f13efea 100644 --- a/gdb/inflow.c +++ b/gdb/inflow.c @@ -267,7 +267,11 @@ child_terminal_init (struct target_ops *self) } /* Put the inferior's terminal settings into effect. - This is preparation for starting or resuming the inferior. */ + This is preparation for starting or resuming the inferior. + + N.B. Targets that want to use this with async support must build that + support on top of this (e.g., the caller still needs to remove stdin + from the event loop). E.g., see linux_nat_terminal_inferior. */ void child_terminal_inferior (struct target_ops *self) @@ -348,7 +352,10 @@ child_terminal_inferior (struct target_ops *self) so that no input is discarded. After doing this, either terminal_ours or terminal_inferior - should be called to get back to a normal state of affairs. */ + should be called to get back to a normal state of affairs. + + N.B. The implementation is (currently) no different than + child_terminal_ours. See child_terminal_ours_1. */ void child_terminal_ours_for_output (struct target_ops *self) @@ -358,7 +365,11 @@ child_terminal_ours_for_output (struct target_ops *self) /* Put our terminal settings into effect. First record the inferior's terminal settings - so they can be restored properly later. */ + so they can be restored properly later. + + N.B. Targets that want to use this with async support must build that + support on top of this (e.g., the caller still needs to add stdin to the + event loop). E.g., see linux_nat_terminal_ours. */ void child_terminal_ours (struct target_ops *self) diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c index 8d4251f..5a791bc 100644 --- a/gdb/linux-nat.c +++ b/gdb/linux-nat.c @@ -4595,7 +4595,9 @@ linux_nat_supports_disable_randomization (struct target_ops *self) static int async_terminal_is_ours = 1; -/* target_terminal_inferior implementation. */ +/* target_terminal_inferior implementation. + + This is a wrapper around child_terminal_inferior to add async support. */ static void linux_nat_terminal_inferior (struct target_ops *self) @@ -4618,7 +4620,14 @@ linux_nat_terminal_inferior (struct target_ops *self) set_sigint_trap (); } -/* target_terminal_ours implementation. */ +/* target_terminal_ours implementation. + + This is a wrapper around child_terminal_ours to add async support (and + implement the target_terminal_ours vs target_terminal_ours_for_output + distinction). child_terminal_ours is currently no different than + child_terminal_ours_for_output. + We leave target_terminal_ours_for_output alone, leaving it to + child_terminal_ours_for_output. */ static void linux_nat_terminal_ours (struct target_ops *self)