From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 7862) id 170913858C53; Tue, 13 Sep 2022 12:08:05 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 170913858C53 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1663070885; bh=Ic2ypAi9I+wDmn9AyKC1Qh5oqrFH3d3pbjYXyhVLJP8=; h=From:To:Subject:Date:From; b=WZ8MwhWiTCPFxfqQE/qnLvreUxzexWQnc1Icrv9C4x+Ak6+Jx4yn5lcSpOxuOEi+a z8qF1LY27EGH8tMwbaakUPM/rkP3+38859H7bFpfn9p3B9DTA6GsEphWRAxWs43rdV r6miDD4dX9bAh3J3PoA1wQqwcUxq8gZnA7eC3Isg= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Bruno Larsen To: gdb-cvs@sourceware.org Subject: [binutils-gdb] explicitly test for stderr in gdb.base/dprintf.exp X-Act-Checkin: binutils-gdb X-Git-Author: Bruno Larsen X-Git-Refname: refs/heads/master X-Git-Oldrev: 6a69b0a1804fed5ad106ae0664733d6569f30061 X-Git-Newrev: 3f5bbc3e2075ef5061a815c73fdc277218489f22 Message-Id: <20220913120805.170913858C53@sourceware.org> Date: Tue, 13 Sep 2022 12:08:05 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D3f5bbc3e2075= ef5061a815c73fdc277218489f22 commit 3f5bbc3e2075ef5061a815c73fdc277218489f22 Author: Bruno Larsen Date: Wed Jul 20 16:44:36 2022 -0300 explicitly test for stderr in gdb.base/dprintf.exp =20 Not all compilers add stderr debug information when compiling a program. Clang, for instance, prefers to add nothing from standard libraries and let an external debug package have this information. Because of this, gdb.base/dprintf.exp was failing when GDB attempted to use dprintf as a call to fprintf(stderrr, ...), like this: =20 (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) =20 To avoid this false positive, we explicitly test to see if the compiler has added information about stderr at all, and abort testing dprintf as an fprintf call if it is unavailable. Diff: --- gdb/testsuite/gdb.base/dprintf.exp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/gdb/testsuite/gdb.base/dprintf.exp b/gdb/testsuite/gdb.base/dp= rintf.exp index 0b209c02a62..7b89a0db9bd 100644 --- a/gdb/testsuite/gdb.base/dprintf.exp +++ b/gdb/testsuite/gdb.base/dprintf.exp @@ -111,6 +111,16 @@ proc test_call {} { test_dprintf "At foo entry.*arg=3D1235, g=3D2222\r\n" "2nd dprintf" } =20 + gdb_test_multiple "print stderr" "stderr symbol check" { + -re "\\'stderr\\' has unknown type.*" { + untested "No information available for stderr, exiting early" + return + } + -re "\\\$1.*" { + pass $gdb_test_name + } + } + with_test_prefix "fprintf" { restart