From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 46410 invoked by alias); 26 Nov 2019 20:13:46 -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 46401 invoked by uid 89); 26 Nov 2019 20:13:46 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-19.9 required=5.0 tests=AWL,BAYES_00,ENV_AND_HDR_SPF_MATCH,GIT_PATCH_2,RCVD_IN_DNSWL_NONE,SPF_PASS,USER_IN_DEF_SPF_WL autolearn=ham version=3.3.1 spammy= X-HELO: mail-ot1-f68.google.com Received: from mail-ot1-f68.google.com (HELO mail-ot1-f68.google.com) (209.85.210.68) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 26 Nov 2019 20:13:43 +0000 Received: by mail-ot1-f68.google.com with SMTP id q23so11240447otn.0 for ; Tue, 26 Nov 2019 12:13:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=SBim5CN2d9fO5aV2fbRAXHWroSktT9qJnymSFpoNM2M=; b=u9Vc4Hn+flJdedumomw0jP9vXDFQJopmyDbaoKKO4c14aunyjWmfebvVrp7kpudOEJ 4MjwKKlQHaGyKRuoli08XqmozU6LA4gPWPDSMjGkP5j8gbHyflvkJK9X+6aAIiA1ZsmS tjq0vhFyMxcOKmzCjLp3Nhz9e42y5gJLYTaUKGJ7VsUr2j3NjqcWQqNw5tkNcdisD1LI qkcenJ6ktacwVDqEe3+VL3xOzc2pDDruFwXROjKVzjgSUZ4t0TxKIF/JsvC7Dcr2Hsrf fhxzASDxDQD8nIpk/11BveH2uEsOU2N9J3fPWUDoKwnsEimcpRW96R7oRrPNbPWzwTIa NpXw== MIME-Version: 1.0 References: In-Reply-To: From: "Christian Biesinger via gdb-patches" Reply-To: Christian Biesinger Date: Tue, 26 Nov 2019 20:13:00 -0000 Message-ID: Subject: Re: [PATCH] gdb: Use puts_unfiltered instead of printf_unfiltered To: Iain Buclaw Cc: "gdb-patches@sourceware.org" Content-Type: text/plain; charset="UTF-8" X-IsSubscribed: yes X-SW-Source: 2019-11/txt/msg00923.txt.bz2 Sounds like this fixes https://sourceware.org/bugzilla/show_bug.cgi?id=25190, could you mention that in the patch description? (Those three lines could probably be a single printf...) Christian On Tue, Nov 26, 2019 at 6:49 AM Iain Buclaw wrote: > > Hi, > > This patch fixes a regression, possibly introduced by 2a3c1174c3c0db1140180fb3fc56ac324d1c0a7c, in this part of the change: > > --- > @@ -2064,13 +2096,13 @@ vfprintf_unfiltered (struct ui_file *stream, const char *format, va_list args) > fputs_unfiltered (timestamp.c_str (), stream); > } > else > - fputs_unfiltered (linebuffer.c_str (), stream); > + vfprintf_maybe_filtered (stream, format, args, false, true); > } > > void > vprintf_filtered (const char *format, va_list args) > --- > > The significance of this is that printf_unfiltered writes messages to wrap_buffer, whereas puts_unfiltered pushes them immediately to stdout, resulting in "post-" messages being printed out of order. > > Not sure about how to go about testing this, looking at the testsuite, such as gdb.base/annota1.exp, everything appears to be in order. Perhaps this is because the testsuite triggers one of these conditions in fputs_maybe_filtered() though. > > --- > if (stream != gdb_stdout > || !pagination_enabled > || pagination_disabled_for_command > || batch_flag > || (lines_per_page == UINT_MAX && chars_per_line == UINT_MAX) > || top_level_interpreter () == NULL > || top_level_interpreter ()->interp_ui_out ()->is_mi_like_p ()) > --- > > > However, the actual observed behaviour in gdb is: > --- > Reading symbols from a.out... > (gdb) set annotate 2 > > \032\032pre-prompt > (gdb) > \032\032prompt > start > > prompt\032\032post- > Temporary breakpoint 1 at 0x13716: file test.c, line 3. > --- > > With this patch applied, instead "\032\032post-prompt" is printed. > > I think this can be applied as obvious, but wanted to have someone else have a quick check, just in case it would be preferred to change fputs_maybe_filtered instead to flush the buffer on scope exit for unfiltered messages. > > -- > Iain > > --- > > >