* [PATCH] [gdb/testsuite] Fix test in gdb.python/py-finish-breakpoint.exp
@ 2024-02-27 9:13 Tom de Vries
2024-02-27 14:05 ` Tom Tromey
0 siblings, 1 reply; 2+ messages in thread
From: Tom de Vries @ 2024-02-27 9:13 UTC (permalink / raw)
To: gdb-patches
With test-case gdb.python/py-finish-breakpoint.exp, we run into:
...
(gdb) python print (finishbp_default.hit_count)
Traceback (most recent call last):
File "<string>", line 1, in <module>
RuntimeError: Breakpoint 3 is invalid.
Error while executing Python code.
(gdb) PASS: gdb.python/py-finish-breakpoint.exp: normal conditions: \
check finishBP on default frame has been hit
...
The test producing the pass is:
...
gdb_test "python print (finishbp_default.hit_count)" "1.*" \
"check finishBP on default frame has been hit"
...
so the pass is produced because the 1 in "line 1" matches "1.*".
Temporary breakpoints are removed when hit, and consequently accessing the
hit_count attribute of a temporary python breakpoint (gdb.Breakpoint class) is
not possible, and as per spec we get a RuntimeError.
So the RuntimeError is correct, and not specific to finish breakpoints.
The test presumably attempts to match:
...
(gdb) python print (finishbp_default.hit_count)
1
...
but most likely this output was never produced by any gdb version.
Fix this by checking whether the finishbp_default breakpoint has hit by
checking that finishbp_default.is_valid() is False.
Tested on aarch64-linux.
PR testsuite/31391
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31391
---
gdb/testsuite/gdb.python/py-finish-breakpoint.exp | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/gdb/testsuite/gdb.python/py-finish-breakpoint.exp b/gdb/testsuite/gdb.python/py-finish-breakpoint.exp
index 45e2630337f..600a2f38392 100644
--- a/gdb/testsuite/gdb.python/py-finish-breakpoint.exp
+++ b/gdb/testsuite/gdb.python/py-finish-breakpoint.exp
@@ -73,7 +73,8 @@ with_test_prefix "normal conditions" {
"check MyFinishBreakpoint hit"
gdb_test "python print (finishbp.return_value)" "-5.*" "check return_value"
- gdb_test "python print (finishbp_default.hit_count)" "1.*" "check finishBP on default frame has been hit"
+ gdb_test "python print (finishbp_default.is_valid())" "False" \
+ "check finishBP on default frame has been hit"
gdb_test "python print (finishbp.is_valid())" "False.*"\
"ensure that finish bp is invalid afer normal hit"
base-commit: 268391acb9fa956bad24533e2cc0d1459dea1b3d
--
2.35.3
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] [gdb/testsuite] Fix test in gdb.python/py-finish-breakpoint.exp
2024-02-27 9:13 [PATCH] [gdb/testsuite] Fix test in gdb.python/py-finish-breakpoint.exp Tom de Vries
@ 2024-02-27 14:05 ` Tom Tromey
0 siblings, 0 replies; 2+ messages in thread
From: Tom Tromey @ 2024-02-27 14:05 UTC (permalink / raw)
To: Tom de Vries; +Cc: gdb-patches
>>>>> "Tom" == Tom de Vries <tdevries@suse.de> writes:
Tom> Fix this by checking whether the finishbp_default breakpoint has hit by
Tom> checking that finishbp_default.is_valid() is False.
Tom> Tested on aarch64-linux.
Tom> PR testsuite/31391
Tom> Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31391
Ok.
Approved-By: Tom Tromey <tom@tromey.com>
Tom
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-02-27 14:05 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-27 9:13 [PATCH] [gdb/testsuite] Fix test in gdb.python/py-finish-breakpoint.exp Tom de Vries
2024-02-27 14:05 ` Tom Tromey
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).