Bug 15434 - Dprintf uses a synchronous 'continue' even in non-stop mode
Summary: Dprintf uses a synchronous 'continue' even in non-stop mode
Status: VERIFIED FIXED
Alias: None
Product: gdb
Classification: Unclassified
Component: breakpoints (show other bugs)
Version: HEAD
: P2 normal
Target Milestone: 7.6.1
Assignee: teawater
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-05-06 02:25 UTC by Marc Khouzam
Modified: 2021-09-22 17:01 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Marc Khouzam 2013-05-06 02:25:50 UTC
In non-stop mode, when hitting a dprintf, that dprintf resumes execution with a 'continue' command.  This blocks the asynchronous I/O of GDB, which prevents a frontend from interacting with it.  In non-stop mode, MI mode always does an asynchronous continue, but dprintf does not; therefore hitting a dprintf brings GDB in a state that is not expected by the frontend.

I'm pretty sure this will be solved when fixing Bug 15075, but I was told it is better to open all bugs to make sure every known problem is resolved.
Comment 1 teawater 2013-05-13 06:53:05 UTC
(gdb) set non-stop on
(gdb) dprintf 8,"go\n"
Dprintf 1 at 0x40055c: file 1.c, line 8.
(gdb) r&
Asynchronous execution not supported on this target.
Comment 2 teawater 2013-05-13 06:59:31 UTC
Even if I patch the patch for Bug 15075, this bug still can be reproduced.

So it need to be handled separately.
Comment 3 Marc Khouzam 2013-05-13 17:07:13 UTC
(In reply to comment #1)

For non-stop you need to start with

(gdb) set target-async on

> (gdb) set non-stop on
> (gdb) dprintf 8,"go\n"
> Dprintf 1 at 0x40055c: file 1.c, line 8.
> (gdb) r&
> Asynchronous execution not supported on this target.
Comment 4 Marc Khouzam 2013-05-13 17:12:53 UTC
To see the problem, I suggest you do the following:

(gdb) set target-async on
(gdb) set non-stop on
(gdb) r&

Then type:
 interrupt

The thread should be interrupted.  This is the expected behavior because in non-stop, you can still talk to GDB when the inferior is running.

The bad behavior is from:

(gdb) set target-async on
(gdb) set non-stop on
(gdb) dprintf 8,"go\n"
(gdb) r&

Then, when you type interrupt, GDB will ignore it because it did a 'continue' at the dprintf, instead of a 'continue&'.  You must then do ^C to get control back.
Comment 5 teawater 2013-05-14 12:14:44 UTC
Oops.  Sorry for my mistake for this bug.

I tried patch in http://sourceware.org/ml/gdb-patches/2013-04/msg00711.html for bug 
It can handle this bug.

I will update test for this bug in that thread.

Thanks,
Hui
Comment 7 Sourceware Commits 2013-06-25 11:37:50 UTC
CVSROOT:	/cvs/src
Module name:	src
Changes by:	teawater@sourceware.org	2013-06-25 11:37:48

Modified files:
	gdb            : ChangeLog breakpoint.c breakpoint.h 
	gdb/testsuite  : ChangeLog 
	gdb/testsuite/gdb.base: dprintf.exp 
	gdb/testsuite/gdb.mi: mi-breakpoint-changed.exp 
Added files:
	gdb/testsuite/gdb.base: dprintf-next.c dprintf-next.exp 
	                        dprintf-non-stop.c dprintf-non-stop.exp 

Log message:
	2013-06-25  Yao Qi  <yao@codesourcery.com>
	Hui Zhu  <hui@codesourcery.com>
	Pedro Alves  <palves@redhat.com>
	
	PR breakpoints/15075
	PR breakpoints/15434
	* breakpoint.c (bpstat_stop_status): Call
	b->ops->after_condition_true.
	(update_dprintf_command_list): Don't append "continue" command
	to the command list of dprintf breakpoint.
	(base_breakpoint_after_condition_true): New function.
	(base_breakpoint_ops): Add base_breakpoint_after_condition_true.
	(dprintf_after_condition_true): New function.
	(initialize_breakpoint_ops): Set dprintf_after_condition_true.
	* breakpoint.h (breakpoint_ops): Add after_condition_true.
	
	2013-06-25  Yao Qi  <yao@codesourcery.com>
	Hui Zhu  <hui@codesourcery.com>
	Pedro Alves  <palves@redhat.com>
	
	PR breakpoints/15075
	PR breakpoints/15434
	* gdb.base/dprintf-next.c: New file.
	* gdb.base/dprintf-next.exp: New file.
	* gdb.base/dprintf-non-stop.c: New file.
	* gdb.base/dprintf-non-stop.exp: New file.
	* gdb.base/dprintf.exp: Don't check "continue" in the output
	of "info breakpoints".
	* gdb.mi/mi-breakpoint-changed.exp (test_insert_delete_modify):
	Don't check "continue" in script field.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/ChangeLog.diff?cvsroot=src&r1=1.15735&r2=1.15736
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/breakpoint.c.diff?cvsroot=src&r1=1.769&r2=1.770
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/breakpoint.h.diff?cvsroot=src&r1=1.199&r2=1.200
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/ChangeLog.diff?cvsroot=src&r1=1.3704&r2=1.3705
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/gdb.base/dprintf-next.c.diff?cvsroot=src&r1=NONE&r2=1.1
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/gdb.base/dprintf-next.exp.diff?cvsroot=src&r1=NONE&r2=1.1
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/gdb.base/dprintf-non-stop.c.diff?cvsroot=src&r1=NONE&r2=1.1
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/gdb.base/dprintf-non-stop.exp.diff?cvsroot=src&r1=NONE&r2=1.1
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/gdb.base/dprintf.exp.diff?cvsroot=src&r1=1.10&r2=1.11
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/gdb.mi/mi-breakpoint-changed.exp.diff?cvsroot=src&r1=1.6&r2=1.7
Comment 8 teawater 2013-06-25 11:42:46 UTC
Fixed.
Comment 9 Sourceware Commits 2013-06-26 02:32:00 UTC
CVSROOT:	/cvs/src
Module name:	src
Branch: 	gdb_7_6-branch
Changes by:	teawater@sourceware.org	2013-06-26 02:31:58

Modified files:
	gdb            : breakpoint.c breakpoint.h 
	gdb/testsuite/gdb.base: dprintf.exp 
	gdb/testsuite/gdb.mi: mi-breakpoint-changed.exp 

Log message:
	2013-06-26  Yao Qi  <yao@codesourcery.com>
	Hui Zhu  <hui@codesourcery.com>
	Pedro Alves  <palves@redhat.com>
	
	PR breakpoints/15075
	PR breakpoints/15434
	* breakpoint.c (bpstat_stop_status): Call
	b->ops->after_condition_true.
	(update_dprintf_command_list): Don't append "continue" command
	to the command list of dprintf breakpoint.
	(base_breakpoint_after_condition_true): New function.
	(base_breakpoint_ops): Add base_breakpoint_after_condition_true.
	(dprintf_after_condition_true): New function.
	(initialize_breakpoint_ops): Set dprintf_after_condition_true.
	* breakpoint.h (breakpoint_ops): Add after_condition_true.
	
	2013-06-26  Yao Qi  <yao@codesourcery.com>
	Hui Zhu  <hui@codesourcery.com>
	Pedro Alves  <palves@redhat.com>
	
	PR breakpoints/15075
	PR breakpoints/15434
	* gdb.base/dprintf-next.c: New file.
	* gdb.base/dprintf-next.exp: New file.
	* gdb.base/dprintf-non-stop.c: New file.
	* gdb.base/dprintf-non-stop.exp: New file.
	* gdb.base/dprintf.exp: Don't check "continue" in the output
	of "info breakpoints".
	* gdb.mi/mi-breakpoint-changed.exp (test_insert_delete_modify):
	Don't check "continue" in script field.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/breakpoint.c.diff?cvsroot=src&only_with_tag=gdb_7_6-branch&r1=1.745.2.6&r2=1.745.2.7
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/breakpoint.h.diff?cvsroot=src&only_with_tag=gdb_7_6-branch&r1=1.193&r2=1.193.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/gdb.base/dprintf.exp.diff?cvsroot=src&only_with_tag=gdb_7_6-branch&r1=1.8.2.1&r2=1.8.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/gdb.mi/mi-breakpoint-changed.exp.diff?cvsroot=src&only_with_tag=gdb_7_6-branch&r1=1.5&r2=1.5.2.1
Comment 10 Sourceware Commits 2013-06-26 02:32:54 UTC
CVSROOT:	/cvs/src
Module name:	src
Branch: 	gdb_7_6-branch
Changes by:	teawater@sourceware.org	2013-06-26 02:32:53

Added files:
	gdb/testsuite/gdb.base: dprintf-next.c dprintf-next.exp 
	                        dprintf-non-stop.c dprintf-non-stop.exp 

Log message:
	2013-06-26  Yao Qi  <yao@codesourcery.com>
	Hui Zhu  <hui@codesourcery.com>
	Pedro Alves  <palves@redhat.com>
	
	PR breakpoints/15075
	PR breakpoints/15434
	* breakpoint.c (bpstat_stop_status): Call
	b->ops->after_condition_true.
	(update_dprintf_command_list): Don't append "continue" command
	to the command list of dprintf breakpoint.
	(base_breakpoint_after_condition_true): New function.
	(base_breakpoint_ops): Add base_breakpoint_after_condition_true.
	(dprintf_after_condition_true): New function.
	(initialize_breakpoint_ops): Set dprintf_after_condition_true.
	* breakpoint.h (breakpoint_ops): Add after_condition_true.
	
	2013-06-26  Yao Qi  <yao@codesourcery.com>
	Hui Zhu  <hui@codesourcery.com>
	Pedro Alves  <palves@redhat.com>
	
	PR breakpoints/15075
	PR breakpoints/15434
	* gdb.base/dprintf-next.c: New file.
	* gdb.base/dprintf-next.exp: New file.
	* gdb.base/dprintf-non-stop.c: New file.
	* gdb.base/dprintf-non-stop.exp: New file.
	* gdb.base/dprintf.exp: Don't check "continue" in the output
	of "info breakpoints".
	* gdb.mi/mi-breakpoint-changed.exp (test_insert_delete_modify):
	Don't check "continue" in script field.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/gdb.base/dprintf-next.c.diff?cvsroot=src&only_with_tag=gdb_7_6-branch&r1=NONE&r2=1.1.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/gdb.base/dprintf-next.exp.diff?cvsroot=src&only_with_tag=gdb_7_6-branch&r1=NONE&r2=1.1.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/gdb.base/dprintf-non-stop.c.diff?cvsroot=src&only_with_tag=gdb_7_6-branch&r1=NONE&r2=1.1.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/gdb.base/dprintf-non-stop.exp.diff?cvsroot=src&only_with_tag=gdb_7_6-branch&r1=NONE&r2=1.1.2.2
Comment 11 Marc Khouzam 2014-01-10 16:01:05 UTC
Thanks!  Looks good.