[PATCH v2] Handle missing catchpoint support in gdb.base/break.exp [PR34535]

Rainer Orth <[email protected]>
Newsgroups gmane.comp.gdb.patches
Message-ID <[email protected]>
Hi Tom,

> Rainer> While this patch avoids the failure, I wonder if there's some document
> Rainer> on what it takes to actually implement catchpoints.
>
> There's not really docs on anything.  However, most catchpoints are
> implemented in break-catch-*.c.  Looking at break-catch-fork.c:

thanks for the explanation.  I may give it a try, but probably will go
for lower-hanging fruit first.  In the past, I've repeatedly failed
miserably with patches requiring to dive more deeply into gdb...

> Rainer> +    set test "probe fork catchpoint"
> Rainer> +    gdb_test_multiple "" $test {
> Rainer> +	-re "Your system does not support this type.*" {
> Rainer> +	    unsupported $test
> Rainer> +	}
> Rainer> +	-re "$::gdb_prompt $" {
> Rainer> +	    set ::fork_catchpoints_supported 1
> Rainer> +	    pass $test
> Rainer> +	}
> Rainer> +    }
> Rainer> +}
>  
> Rainer> +    if {!$::fork_catchpoints_supported} {
> Rainer> +	return
> Rainer> +    }
> Rainer> +
> Rainer>      gdb_test "catch fork" "Catchpoint ${::decimal} \\(fork\\)" \
> Rainer>  	"set catch fork, never expected to trigger"
>  
> I think it would be better to just use gdb_test_multiple here, and if
> the "not supported" case is found, just return here.  That would avoid
> starting another gdb.

Good idea.  I did it with the separate test before because the errors
only occur on the "continue" after setting the catchpoints.

So here's the revision: it certainly makes things clearer and simpler.
I think it's better to go for UNSUPPORTED here instead of just skipping
the rest of the test.

---------------------------------------------------------------------------

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 handles that condition.

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

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University
sol2-break-no-catchpoint.patch (text/x-patch, 766 B)
# HG changeset patch
# Parent  d1c17963050f4ebaae63ff7cfb1eb8e5c5d7fc77
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
@@ -471,7 +471,14 @@ proc_with_prefix test_no_break_on_catchp
     gdb_test "catch exec" "Catchpoint ${::decimal} \\(exec\\)" \
 	"set catch exec, never expected to trigger"
 
-    gdb_continue_to_end
+    gdb_test_multiple "continue" "" {
+	-re "Your system does not support this type.*" {
+	    unsupported "target does not support this type of catchpoint"
+	}
+	-re "Continuing." {
+	    pass "continue until exit"
+	}
+    }
 }
 
 test_no_break_on_catchpoint
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.