From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 74548 invoked by alias); 18 Oct 2017 03:48:06 -0000 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 Received: (qmail 71359 invoked by uid 89); 18 Oct 2017 03:48:00 -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_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:1060, recommend X-HELO: gproxy7-pub.mail.unifiedlayer.com Received: from gproxy7-pub.mail.unifiedlayer.com (HELO gproxy7-pub.mail.unifiedlayer.com) (70.40.196.235) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 18 Oct 2017 03:47:50 +0000 Received: from cmgw3 (unknown [10.0.90.84]) by gproxy7.mail.unifiedlayer.com (Postfix) with ESMTP id D3093215E72 for ; Tue, 17 Oct 2017 21:47:48 -0600 (MDT) Received: from box522.bluehost.com ([74.220.219.122]) by cmgw3 with id Nrnl1w00C2f2jeq01rnoyZ; Tue, 17 Oct 2017 21:47:48 -0600 X-Authority-Analysis: v=2.2 cv=H76r+6Qi c=1 sm=1 tr=0 a=GsOEXm/OWkKvwdLVJsfwcA==:117 a=GsOEXm/OWkKvwdLVJsfwcA==:17 a=02M-m0pO-4AA:10 a=pGLkceISAAAA:8 a=csBuKslI6RTMnk2B6W4A:9 Received: from 184-96-33-178.hlrn.qwest.net ([184.96.33.178]:53738 helo=bapiya) by box522.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.87) (envelope-from ) id 1e4fKb-001GL1-Ei; Tue, 17 Oct 2017 21:47:45 -0600 From: Tom Tromey To: Yao Qi Cc: Tom Tromey , gdb-patches@sourceware.org Subject: Re: [RFA 7/8] Add truncate_repeat_arguments function References: <20171013205950.22943-1-tom@tromey.com> <20171013205950.22943-8-tom@tromey.com> <87vajitjuv.fsf@tromey.com> <87h8uzu6xw.fsf@tromey.com> <86fuajwh8w.fsf@gmail.com> Date: Wed, 18 Oct 2017 03:48:00 -0000 In-Reply-To: <86fuajwh8w.fsf@gmail.com> (Yao Qi's message of "Mon, 16 Oct 2017 10:53:51 +0100") Message-ID: <87k1ztruap.fsf@tromey.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.60 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-BWhitelist: no X-Exim-ID: 1e4fKb-001GL1-Ei X-Source-Sender: 184-96-33-178.hlrn.qwest.net (bapiya) [184.96.33.178]:53738 X-Source-Auth: tom+tromey.com X-Email-Count: 5 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTIyLmJsdWVob3N0LmNvbQ== X-Local-Domain: yes X-SW-Source: 2017-10/txt/msg00545.txt.bz2 >>>>> "Yao" == Yao Qi writes: Yao> This global variable worries me a little bit. Is it possible that Yao> different part of GDB request to execute the repeatable commands? For Yao> example, CLI and MI issues command, or different UIs issue command. It's hard to reason about, I agree. I think commands can either be run via "cmd_func", or by calling the command function directly. Direct calls can be directly audited -- and none of the callers of the new set_repeat_arguments function are called this way. There are also not many calls to cmd_func; and at least when I look at these (I encourage you to check my work), I think only execute_command can possibly call a command that calls set_repeat_arguments. Since execute_command uses a scoped_restore to save and restore this global, I think this must be ok. It does seem a bit fragile. For example, I'd recommend not adding new callers of set_repeat_arguments. I'm open to suggestions for another way to approach this. Tom