public inbox for gdb-cvs@sourceware.org help / color / mirror / Atom feed
From: Bruno Larsen <blarsen@sourceware.org> To: gdb-cvs@sourceware.org Subject: [binutils-gdb] explicitly test for stderr in gdb.base/dprintf.exp Date: Tue, 13 Sep 2022 12:08:05 +0000 (GMT) [thread overview] Message-ID: <20220913120805.170913858C53@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=3f5bbc3e2075ef5061a815c73fdc277218489f22 commit 3f5bbc3e2075ef5061a815c73fdc277218489f22 Author: Bruno Larsen <blarsen@redhat.com> Date: Wed Jul 20 16:44:36 2022 -0300 explicitly test for stderr in gdb.base/dprintf.exp 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: (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) 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/dprintf.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=1235, g=2222\r\n" "2nd dprintf" } + 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
reply other threads:[~2022-09-13 12:08 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20220913120805.170913858C53@sourceware.org \ --to=blarsen@sourceware.org \ --cc=gdb-cvs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).