From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) by sourceware.org (Postfix) with ESMTPS id 39FC63858C54 for ; Thu, 31 Mar 2022 14:31:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 39FC63858C54 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=palves.net Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wm1-f47.google.com with SMTP id r64so14397919wmr.4 for ; Thu, 31 Mar 2022 07:31:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:references:from:in-reply-to :content-transfer-encoding; bh=TUVZMMPetiuRBQpxjhQtnToFiYCk6YD70Nf7cfI8Lb4=; b=J7G1BIutAGYrUIgqVyiYIpk30S0XnFPUVqqu/GUi4Hxs0VHa4cjf7DPV01h5zxsj+a +c74Oz+iGCeq4U5QDWwptmliUBC+wiRuwz9YsYy9KIcSqaMFNu5YZz2X7GgpGv9SUpIb uNFCOukhet2+SmWtpGWOzcWayd1YgD5PRLZQzQigpSVmoq8pgnUIih+zlNQjvVKpPnr/ NJb35cns4uqD7gQDPdnPPxhgevhrXYAkd5Jwyzo6rcRkvYE9s0Zovggh6Y/LL8xzqVdq 3k41gD+rnmU5L+/CLZmAdbczW25vPB4qXLwfBFiNawR2fGnVOCEy6hGrEpApbuky48B/ EMbw== X-Gm-Message-State: AOAM530oRCKuG5EOTgnnOBgurf08GJWxGg7DNsPZ34eupjvZ38nlDwtO kETP1yfvJeun2O61LTiljmx+QcYCD1mUrQ== X-Google-Smtp-Source: ABdhPJyk1UmphWJPw0IcAxCf0V0POCzM9eEhkjId5NGcxaujICd+LZAeYLO2cuMWBSihTb0JDxcI1g== X-Received: by 2002:a05:600c:4e4b:b0:38c:eebc:2ec4 with SMTP id e11-20020a05600c4e4b00b0038ceebc2ec4mr5037879wmq.47.1648737085873; Thu, 31 Mar 2022 07:31:25 -0700 (PDT) Received: from ?IPV6:2001:8a0:f924:2600:209d:85e2:409e:8726? ([2001:8a0:f924:2600:209d:85e2:409e:8726]) by smtp.gmail.com with ESMTPSA id z5-20020a05600c0a0500b0037fa93193a8sm9299026wmp.44.2022.03.31.07.31.24 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 31 Mar 2022 07:31:24 -0700 (PDT) Message-ID: Date: Thu, 31 Mar 2022 15:31:23 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Subject: Re: [PATCH 11/11] explicitly test for stderr in gdb.base/dprintf.exp Content-Language: en-US To: Bruno Larsen , gdb-patches@sourceware.org References: <20220126195053.69559-1-blarsen@redhat.com> <20220126195053.69559-12-blarsen@redhat.com> <22373b29-cda4-2246-edbf-8330ea67bc40@palves.net> From: Pedro Alves In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00, BODY_8BITS, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: , X-List-Received-Date: Thu, 31 Mar 2022 14:31:28 -0000 On 2022-03-31 14:44, Bruno Larsen wrote: > On 3/2/22 13:50, Pedro Alves wrote: >> On 2022-01-26 19:50, Bruno Larsen via Gdb-patches wrote: >>> Not all compilers explicitly add stderr information when compiling a >> >> It helps if you say "debug information" instead of just "information". > > Ok, I'll try to be more explicit. > >> >>> program, so to avoid an unrelated failure, we explicitly test to see if >>> the compiler has added information about it at all. This was done >>> thinking specifically about clang, since it doesn't add stderr >>> information and developers treat it as a feature. >> >> Please include a snippet of the failure in the commit log. >> >> I ran the test locally against clang, and I do see a failure here too: >> >>   (gdb) PASS: gdb.base/dprintf.exp: call: fprintf: set dprintf style to call >>   continue >>   Continuing. >>   kickoff 1234 >>   also to stderr 1234 >>   'stderr' has unknown type; cast it to its declared type >>   (gdb) FAIL: gdb.base/dprintf.exp: call: fprintf: 1st dprintf (timeout) >> >> However, when I debug the program manually, I see that gdb is able to print stderr, >> if you run to main first: >> >>   (gdb) p stderr >>   'stderr' has unknown type; cast it to its declared type >>   (gdb) start >>   Temporary breakpoint 1 at 0x4011f6: file ../../../src/gdb/testsuite/gdb.base/dprintf.c, line 35. >>   Starting program: /home/pedro/rocm/gdb/build/gdb/testsuite/outputs/gdb.base/dprintf/dprintf >> >>   Temporary breakpoint 1, main (argc=1, argv=0x7fffffffdc18) at ../../../src/gdb/testsuite/gdb.base/dprintf.c:35 >>   35        int loc = 1234; >>   (gdb) p stderr >>   $1 = (FILE *) 0x7ffff7e4e5c0 <_IO_2_1_stderr_> >> >> So... it doesn't seem like the premise of the patch is correct, for the testcase >> runs to main -- see the "restart" call in the context of your patch, just below. >> Seems like something else may be going on?  Why is GDB not finding the debug info for >> stderr in the dprintf call, while manually it is able to find it? > > I think it might be because of external debug information. if I run the test with debuginfod, I get the same output as you: I don't have debuginfo enabled, in fact I don't even have it compiled into gdb: (gdb) set debuginfod enabled off Support for debuginfod is not compiled into GDB. However, that's a hint -- it's really something similar. I had: set debug-file-directory /usr/lib/debug in my ~/.gdbinit, and the GDB I was using wasn't automatically picking that debug dir. So when I run the test via dejagnu, GDB is started with -nx, and I saw the failure, because then I had no debug info for libc. When I run GDB manually (without -nx), I have debug info due to the debug-file-directory setting, and I can print stderr. Doh!