aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite
diff options
context:
space:
mode:
authorBruno Larsen <blarsen@redhat.com>2022-07-20 16:44:36 -0300
committerBruno Larsen <blarsen@redhat.com>2022-09-13 13:12:11 +0200
commit3f5bbc3e2075ef5061a815c73fdc277218489f22 (patch)
treed8ff7203958b089b8fd6196810515da8e1a94457 /gdb/testsuite
parent6a69b0a1804fed5ad106ae0664733d6569f30061 (diff)
downloadgdb-3f5bbc3e2075ef5061a815c73fdc277218489f22.zip
gdb-3f5bbc3e2075ef5061a815c73fdc277218489f22.tar.gz
gdb-3f5bbc3e2075ef5061a815c73fdc277218489f22.tar.bz2
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.
Diffstat (limited to 'gdb/testsuite')
-rw-r--r--gdb/testsuite/gdb.base/dprintf.exp10
1 files changed, 10 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.base/dprintf.exp b/gdb/testsuite/gdb.base/dprintf.exp
index 0b209c0..7b89a0d 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