From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id oDdAECavy2S3LjYAWB0awg (envelope-from ) for ; Thu, 03 Aug 2023 09:44:06 -0400 Authentication-Results: simark.ca; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=BY5KU4Ek; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 3F8071E098; Thu, 3 Aug 2023 09:44:06 -0400 (EDT) Received: from server2.sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (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 2F6631E028 for ; Thu, 3 Aug 2023 09:44:04 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id ADF9B3858C27 for ; Thu, 3 Aug 2023 13:44:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org ADF9B3858C27 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1691070243; bh=uDVLqYWCy+VoRkvFftbeOZKJHrazGieNbh0xrJs/CtI=; h=Date:Subject:To:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=BY5KU4EkWYxbftLDDV3jBy5idYpgCvZInUocOip0JzmPHzv8lFTL4F+c17Rdr0Fi7 BXITuZzesthm0JBPal8J2ocA8c39c4u7cbmIfbKftWKrvUyDxm4usCMtJLjU7n1z99 +XmPO1uR+YmElSXhknstBEPeJ97bmV1xAWVtlMOE= Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 1CF993858D1E for ; Thu, 3 Aug 2023 13:43:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1CF993858D1E Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-630-acXz5zMsMBGvcnQaRB9gLg-1; Thu, 03 Aug 2023 09:43:42 -0400 X-MC-Unique: acXz5zMsMBGvcnQaRB9gLg-1 Received: by mail-qk1-f198.google.com with SMTP id af79cd13be357-76aec4bfac3so111431385a.1 for ; Thu, 03 Aug 2023 06:43:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691070221; x=1691675021; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=uDVLqYWCy+VoRkvFftbeOZKJHrazGieNbh0xrJs/CtI=; b=TU2H9Ai24E1/tfal2BQN4mJesQ/n+HjlveN1qcEPnaoSnBJC4AGTHVT527I6mJU782 85wp3mn/nRgUBVMb6Z8PnvGwL82aRhUDkg0w/3PyHzFwL5j5GFCKzCdb0XgBLEnO7vQm g7/8Zic/wYyWFMYEUFFhEay3OSLTierz+c9SHxnrPrK7IeY3Ch4mRnaRS0/eNeKQVqqe FxZyrZMNer94Kr1Mk4Nar15lUAxU/+A+d/pA46NEo4IrTI/A+cK3/NZyiatlrf3RWXE9 cel7blPKKk0NYqfURt0j0HfrJV02ex2ksDQ9JRfjpcWVhOU1UswpQJso8Hg43ho9Kn7z q1dg== X-Gm-Message-State: ABy/qLZIJ5z7n7srYMTGFi4It1RdXaWiMYKrUssDXEmFLOZs1xYdn2iM NQ8CREJi/z6FD4JXX+ZkVZd6Dl7Po88PuVzLa4LnH77TaAjN0DnkQaTFPfh1lOBX3ByLKNfgBzt lfbKZwjCVWM0WoXAZQ9FFXMfb36VaBA== X-Received: by 2002:a05:620a:29d4:b0:765:381a:3487 with SMTP id s20-20020a05620a29d400b00765381a3487mr27641991qkp.57.1691070221557; Thu, 03 Aug 2023 06:43:41 -0700 (PDT) X-Google-Smtp-Source: APBJJlFYAr2o+jHKbDYch8qh1Oa1P0Wp8bGZxYk8INApjI7G1aVm1qEofWda3ESk09jPV7R4VXHfYw== X-Received: by 2002:a05:620a:29d4:b0:765:381a:3487 with SMTP id s20-20020a05620a29d400b00765381a3487mr27641976qkp.57.1691070221316; Thu, 03 Aug 2023 06:43:41 -0700 (PDT) Received: from [192.168.0.129] (ip-94-112-225-44.bb.vodafone.cz. [94.112.225.44]) by smtp.gmail.com with ESMTPSA id g2-20020ae9e102000000b0076c5ad6750fsm5821306qkm.102.2023.08.03.06.43.40 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 03 Aug 2023 06:43:41 -0700 (PDT) Message-ID: <21cdd6b8-62e9-a1e5-94ad-8b748f0ee80d@redhat.com> Date: Thu, 3 Aug 2023 15:43:39 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: [PING][PATCH v2] gdb/testsuite: explicitly test for stderr in gdb.mi/mi-dprintf.exp To: Bruno Larsen , Bruno Larsen via Gdb-patches References: <20230721095809.3479260-2-blarsen@redhat.com> In-Reply-To: <20230721095809.3479260-2-blarsen@redhat.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-9.9 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE 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.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Bruno Larsen via Gdb-patches Reply-To: Bruno Larsen Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" Ping! -- Cheers, Bruno On 21/07/2023 11:58, Bruno Larsen wrote: > As mentioned in commit 3f5bbc3e2075ef5061a815c73fdc277218489f22, some > compilers such as clang don't add debug information about stderr by > default, leaving it to external debug packages. > > This commit adds a way to check if GDB has access to stderr information > when in MI mode, and uses this new mechanism to skip the related section > of the test gdb.mi/mi-dprintf.exp. It also fixes an incorrect name for a > test in that file. > > Co-Authored-By: Andrew Burgess > --- > gdb/testsuite/gdb.mi/mi-dprintf.exp | 11 ++++++++--- > gdb/testsuite/lib/mi-support.exp | 14 ++++++++++++++ > 2 files changed, 22 insertions(+), 3 deletions(-) > > diff --git a/gdb/testsuite/gdb.mi/mi-dprintf.exp b/gdb/testsuite/gdb.mi/mi-dprintf.exp > index e40fa6121fa..d771993386b 100644 > --- a/gdb/testsuite/gdb.mi/mi-dprintf.exp > +++ b/gdb/testsuite/gdb.mi/mi-dprintf.exp > @@ -127,6 +127,7 @@ proc mi_continue_dprintf {args} { > mi_continue_dprintf "gdb" > > # The "call" style depends on having I/O functions available, so test. > +set has_stderr_symbol [mi_gdb_is_stderr_available] > > if ![target_info exists gdb,noinferiorio] { > > @@ -136,9 +137,13 @@ if ![target_info exists gdb,noinferiorio] { > mi_gdb_test "set dprintf-style call" ".*" "mi set dprintf style to call" > mi_continue_dprintf "call" > > - mi_gdb_test "set dprintf-function fprintf" ".*" "mi set dprintf-channel stderr" > - mi_gdb_test "set dprintf-channel stderr" ".*" "mi set dprintf channel" > - mi_continue_dprintf "fprintf" > + # Some compilers don't add information about stderr, > + # so skip these tests if needed. > + if {$::has_stderr_symbol} { > + mi_gdb_test "set dprintf-function fprintf" ".*" "mi set dprintf function" > + mi_gdb_test "set dprintf-channel stderr" ".*" "mi set dprintf channel" > + mi_continue_dprintf "fprintf" > + } > } > > set target_can_dprintf 0 > diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-support.exp > index 49d5e2ef272..468c481ab95 100644 > --- a/gdb/testsuite/lib/mi-support.exp > +++ b/gdb/testsuite/lib/mi-support.exp > @@ -2883,3 +2883,17 @@ proc foreach_mi_ui_mode { var_name body } { > } > } > } > + > +# Check if GDB has information about the stderr symbol. > +proc mi_gdb_is_stderr_available {} { > + set has_stderr_symbol false > + gdb_test_multiple "-data-evaluate-expression stderr" "stderr symbol check" { > + -re "\\^error,msg=\"'stderr' has unknown type; cast it to its declared type\"\r\n$::mi_gdb_prompt$" { > + # Default value of false is fine. > + } > + -re "$::mi_gdb_prompt$" { > + set has_stderr_symbol true > + } > + } > + return $has_stderr_symbol > +}