public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug python/31391] New: Incorrect FinishBreakpoint test
@ 2024-02-16 15:41 tromey at sourceware dot org
2024-02-18 10:23 ` [Bug python/31391] " ssbssa at sourceware dot org
` (6 more replies)
0 siblings, 7 replies; 8+ messages in thread
From: tromey at sourceware dot org @ 2024-02-16 15:41 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=31391
Bug ID: 31391
Summary: Incorrect FinishBreakpoint test
Product: gdb
Version: HEAD
Status: NEW
Severity: normal
Priority: P2
Component: python
Assignee: unassigned at sourceware dot org
Reporter: tromey at sourceware dot org
Target Milestone: ---
py-finishbreakpoint.exp does this:
gdb_test "python print (finishbp_default.hit_count)" "1.*" "check finishBP
on default frame has been hit"
It is trying to check the hit count of this breakpoint.
However, the actual output is:
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.
... which matches by mistake.
This came up in a patch series I'm working on.
I plan to kfail this but not close this bug; I think
this probably is a real problem of some sort.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug python/31391] Incorrect FinishBreakpoint test
2024-02-16 15:41 [Bug python/31391] New: Incorrect FinishBreakpoint test tromey at sourceware dot org
@ 2024-02-18 10:23 ` ssbssa at sourceware dot org
2024-02-26 16:05 ` vries at gcc dot gnu.org
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: ssbssa at sourceware dot org @ 2024-02-18 10:23 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=31391
Hannes Domani <ssbssa at sourceware dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |ssbssa at sourceware dot org
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug python/31391] Incorrect FinishBreakpoint test
2024-02-16 15:41 [Bug python/31391] New: Incorrect FinishBreakpoint test tromey at sourceware dot org
2024-02-18 10:23 ` [Bug python/31391] " ssbssa at sourceware dot org
@ 2024-02-26 16:05 ` vries at gcc dot gnu.org
2024-02-27 8:22 ` vries at gcc dot gnu.org
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: vries at gcc dot gnu.org @ 2024-02-26 16:05 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=31391
Tom de Vries <vries at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |vries at gcc dot gnu.org
--- Comment #1 from Tom de Vries <vries at gcc dot gnu.org> ---
(In reply to Tom Tromey from comment #0)
> py-finishbreakpoint.exp does this:
>
> gdb_test "python print (finishbp_default.hit_count)" "1.*" "check
> finishBP on default frame has been hit"
>
> It is trying to check the hit count of this breakpoint.
> However, the actual output is:
>
> 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.
>
>
> ... which matches by mistake.
> This came up in a patch series I'm working on.
>
> I plan to kfail this but not close this bug; I think
> this probably is a real problem of some sort.
I think this may be the behaviour specified here (
https://sourceware.org/gdb/current/onlinedocs/gdb.html/Breakpoints-In-Python.html
):
...
The optional temporary argument makes the breakpoint a temporary breakpoint.
Temporary breakpoints are deleted after they have been hit. Any further access
to the Python breakpoint after it has been hit will result in a runtime error
(as that breakpoint has now been automatically deleted).
...
So AFAIU, this happens:
- finish breakpoints 3 and 4 are set at the same location
- a continue hits both finish breakpoints
- the hit_count is not available in either breakpoint, as per the doc, because
both temporary breakpoints have been deleted.
- the return_value is available in both finish breakpoints, because it doesn't
rely on accessing the underlying python breakpoint
I think the test-case can be updated to accept the current behaviour, or we can
even remove the hit_count test.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug python/31391] Incorrect FinishBreakpoint test
2024-02-16 15:41 [Bug python/31391] New: Incorrect FinishBreakpoint test tromey at sourceware dot org
2024-02-18 10:23 ` [Bug python/31391] " ssbssa at sourceware dot org
2024-02-26 16:05 ` vries at gcc dot gnu.org
@ 2024-02-27 8:22 ` vries at gcc dot gnu.org
2024-02-27 9:14 ` vries at gcc dot gnu.org
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: vries at gcc dot gnu.org @ 2024-02-27 8:22 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=31391
--- Comment #2 from Tom de Vries <vries at gcc dot gnu.org> ---
(In reply to Tom de Vries from comment #1)
> (In reply to Tom Tromey from comment #0)
> > py-finishbreakpoint.exp does this:
> >
> > gdb_test "python print (finishbp_default.hit_count)" "1.*" "check
> > finishBP on default frame has been hit"
> >
> > It is trying to check the hit count of this breakpoint.
> > However, the actual output is:
> >
> > 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.
> >
> >
> > ... which matches by mistake.
> > This came up in a patch series I'm working on.
> >
> > I plan to kfail this but not close this bug; I think
> > this probably is a real problem of some sort.
>
> I think this may be the behaviour specified here (
> https://sourceware.org/gdb/current/onlinedocs/gdb.html/Breakpoints-In-Python.
> html ):
> ...
> The optional temporary argument makes the breakpoint a temporary breakpoint.
> Temporary breakpoints are deleted after they have been hit. Any further
> access to the Python breakpoint after it has been hit will result in a
> runtime error (as that breakpoint has now been automatically deleted).
> ...
>
> So AFAIU, this happens:
> - finish breakpoints 3 and 4 are set at the same location
> - a continue hits both finish breakpoints
> - the hit_count is not available in either breakpoint, as per the doc,
> because
> both temporary breakpoints have been deleted.
> - the return_value is available in both finish breakpoints, because it
> doesn't
> rely on accessing the underlying python breakpoint
>
> I think the test-case can be updated to accept the current behaviour, or we
> can even remove the hit_count test.
I'll write a patch to this effect.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug python/31391] Incorrect FinishBreakpoint test
2024-02-16 15:41 [Bug python/31391] New: Incorrect FinishBreakpoint test tromey at sourceware dot org
` (2 preceding siblings ...)
2024-02-27 8:22 ` vries at gcc dot gnu.org
@ 2024-02-27 9:14 ` vries at gcc dot gnu.org
2024-02-27 9:14 ` [Bug testsuite/31391] " vries at gcc dot gnu.org
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: vries at gcc dot gnu.org @ 2024-02-27 9:14 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=31391
--- Comment #3 from Tom de Vries <vries at gcc dot gnu.org> ---
(In reply to Tom de Vries from comment #2)
> I'll write a patch to this effect.
https://sourceware.org/pipermail/gdb-patches/2024-February/206853.html
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug testsuite/31391] Incorrect FinishBreakpoint test
2024-02-16 15:41 [Bug python/31391] New: Incorrect FinishBreakpoint test tromey at sourceware dot org
` (3 preceding siblings ...)
2024-02-27 9:14 ` vries at gcc dot gnu.org
@ 2024-02-27 9:14 ` vries at gcc dot gnu.org
2024-02-27 15:18 ` cvs-commit at gcc dot gnu.org
2024-02-27 15:19 ` vries at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: vries at gcc dot gnu.org @ 2024-02-27 9:14 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=31391
Tom de Vries <vries at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Component|python |testsuite
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug testsuite/31391] Incorrect FinishBreakpoint test
2024-02-16 15:41 [Bug python/31391] New: Incorrect FinishBreakpoint test tromey at sourceware dot org
` (4 preceding siblings ...)
2024-02-27 9:14 ` [Bug testsuite/31391] " vries at gcc dot gnu.org
@ 2024-02-27 15:18 ` cvs-commit at gcc dot gnu.org
2024-02-27 15:19 ` vries at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-02-27 15:18 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=31391
--- Comment #4 from Sourceware Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Tom de Vries <vries@sourceware.org>:
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=cfb9cb1afd93dc71ea94ec7c7d9bfc0e43ace0bc
commit cfb9cb1afd93dc71ea94ec7c7d9bfc0e43ace0bc
Author: Tom de Vries <tdevries@suse.de>
Date: Tue Feb 27 16:18:32 2024 +0100
[gdb/testsuite] Fix test in gdb.python/py-finish-breakpoint.exp
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.
Approved-By: Tom Tromey <tom@tromey.com>
PR testsuite/31391
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31391
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug testsuite/31391] Incorrect FinishBreakpoint test
2024-02-16 15:41 [Bug python/31391] New: Incorrect FinishBreakpoint test tromey at sourceware dot org
` (5 preceding siblings ...)
2024-02-27 15:18 ` cvs-commit at gcc dot gnu.org
@ 2024-02-27 15:19 ` vries at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: vries at gcc dot gnu.org @ 2024-02-27 15:19 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=31391
Tom de Vries <vries at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Target Milestone|--- |15.1
Resolution|--- |FIXED
--- Comment #5 from Tom de Vries <vries at gcc dot gnu.org> ---
Fixed.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2024-02-27 15:19 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-16 15:41 [Bug python/31391] New: Incorrect FinishBreakpoint test tromey at sourceware dot org
2024-02-18 10:23 ` [Bug python/31391] " ssbssa at sourceware dot org
2024-02-26 16:05 ` vries at gcc dot gnu.org
2024-02-27 8:22 ` vries at gcc dot gnu.org
2024-02-27 9:14 ` vries at gcc dot gnu.org
2024-02-27 9:14 ` [Bug testsuite/31391] " vries at gcc dot gnu.org
2024-02-27 15:18 ` cvs-commit at gcc dot gnu.org
2024-02-27 15:19 ` vries at gcc dot gnu.org
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).