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

Message ID yddo6etgbg5.fsf_-_@CeBiTec.Uni-Bielefeld.DE
State New
Headers
Series [v2] Handle missing catchpoint support in gdb.base/break.exp [PR34535] |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 success Build passed
linaro-tcwg-bot/tcwg_gdb_build--master-arm success Build passed
linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 success Test passed
linaro-tcwg-bot/tcwg_gdb_check--master-arm success Test passed

Commit Message

Rainer Orth Aug. 22, 2026, 8:14 p.m. UTC
  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.
  

Comments

Tom Tromey Aug. 27, 2026, 3:33 p.m. UTC | #1
>>>>> "Rainer" == Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> writes:

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

Thanks.  This seems reasonable to me.
Approved-By: Tom Tromey <tom@tromey.com>

Tom
  

Patch

# 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