From patchwork Fri Sep 8 18:23:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Marchi X-Patchwork-Id: 75570 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D8021387093F for ; Fri, 8 Sep 2023 19:04:55 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D8021387093F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1694199895; bh=v1tIZtiK8WFGXEkBuwYYeZRqKwEqIAAronxfiBINyZY=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=NjyP8iyUWIG1NvZlnoeQkddehHvuS3s9YgYgG03CH+2MRr8v971l8A22hn8Vt1nta Ae20yX+csVkenv/S5QyLQ8V3TlhQf8zngRCGqQek6L3VusqbJFYizfflccliVxTKIX +AbfbRNVmBfFhlR7/h+ZnoaRMoI0cCxZ9zOKCQgE= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id 788183858C2D for ; Fri, 8 Sep 2023 19:04:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 788183858C2D Received: from smarchi-efficios.internal.efficios.com (192-222-143-198.qc.cable.ebox.net [192.222.143.198]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id EE3AD1E0C3; Fri, 8 Sep 2023 15:04:30 -0400 (EDT) To: gdb-patches@sourceware.org Cc: Simon Marchi Subject: [PATCH 10/21] gdb/mi: use m_ui instead of current_ui in mi_interp::init Date: Fri, 8 Sep 2023 14:23:04 -0400 Message-ID: <20230908190227.96319-11-simon.marchi@efficios.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20230908190227.96319-1-simon.marchi@efficios.com> References: <20230908190227.96319-1-simon.marchi@efficios.com> MIME-Version: 1.0 X-Spam-Status: No, score=-3497.1 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_NONE, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_SOFTFAIL, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Simon Marchi via Gdb-patches From: Simon Marchi Reply-To: Simon Marchi Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" gdb_stdout accesses current_ui under the hood. Use m_ui to get the stdout file instead. Add an stdout method to ui to help with that (it would feel wrong to access ui::m_gdb_stdout directly). Change-Id: I03739df387c8de01bc692d7ddddbb66544555630 --- gdb/mi/mi-interp.c | 2 +- gdb/ui.h | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/gdb/mi/mi-interp.c b/gdb/mi/mi-interp.c index 3095301b2f11..f260d98837cf 100644 --- a/gdb/mi/mi-interp.c +++ b/gdb/mi/mi-interp.c @@ -86,7 +86,7 @@ mi_interp::init (bool top_level) /* Store the current output channel, so that we can create a console channel that encapsulates and prefixes all gdb_output-type bits coming from the rest of the debugger. */ - mi->raw_stdout = gdb_stdout; + mi->raw_stdout = m_ui->stdout (); /* Create MI console channels, each with a different prefix so they can be distinguished. */ diff --git a/gdb/ui.h b/gdb/ui.h index b9ca9c0c80a0..be89ab3d6848 100644 --- a/gdb/ui.h +++ b/gdb/ui.h @@ -150,6 +150,9 @@ struct ui : public intrusive_list_node /* The current ui_out. */ struct ui_out *m_current_uiout = nullptr; + ui_file *stdout () + { return m_gdb_stdout; } + /* Register the UI's input file descriptor in the event loop. */ void register_file_handler ();