From patchwork Thu Feb 4 15:11:11 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yao Qi X-Patchwork-Id: 10731 Received: (qmail 18167 invoked by alias); 4 Feb 2016 15:11:23 -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 18141 invoked by uid 89); 4 Feb 2016 15:11:21 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 spammy=1204, 6997, yao.qi@linaro.org, yaoqilinaroorg X-HELO: mail-pf0-f172.google.com Received: from mail-pf0-f172.google.com (HELO mail-pf0-f172.google.com) (209.85.192.172) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Thu, 04 Feb 2016 15:11:20 +0000 Received: by mail-pf0-f172.google.com with SMTP id 65so47856273pfd.2 for ; Thu, 04 Feb 2016 07:11:19 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-type :content-transfer-encoding; bh=N8qrGK7i/VySCGnodpVGRLV5SQYDJXyNjUPKun6Htq0=; b=li1B+hD8E/Xj8UyejqsDggF/iYcgjH7dDR75EgTYMxCeIzjlA+tjwvBTkrzhE0wB8d w1huGwG1tSDQjK+y77qTDLWvAy0HYZ7cnTeph71m1NBfY18a+FyHME05RtOLGUhQIgIx ULnhyv8mEiaMCwEcHxYk/IBYmnKniaUSr986YpIgp7PriSfYti/dGQkhn3bSBaWodEZI 9dTKTKMz+us6W4bWnGeb7PaP6GnpzamxTy6LoaodKYPNXGWEsQanhnA9ivVUp/1fzyAG 1rkdd0Rr5D6B6ongT4n+Zb7SCQP4wstRS3B8U/uIkLp8IGCotFVem6L7rRo7EQ9hEgb1 EykA== X-Gm-Message-State: AG10YOT9ZMcX+zmh23/zBt6I12nN2ZirI3/35YlQLHyQbaObaLjS4Pu95ATwakuVes35GA== X-Received: by 10.66.54.78 with SMTP id h14mr11597425pap.59.1454598678384; Thu, 04 Feb 2016 07:11:18 -0800 (PST) Received: from E107787-LIN (gcc1-power7.osuosl.org. [140.211.15.137]) by smtp.gmail.com with ESMTPSA id m16sm13707428pfi.75.2016.02.04.07.11.15 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Thu, 04 Feb 2016 07:11:17 -0800 (PST) From: Yao Qi To: Pedro Alves Cc: Yao Qi , gdb-patches@sourceware.org Subject: Re: [PATCH] waiting_for_stop_reply around remote_fileio_request References: <1454064546-4419-1-git-send-email-yao.qi@linaro.org> <56B35836.9000909@redhat.com> Date: Thu, 04 Feb 2016 15:11:11 +0000 In-Reply-To: <56B35836.9000909@redhat.com> (Pedro Alves's message of "Thu, 04 Feb 2016 13:55:02 +0000") Message-ID: <861t8spl2o.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 X-IsSubscribed: yes Pedro Alves writes: > LGTM, with nits below. > >> diff --git a/gdb/remote.c b/gdb/remote.c >> index d5701e3..f396a8f 100644 >> --- a/gdb/remote.c >> +++ b/gdb/remote.c >> @@ -6994,8 +6994,16 @@ remote_wait_as (ptid_t ptid, struct target_waitstatus *status, int options) >> status->value.sig = GDB_SIGNAL_0; >> break; >> case 'F': /* File-I/O request. */ >> + /* GDB may access the inferior memory while handling the File-I/O >> + request, but we don't want it GDB accessing memory while waiting > > Either "want it", or "want GDB", instead of "want it GDB". > > >> remote_fileio_request (buf, rs->ctrlc_pending_p); >> rs->ctrlc_pending_p = 0; >> + /* GDB handled the File-I/O request, but the target is running >> + again. Keep waiting for events. */ > > s/but/and/. Fixed. Patch below is pushed in. diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 829a48c..a2b0d39 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2016-02-04 Yao Qi + + * remote.c (remote_wait_as): Set rs->waiting_for_stop_reply to + 0 before handling 'F' and set it back afterwards. + 2016-02-02 Simon Marchi * ui-out.c (MAX_UI_OUT_LEVELS): Remove. diff --git a/gdb/remote.c b/gdb/remote.c index 8831b50..b1af8aa 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -6984,8 +6984,16 @@ remote_wait_as (ptid_t ptid, struct target_waitstatus *status, int options) status->value.sig = GDB_SIGNAL_0; break; case 'F': /* File-I/O request. */ + /* GDB may access the inferior memory while handling the File-I/O + request, but we don't want GDB accessing memory while waiting + for a stop reply. See the comments in putpkt_binary. Set + waiting_for_stop_reply to 0 temporarily. */ + rs->waiting_for_stop_reply = 0; remote_fileio_request (buf, rs->ctrlc_pending_p); rs->ctrlc_pending_p = 0; + /* GDB handled the File-I/O request, and the target is running + again. Keep waiting for events. */ + rs->waiting_for_stop_reply = 1; break; case 'N': case 'T': case 'S': case 'X': case 'W': {