From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 88491 invoked by alias); 12 Mar 2019 21:26:32 -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 88480 invoked by uid 89); 12 Mar 2019 21:26:32 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-3.5 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.1 spammy=displays X-HELO: smtp.polymtl.ca Received: from smtp.polymtl.ca (HELO smtp.polymtl.ca) (132.207.4.11) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 12 Mar 2019 21:26:30 +0000 Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id x2CLQOxI010170 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 12 Mar 2019 17:26:28 -0400 Received: by simark.ca (Postfix, from userid 112) id 041B71E78F; Tue, 12 Mar 2019 17:26:24 -0400 (EDT) Received: from simark.ca (localhost [127.0.0.1]) by simark.ca (Postfix) with ESMTP id A368C1E4A5; Tue, 12 Mar 2019 17:26:22 -0400 (EDT) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Tue, 12 Mar 2019 21:26:00 -0000 From: Simon Marchi To: Tom Tromey Cc: gdb-patches@sourceware.org Subject: Re: [RFC] Don't show "display"s twice in MI In-Reply-To: <20190312190320.19645-1-tromey@adacore.com> References: <20190312190320.19645-1-tromey@adacore.com> Message-ID: <35e26a8109be1f127b2d2bdd0003a980@polymtl.ca> X-Sender: simon.marchi@polymtl.ca User-Agent: Roundcube Webmail/1.3.6 X-IsSubscribed: yes X-SW-Source: 2019-03/txt/msg00262.txt.bz2 On 2019-03-12 15:03, Tom Tromey wrote: > If you run "gdb -i=mi2" and set a "display", then when "next"ing the > displays will be shown twice: > > ~"1: x = 23\n" > ~"7\t printf(\"%d\\n\", x);\n" > ~"1: x = 23\n" > > *stopped,reason="end-stepping-range",frame={addr="0x0000000000400565",func="main",args=[],file="q.c",fullname="/tmp/q.c",line="7"},thread-id="1",stopped-threads="all",core="1" > > The immediate cause of this is this code in mi_on_normal_stop_1: > > print_stop_event (mi_uiout); > > console_interp = interp_lookup (current_ui, INTERP_CONSOLE); > if (should_print_stop_to_console (console_interp, tp)) > print_stop_event (mi->cli_uiout); > > ... which obviously prints the stop twice. > > However, I think the first call to print_stop_event is intended just > to emit the MI *stopped notification, which explains why the source > line does not show up two times. > > This patch fixes the bug by changing print_stop_event to only call > do_displays for non-MI-like ui-outs. FWIW, this is fine with me. Maybe just format the C file of the test case according to GNU style. Simon