[PATCH] Skip gdb.base/break.exp catchpoint tests without catchpoints [PR34535]

Rainer Orth <[email protected]>
Newsgroups gmane.comp.gdb.patches
Message-ID <[email protected]>
As detailed in PR PR testsuite/34535, the gdb.base/break.exp test FAILs
on Solaris:

FAIL: gdb.base/break.exp: test_no_break_on_catchpoint: continue until exit (the program exited)

warning: Error inserting catchpoint 2: Your system does not support this type of catchpoint.
warning: Error inserting catchpoint 3: Your system does not support this type of catchpoint.
warning: Error inserting catchpoint 4: Your system does not support this type of catchpoint.

This patch checks for that condition and skips the test if necessary.

Tested on x86_64-pc-solaris2.11, sparcv9-sun-solaris2.11, and
x86_64-pc-linux-gnu.

Ok for trunk?


While this patch avoids the failure, I wonder if there's some document
on what it takes to actually implement catchpoints.

	Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University
sol2-break-no-catchpoint.patch (text/x-patch, 1.2 KB)
# HG changeset patch
# Parent  8ed1f8219b70efa33fd9525699d984918e07bc4c
Skip gdb.base/break.exp catchpoint tests without catchpoints [PR34535]

diff --git a/gdb/testsuite/gdb.base/break.exp b/gdb/testsuite/gdb.base/break.exp
--- a/gdb/testsuite/gdb.base/break.exp
+++ b/gdb/testsuite/gdb.base/break.exp
@@ -455,6 +455,33 @@ test_tbreak
 # inappropriately.  (There are no calls to those system functions
 # in this test program.)
 
+set fork_catchpoints_supported 0
+
+proc probe_fork_catchpoint {} {
+    clean_restart break
+
+    if {![runto_main]} {
+	return
+    }
+
+    gdb_test "catch fork" "Catchpoint.*fork.*"
+
+    gdb_run_cmd
+
+    set test "probe fork catchpoint"
+    gdb_test_multiple "" $test {
+	-re "Your system does not support this type.*" {
+	    unsupported $test
+	}
+	-re "$::gdb_prompt $" {
+	    set ::fork_catchpoints_supported 1
+	    pass $test
+	}
+    }
+}
+
+probe_fork_catchpoint
+
 proc_with_prefix test_no_break_on_catchpoint {} {
     clean_restart break
 
@@ -462,6 +489,10 @@ proc_with_prefix test_no_break_on_catchp
 	return
     }
 
+    if {!$::fork_catchpoints_supported} {
+	return
+    }
+
     gdb_test "catch fork" "Catchpoint ${::decimal} \\(fork\\)" \
 	"set catch fork, never expected to trigger"
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.