]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - gdb/testsuite/gdb.base/dprintf.exp
Update copyright year range in header of all files managed by GDB
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.base / dprintf.exp
index 68a035dfe15ae6f565e4abfdf1752e41cebd71aa..8b284a8d93d79a98df249f176ca56796903de9b3 100644 (file)
@@ -1,4 +1,4 @@
-#   Copyright (C) 2012-2020 Free Software Foundation, Inc.
+#   Copyright (C) 2012-2024 Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
 
 standard_testfile
 
-if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } {
+set flags {}
+lappend flags debug
+lappend_include_file flags $srcdir/lib/unbuffer_output.c
+
+if { [prepare_for_testing "failed to prepare" $testfile $srcfile $flags] } {
     return -1
 }
 
 set bp_location1 [gdb_get_line_number "set breakpoint 1 here"]
 set dp_location1 [gdb_get_line_number "set dprintf 1 here"]
 
-if ![runto main] {
+if ![runto_main] {
     return -1
 }
 
@@ -72,7 +76,7 @@ proc restart {} {
 
     clean_restart $binfile
 
-    if ![runto main] {
+    if ![runto_main] {
        return -1
     }
 
@@ -111,6 +115,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
 
@@ -160,7 +174,7 @@ proc test_agent {} {
        return
     }
 
-    # Even if the the target reports that it does support target side
+    # Even if the target reports that it does support target side
     # commands, we can only tell that it supports them in combination
     # with a particular breakpoint type (Z0, Z1, etc.) when we try to
     # insert the breakpoint.  When "set breakpoint always-inserted is
@@ -204,7 +218,10 @@ gdb_test "set dprintf-style foobar" "Undefined item: \"foobar\"." \
 # as expected.  dprintf relies on support for target-side breakpoint
 # commands --- use it as proxy.
 if [gdb_is_target_remote] {
-    gdb_test_no_output "set remote breakpoint-commands-packet off"
+    gdb_test \
+       "set remote breakpoint-commands-packet off" \
+       "Support for the 'BreakpointCommands' packet on the current remote target is set to \"off\"."
+
     gdb_test "set dprintf-style agent" \
        "warning: Target cannot run dprintf commands.*" \
        "set dprintf-style agent, with feature disabled"