This is the mail archive of the mailing list for the GDB project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC] PR 15075 dprintf interferes with "next"

On Fri, Feb 22, 2013 at 12:35 AM, Tom Tromey <> wrote:
>>>>>> "Yao" == Yao Qi <> writes:
> Yao> The printf stuff is implemented as command, it is convenient to move
> Yao> them to the target side.  I tried to change the bpstat saying that
> Yao> "don't stop", but the command can't be executed.  We have to keep
> Yao> bpstat saying that "stop" for dprintf.  I also thought about Tom's
> Yao> suggestion about Python "Breakpoint.stop" API, but "Breakpoint.stop"
> Yao> acts as condition instead of command, so I don't go that way.
> Pedro pointed out that 'stop' runs too early -- it makes "cond" not work
> on a dprintf.  (BTW if there is no test for this, there should be... )
> But, why not just do the work just after the condition is evaluated?
> For example, it could be done with special handling in
> bpstat_check_breakpoint_conditions, or by introducing a new
> check_condition breakpoint_ops method, with the dprintf method calling
> the super method before proceeding to "printf" and then returning 0.
> I tend to think that the "commands" approach is just not a good one.
> Tom

Hi Tom,

I update this patch according to your comments:
Add after_cond to breakpoint_ops and let bpstat_stop_status call it
after cond check.

Then add normal code to base_breakpoint_after_cond handle setup of
other breakpoints and set dprintf special code to dprintf_after_cond
that do print work.

And I also updated test for this change.

Please help me review it.


2013-04-23  Yao Qi  <>
	    Hui Zhu  <>

	PR gdb/15075

	* breakpoint.c (bpstat_stop_status): Call b->ops->after_cond.
	(update_dprintf_command_list): Don't append "continue" command
	to the command of dprintf breakpoint.
	(base_breakpoint_after_cond): New.
	(base_breakpoint_ops): Add base_breakpoint_after_cond.
	(dprintf_after_cond): New.
	(initialize_breakpoint_ops): Set dprintf_after_cond.
	* breakpoint.h (breakpoint_ops): Add after_cond.

2013-04-23  Hui Zhu  <>

	PR gdb/15075

	* gdb.base/dprintf.exp: Remove "continue" from "info breakpoint"

Attachment: dprintf-continue.txt
Description: Text document

Attachment: dprintf-continue-test.txt
Description: Text document

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]