From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id BNGGMQD82GnzlxAAWB0awg (envelope-from ) for ; Fri, 10 Apr 2026 09:32:48 -0400 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=SLh+wZAv; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id B26AE1E04F; Fri, 10 Apr 2026 09:32:48 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED, RCVD_IN_VALIDITY_RPBL_BLOCKED,RCVD_IN_VALIDITY_SAFE_BLOCKED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [38.145.34.32]) (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 ESMTPS id B4EA91E04F for ; Fri, 10 Apr 2026 09:32:47 -0400 (EDT) Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id B8BEB4BA2E32 for ; Fri, 10 Apr 2026 13:32:45 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B8BEB4BA2E32 Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=SLh+wZAv Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTP id 3B7094BA2E36 for ; Fri, 10 Apr 2026 13:32:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3B7094BA2E36 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 3B7094BA2E36 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1775827926; cv=none; b=exf78q0OsjjrKnlC5YRN5qjN1u8oq3/6aUygaRl0G26DAAreYynmNuhFb4cwDTy/pRpMUXn6X869qQFKbhhODwa+fJ2IiytKdSa8fJATuBht5FUXdigepU3AiZExy5uR/bNQJnAZvihivsimQRP3t/oAOXA5Ge/wrwSz3JHmK58= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1775827926; c=relaxed/simple; bh=NZbOhSZpLi7Npi5Kq7TuZKnCgNsMgrFoU7nOMYspIM8=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=h7oFzGp0m/c5qZDnB1e01xibuSufMciH9Vm+FkRl3EkJbiZKzYE7Qn2/yK8oIPwmVv25WFBi2s8ZqPaBYvvauNBciKQPPCawCqo/UZZxYoJuAm3Oj9BAmw7ncOb1zIcNn0SC4SD+M7a2d4ITpZ+AoDnD785h24MGi6Jn1zEKYeU= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3B7094BA2E36 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1775827925; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Tu6UL5wpQX+pyuQ3M7VN/wSRbhhjn8jnfOaXPja66Gg=; b=SLh+wZAvsf0DCvf4yEH3QYBwRIE0DxAEiA6kAKOSMAvqDqaUbbRmLAGxDKBNQPEL44D3f4 W68w4/SUVtr52ENvUTNU27gIX8NBXMOhAARnjhcZBkuSG/XuHXI5WLQCeIxFwIvrCEWfDZ CgkSYhSzAv0omGlmfJZO0lErCuGY/Ac= Received: from mail-dy1-f199.google.com (mail-dy1-f199.google.com [74.125.82.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-65-2yXdbG6XOiqlv8Q9uwuPvg-1; Fri, 10 Apr 2026 09:32:04 -0400 X-MC-Unique: 2yXdbG6XOiqlv8Q9uwuPvg-1 X-Mimecast-MFC-AGG-ID: 2yXdbG6XOiqlv8Q9uwuPvg_1775827923 Received: by mail-dy1-f199.google.com with SMTP id 5a478bee46e88-2ccc035f125so945365eec.1 for ; Fri, 10 Apr 2026 06:32:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775827923; x=1776432723; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Tu6UL5wpQX+pyuQ3M7VN/wSRbhhjn8jnfOaXPja66Gg=; b=ePCjEjkpa/u2EpPdCMMwhS80KC9cI4tfHFbEKJyYXwXWTqxw5VP/gbS0DP1tKmUD8W UnzTXjmhqQP4g63TuoYkBWveJPB7L+ELoLx1IaRxFUvxFwTpGkb9GsXfMnOwPDDLlwsy LzaZEuHlNz0do+/Fmo0Mt5Wc//U/QoGDg6ZF6xTYwmo/Z96SOoSpufPpw0x/4hBXw4eW R8ugO2x3c4vEzv0Cqj5jVfqc9duOBIS3umhoxpps4RqSna0K0nc9+mUJPGHZXAUE0CIu SshZfcKfKwcYxRxSHIrorubJGKt2tL2W1d/2iE/anb2QxEnctiBLwJSCwEMTmrPWYr/Z J37g== X-Forwarded-Encrypted: i=1; AJvYcCVhIWNLtr9sYKzksTNRBj6Vz1P1uOltDyyMFsKes9q2uQ4Xf7UIFnFKPq/U9AeCMRcfei/QDARwIjioyg==@sourceware.org X-Gm-Message-State: AOJu0Yy2vA0eqJzBeE8YHGmM1qMBX72MUN0lsyAve7y4jYhaNp94zyyE 5un3DZDT/gTWZUcr6Ma1cXhD+rO5ccYf2A0IfKhanwG2GRMDmlKy2eKovnAiVcfleMYXlWV1fFh n/hCQLe9laJ72uF1VqngSLrWcl0Zr42S6PYZCMXE96FEAjQv8HOH+6kb2tgNtzC2J01nhbrk= X-Gm-Gg: AeBDieszSK6ZMJxSWLeAMEXfyxJui1aqtqVUoh7ylT7qeffNtEJWrSiz8dr++r99t7x WDWZ4b3+FtEzN/+3b+ncwfUbBbyeWeD6rDIFG1UPQ3r6N6wjcDm0OsvMUo0KhbeuuWNaRcTFi1u dgPkUbr+aUhQCb7R1uGIlAeLWOa0TXqrvrf/qHP3pI2qxWif789qpffuh7siV34mTboAm6MOynO PgsznoN8Ggepf3vYkzjxkl0MVw2e4swr9I8UWgrjQIVVzZ9pEwNpUEjCgRJATYyN1z7QcXGQLd6 DL2q9ThYM9iH1Tj3sANQkZLlAuuAXLL28BK93uOswAf6wnbpKwpxNHKOcR33QztW8nxPxYxCzQx 0bQl007Oa36WP3ex3d8P1dVOgqhNipog= X-Received: by 2002:a05:7022:670a:b0:128:d5bd:3557 with SMTP id a92af1059eb24-12c351a0dc9mr1162984c88.4.1775827922607; Fri, 10 Apr 2026 06:32:02 -0700 (PDT) X-Received: by 2002:a05:7022:670a:b0:128:d5bd:3557 with SMTP id a92af1059eb24-12c351a0dc9mr1162949c88.4.1775827921233; Fri, 10 Apr 2026 06:32:01 -0700 (PDT) Received: from ?IPV6:2804:14d:8084:993e::75d? ([2804:14d:8084:993e::75d]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-12c346eb162sm3195782c88.11.2026.04.10.06.31.58 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 10 Apr 2026 06:32:00 -0700 (PDT) Message-ID: Date: Fri, 10 Apr 2026 10:31:56 -0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] [gdb] Add selftest for tui_setup_io To: Tom de Vries , gdb-patches@sourceware.org References: <20260403113156.2890482-1-tdevries@suse.de> From: Guinevere Larsen In-Reply-To: <20260403113156.2890482-1-tdevries@suse.de> X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: CJuzato13LlBWXlohercsqw6nKIDKyn6mJc4wHn6naA_1775827923 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit 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: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org On 4/3/26 8:31 AM, Tom de Vries wrote: > Add a selftest for the problem described in commit b171f68e945 ("[gdb/tui] > Make tui_setup_io more robust"). Hi Tom! I looked over this patch and it makes sense, and I verified that it does trigger a crash before the listed commit, so it is properly testing it. Reviewed-By: Guinevere Larsen -- Cheers, Guinevere Larsen It/she > --- > gdb/tui/tui-io.c | 34 ++++++++++++++++++++++++++++++++++ > 1 file changed, 34 insertions(+) > > diff --git a/gdb/tui/tui-io.c b/gdb/tui/tui-io.c > index 4b4bc818430..642b88ead0c 100644 > --- a/gdb/tui/tui-io.c > +++ b/gdb/tui/tui-io.c > @@ -46,6 +46,7 @@ > #include "pager.h" > #include "gdbsupport/gdb-checked-static-cast.h" > #include "logging-file.h" > +#include "gdbsupport/selftest.h" > > /* This redefines CTRL if it is not already defined, so it must come > after terminal state related include files like and > @@ -1328,3 +1329,36 @@ tui_getc (FILE *fp) > return 0; > } > } > + > +#if GDB_SELF_TEST > +namespace selftests { > +namespace tui { > +namespace io { > + > +static void > +run_tests () > +{ > + if (!tui_active) > + { > + /* Calling tui_setup_io (0) when tui is disabled should have no effect. */ > + tui_setup_io (0); > + > + /* If the output streams are reduced to nullptrs, then the self-test > + infrastructure will crash when trying to report these failures. */ > + SELF_CHECK (*redirectable_stdout () != nullptr); > + SELF_CHECK (*redirectable_stderr () != nullptr); > + SELF_CHECK (*redirectable_stdlog () != nullptr); > + } > +} > + > +} /* namespace io */ > +} /* namespace tui */ > +} /* namespace selftests */ > +#endif /* GDB_SELF_TEST */ > + > +INIT_GDB_FILE (tui_io) > +{ > +#if GDB_SELF_TEST > + selftests::register_test ("tui-io", selftests::tui::io::run_tests); > +#endif > +} > > base-commit: db4f00be62d3396374df989b5f938c3ebec6833e