public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug mi/28077] New: -exec-interrupt in non-stop mode causes internal-error / assertion in target_stop
@ 2021-07-11 19:05 jonah at kichwacoders dot com
2021-07-11 19:42 ` [Bug mi/28077] " jonah at kichwacoders dot com
` (11 more replies)
0 siblings, 12 replies; 13+ messages in thread
From: jonah at kichwacoders dot com @ 2021-07-11 19:05 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=28077
Bug ID: 28077
Summary: -exec-interrupt in non-stop mode causes internal-error
/ assertion in target_stop
Product: gdb
Version: 11.1
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: mi
Assignee: unassigned at sourceware dot org
Reporter: jonah at kichwacoders dot com
Target Milestone: ---
This is a regression in GDB 11 pre-release and current HEAD that worked in GDB
10.
For a simple program like this loop.c.
volatile int i;
int main() {
while (1) {
i += 2;
i *= 2;
}
}
gcc -g -o loop loop.c
causes an internal error like this when doing -exec-interrupt in MI mode, it
does not fail in CLI mode.
target.c:3768: internal-error: void target_stop(ptid_t): Assertion
`!proc_target->commit_resumed_state' failed.
MI commands to reproduce:
$ gdb --interpreter=mi3 # or mi2
-gdb-set non-stop on
-gdb-set mi-async on
-file-exec-and-symbols --thread-group i1 loop
-exec-run
-exec-interrupt --thread-group i1
This was done on Ubuntu 20.04 on x86_64 hardware:
$ lsb_release
LSB Version: core-11.1.0ubuntu2-noarch:security-11.1.0ubuntu2-noarch
$ uname -a
Linux ditto 5.4.0-77-generic #86-Ubuntu SMP Thu Jun 17 02:35:03 UTC 2021 x86_64
x86_64 x86_64 GNU/Linux
$ gcc --version
gcc (Ubuntu 10.3.0-1ubuntu1~20.04) 10.3.0
I am running a git bisect now and will report back if that provides something
useful.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug mi/28077] -exec-interrupt in non-stop mode causes internal-error / assertion in target_stop
2021-07-11 19:05 [Bug mi/28077] New: -exec-interrupt in non-stop mode causes internal-error / assertion in target_stop jonah at kichwacoders dot com
@ 2021-07-11 19:42 ` jonah at kichwacoders dot com
2021-07-12 0:22 ` simark at simark dot ca
` (10 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: jonah at kichwacoders dot com @ 2021-07-11 19:42 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=28077
--- Comment #1 from Jonah Graham <jonah at kichwacoders dot com> ---
The commit that caused the regression is
1192f124a308601f5fef7a35715ccd6f904e7b17
Note that "interrupt" or "-exec-interrupt" without the --thread-group argument
does not cause this to fail.
Here is my oneliner to check (part of my git bisect script):
(sleep .5s ; echo '-gdb-set non-stop on' ; echo '-gdb-set mi-async on' ; echo
'-file-exec-and-symbols --thread-group i1 loop' ; echo '-exec-run' ; sleep .5s
; echo '-exec-interrupt --thread-group i1') | gdb/gdb --interpreter=mi2
The above asserts, but the below doesn't (without the --thread-group):
(sleep .5s ; echo '-gdb-set non-stop on' ; echo '-gdb-set mi-async on' ; echo
'-file-exec-and-symbols --thread-group i1 loop' ; echo '-exec-run' ; sleep .5s
; echo '-exec-interrupt') | gdb/gdb --interpreter=mi2
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug mi/28077] -exec-interrupt in non-stop mode causes internal-error / assertion in target_stop
2021-07-11 19:05 [Bug mi/28077] New: -exec-interrupt in non-stop mode causes internal-error / assertion in target_stop jonah at kichwacoders dot com
2021-07-11 19:42 ` [Bug mi/28077] " jonah at kichwacoders dot com
@ 2021-07-12 0:22 ` simark at simark dot ca
2021-07-12 0:39 ` simark at simark dot ca
` (9 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: simark at simark dot ca @ 2021-07-12 0:22 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=28077
Simon Marchi <simark at simark dot ca> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |11.1
CC| |simark at simark dot ca
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug mi/28077] -exec-interrupt in non-stop mode causes internal-error / assertion in target_stop
2021-07-11 19:05 [Bug mi/28077] New: -exec-interrupt in non-stop mode causes internal-error / assertion in target_stop jonah at kichwacoders dot com
2021-07-11 19:42 ` [Bug mi/28077] " jonah at kichwacoders dot com
2021-07-12 0:22 ` simark at simark dot ca
@ 2021-07-12 0:39 ` simark at simark dot ca
2021-07-12 1:04 ` jonah at kichwacoders dot com
` (8 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: simark at simark dot ca @ 2021-07-12 0:39 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=28077
--- Comment #2 from Simon Marchi <simark at simark dot ca> ---
Thanks for the report.
This should fix it (it fixes it here):
diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c
index e293dddc08d8..44008d1c0a86 100644
--- a/gdb/mi/mi-main.c
+++ b/gdb/mi/mi-main.c
@@ -383,6 +383,9 @@ mi_cmd_exec_interrupt (const char *command, char **argv,
int argc)
{
struct inferior *inf = find_inferior_id (current_context->thread_group);
+ scoped_disable_commit_resumed disable_commit_resumed
+ ("interrupting all threads of thread group");
+
iterate_over_threads (interrupt_thread_callback, &inf->pid);
}
else
I need to write a test though.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug mi/28077] -exec-interrupt in non-stop mode causes internal-error / assertion in target_stop
2021-07-11 19:05 [Bug mi/28077] New: -exec-interrupt in non-stop mode causes internal-error / assertion in target_stop jonah at kichwacoders dot com
` (2 preceding siblings ...)
2021-07-12 0:39 ` simark at simark dot ca
@ 2021-07-12 1:04 ` jonah at kichwacoders dot com
2021-07-12 2:10 ` jonah at kichwacoders dot com
` (7 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: jonah at kichwacoders dot com @ 2021-07-12 1:04 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=28077
--- Comment #3 from Jonah Graham <jonah at kichwacoders dot com> ---
(In reply to Simon Marchi from comment #2)
> This should fix it (it fixes it here):
It does for Comment 0 reduced test case. I am running the Eclipse CDT testsuite
now.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug mi/28077] -exec-interrupt in non-stop mode causes internal-error / assertion in target_stop
2021-07-11 19:05 [Bug mi/28077] New: -exec-interrupt in non-stop mode causes internal-error / assertion in target_stop jonah at kichwacoders dot com
` (3 preceding siblings ...)
2021-07-12 1:04 ` jonah at kichwacoders dot com
@ 2021-07-12 2:10 ` jonah at kichwacoders dot com
2021-07-12 2:17 ` simark at simark dot ca
` (6 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: jonah at kichwacoders dot com @ 2021-07-12 2:10 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=28077
--- Comment #4 from Jonah Graham <jonah at kichwacoders dot com> ---
(In reply to Jonah Graham from comment #3)
> (In reply to Simon Marchi from comment #2)
> > This should fix it (it fixes it here):
>
> It does for Comment 0 reduced test case. I am running the Eclipse CDT
> testsuite now.
Eclipse CDT DSF-GDB testsuites, both local and remote debugging looks good. I
have a remaining failure[1] that I don't know the cause of yet (passes in GDB
10, fails in GDB HEAD). I'll narrow it down and submit it tomorrow hopefully.
[1]
https://ci.eclipse.org/cdt/view/Main%20(debug%20tests)/job/debug-tests-master-gdb-master/lastCompletedBuild/testReport/org.eclipse.cdt.tests.dsf.gdb.tests/OperationsWhileTargetIsRunningTest/detachWhileTargetRunningGDBAlive_gdbserver_/
Thanks Simon!
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug mi/28077] -exec-interrupt in non-stop mode causes internal-error / assertion in target_stop
2021-07-11 19:05 [Bug mi/28077] New: -exec-interrupt in non-stop mode causes internal-error / assertion in target_stop jonah at kichwacoders dot com
` (4 preceding siblings ...)
2021-07-12 2:10 ` jonah at kichwacoders dot com
@ 2021-07-12 2:17 ` simark at simark dot ca
2021-07-12 2:17 ` simark at simark dot ca
` (5 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: simark at simark dot ca @ 2021-07-12 2:17 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=28077
--- Comment #5 from Simon Marchi <simark at simark dot ca> ---
(In reply to Jonah Graham from comment #4)
> (In reply to Jonah Graham from comment #3)
> > (In reply to Simon Marchi from comment #2)
> > > This should fix it (it fixes it here):
> >
> > It does for Comment 0 reduced test case. I am running the Eclipse CDT
> > testsuite now.
>
> Eclipse CDT DSF-GDB testsuites, both local and remote debugging looks good.
> I have a remaining failure[1] that I don't know the cause of yet (passes in
> GDB 10, fails in GDB HEAD). I'll narrow it down and submit it tomorrow
> hopefully.
>
> [1]
> https://ci.eclipse.org/cdt/view/Main%20(debug%20tests)/job/debug-tests-
> master-gdb-master/lastCompletedBuild/testReport/org.eclipse.cdt.tests.dsf.
> gdb.tests/OperationsWhileTargetIsRunningTest/
> detachWhileTargetRunningGDBAlive_gdbserver_/
>
>
> Thanks Simon!
Thanks, I'm almost done writing the test, so I should send a proper patch soon.
For the detachWhileTargetRunning issue, this series may be possible culprit:
https://sourceware.org/pipermail/gdb-patches/2021-January/175040.html
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug mi/28077] -exec-interrupt in non-stop mode causes internal-error / assertion in target_stop
2021-07-11 19:05 [Bug mi/28077] New: -exec-interrupt in non-stop mode causes internal-error / assertion in target_stop jonah at kichwacoders dot com
` (5 preceding siblings ...)
2021-07-12 2:17 ` simark at simark dot ca
@ 2021-07-12 2:17 ` simark at simark dot ca
2021-07-12 2:17 ` simark at simark dot ca
` (4 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: simark at simark dot ca @ 2021-07-12 2:17 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=28077
Simon Marchi <simark at simark dot ca> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2021-07-12
Ever confirmed|0 |1
Status|UNCONFIRMED |NEW
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug mi/28077] -exec-interrupt in non-stop mode causes internal-error / assertion in target_stop
2021-07-11 19:05 [Bug mi/28077] New: -exec-interrupt in non-stop mode causes internal-error / assertion in target_stop jonah at kichwacoders dot com
` (6 preceding siblings ...)
2021-07-12 2:17 ` simark at simark dot ca
@ 2021-07-12 2:17 ` simark at simark dot ca
2021-07-12 2:17 ` simark at simark dot ca
` (3 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: simark at simark dot ca @ 2021-07-12 2:17 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=28077
Simon Marchi <simark at simark dot ca> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug mi/28077] -exec-interrupt in non-stop mode causes internal-error / assertion in target_stop
2021-07-11 19:05 [Bug mi/28077] New: -exec-interrupt in non-stop mode causes internal-error / assertion in target_stop jonah at kichwacoders dot com
` (7 preceding siblings ...)
2021-07-12 2:17 ` simark at simark dot ca
@ 2021-07-12 2:17 ` simark at simark dot ca
2021-07-13 13:26 ` cvs-commit at gcc dot gnu.org
` (2 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: simark at simark dot ca @ 2021-07-12 2:17 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=28077
Simon Marchi <simark at simark dot ca> changed:
What |Removed |Added
----------------------------------------------------------------------------
Assignee|unassigned at sourceware dot org |simark at simark dot ca
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug mi/28077] -exec-interrupt in non-stop mode causes internal-error / assertion in target_stop
2021-07-11 19:05 [Bug mi/28077] New: -exec-interrupt in non-stop mode causes internal-error / assertion in target_stop jonah at kichwacoders dot com
` (8 preceding siblings ...)
2021-07-12 2:17 ` simark at simark dot ca
@ 2021-07-13 13:26 ` cvs-commit at gcc dot gnu.org
2021-07-13 13:27 ` cvs-commit at gcc dot gnu.org
2021-07-13 13:37 ` simark at simark dot ca
11 siblings, 0 replies; 13+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-07-13 13:26 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=28077
--- Comment #6 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Simon Marchi <simark@sourceware.org>:
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=5c046e0e631dc98faec53d99c76f9d3ef44da75c
commit 5c046e0e631dc98faec53d99c76f9d3ef44da75c
Author: Simon Marchi <simon.marchi@polymtl.ca>
Date: Sun Jul 11 22:13:06 2021 -0400
gdb: disable commit-resumed on -exec-interrupt --thread-group
As reported in PR gdb/28077, we hit an internal error when using
-exec-interrupt with --thread-group:
info threads
&"info threads\n"
~" Id Target Id Frame \n"
~"* 1 process 403312 \"loop\" (running)\n"
^done
(gdb)
-exec-interrupt --thread-group i1
~"/home/simark/src/binutils-gdb/gdb/target.c:3768: internal-error: void
target_stop(ptid_t): Assertion `!proc_target->commit_resumed_state' failed.\nA
problem internal to GDB has been detected,\nfurther debugging may prove
unreliable.\nQuit this debugging session? (y or n) "
This is because this code path never disables commit-resumed (a
requirement for calling target_stop, as documented in
process_stratum_target::»commit_resumed_state) before calling
target_stop.
The other 3 code paths in mi_cmd_exec_interrupt use interrupt_target_1,
which does it. But the --thread-group code path uses its own thing
which doesn't do it. Fix this by adding a scoped_disable_commit_resumed
in this code path.
Calling -exec-interrupt with --thread-group is apparently not tested at
the moment (which is why this bug could creep in). Add a new test for
that. The test runs two inferiors and tries to interrupt them with
"-exec-interrupt --thread-group X".
This will need to be merged in the gdb-11-branch, so here are ChangeLog
entries:
gdb/ChangeLog:
* mi/mi-main.c (mi_cmd_exec_interrupt): Use
scoped_disable_commit_resumed in the --thread-group case.
gdb/testsuite/ChangeLog:
* gdb.mi/interrupt-thread-group.c: New.
* gdb.mi/interrupt-thread-group.exp: New.
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28077
Change-Id: I615efefcbcaf2c15d47caf5e4b9d82854b2a2fcb
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug mi/28077] -exec-interrupt in non-stop mode causes internal-error / assertion in target_stop
2021-07-11 19:05 [Bug mi/28077] New: -exec-interrupt in non-stop mode causes internal-error / assertion in target_stop jonah at kichwacoders dot com
` (9 preceding siblings ...)
2021-07-13 13:26 ` cvs-commit at gcc dot gnu.org
@ 2021-07-13 13:27 ` cvs-commit at gcc dot gnu.org
2021-07-13 13:37 ` simark at simark dot ca
11 siblings, 0 replies; 13+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-07-13 13:27 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=28077
--- Comment #7 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The gdb-11-branch branch has been updated by Simon Marchi
<simark@sourceware.org>:
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=1bdfa2b1a8ab4b40372552e3f6ceb3d2c7e621e4
commit 1bdfa2b1a8ab4b40372552e3f6ceb3d2c7e621e4
Author: Simon Marchi <simon.marchi@polymtl.ca>
Date: Tue Jul 13 09:26:50 2021 -0400
gdb: disable commit-resumed on -exec-interrupt --thread-group
As reported in PR gdb/28077, we hit an internal error when using
-exec-interrupt with --thread-group:
info threads
&"info threads\n"
~" Id Target Id Frame \n"
~"* 1 process 403312 \"loop\" (running)\n"
^done
(gdb)
-exec-interrupt --thread-group i1
~"/home/simark/src/binutils-gdb/gdb/target.c:3768: internal-error: void
target_stop(ptid_t): Assertion `!proc_target->commit_resumed_state' failed.\nA
problem internal to GDB has been detected,\nfurther debugging may prove
unreliable.\nQuit this debugging session? (y or n) "
This is because this code path never disables commit-resumed (a
requirement for calling target_stop, as documented in
process_stratum_target::»commit_resumed_state) before calling
target_stop.
The other 3 code paths in mi_cmd_exec_interrupt use interrupt_target_1,
which does it. But the --thread-group code path uses its own thing
which doesn't do it. Fix this by adding a scoped_disable_commit_resumed
in this code path.
Calling -exec-interrupt with --thread-group is apparently not tested at
the moment (which is why this bug could creep in). Add a new test for
that. The test runs two inferiors and tries to interrupt them with
"-exec-interrupt --thread-group X".
This will need to be merged in the gdb-11-branch, so here are ChangeLog
entries:
gdb/ChangeLog:
* mi/mi-main.c (mi_cmd_exec_interrupt): Use
scoped_disable_commit_resumed in the --thread-group case.
gdb/testsuite/ChangeLog:
* gdb.mi/interrupt-thread-group.c: New.
* gdb.mi/interrupt-thread-group.exp: New.
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28077
Change-Id: I615efefcbcaf2c15d47caf5e4b9d82854b2a2fcb
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug mi/28077] -exec-interrupt in non-stop mode causes internal-error / assertion in target_stop
2021-07-11 19:05 [Bug mi/28077] New: -exec-interrupt in non-stop mode causes internal-error / assertion in target_stop jonah at kichwacoders dot com
` (10 preceding siblings ...)
2021-07-13 13:27 ` cvs-commit at gcc dot gnu.org
@ 2021-07-13 13:37 ` simark at simark dot ca
11 siblings, 0 replies; 13+ messages in thread
From: simark at simark dot ca @ 2021-07-13 13:37 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=28077
Simon Marchi <simark at simark dot ca> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|ASSIGNED |RESOLVED
--- Comment #8 from Simon Marchi <simark at simark dot ca> ---
Fixed.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2021-07-13 13:37 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-11 19:05 [Bug mi/28077] New: -exec-interrupt in non-stop mode causes internal-error / assertion in target_stop jonah at kichwacoders dot com
2021-07-11 19:42 ` [Bug mi/28077] " jonah at kichwacoders dot com
2021-07-12 0:22 ` simark at simark dot ca
2021-07-12 0:39 ` simark at simark dot ca
2021-07-12 1:04 ` jonah at kichwacoders dot com
2021-07-12 2:10 ` jonah at kichwacoders dot com
2021-07-12 2:17 ` simark at simark dot ca
2021-07-12 2:17 ` simark at simark dot ca
2021-07-12 2:17 ` simark at simark dot ca
2021-07-12 2:17 ` simark at simark dot ca
2021-07-13 13:26 ` cvs-commit at gcc dot gnu.org
2021-07-13 13:27 ` cvs-commit at gcc dot gnu.org
2021-07-13 13:37 ` simark at simark dot ca
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).