[PATCH v2 2/2] Only leave dprintf inserted if it is marked as persistent (PR breakpoints/17012)
Tue Jul 15 19:27:00 GMT 2014
On 07/07/2014 08:17 PM, Simon Marchi wrote:
> On Linux native, if dprintf are inserted when detaching, they are left
> in the inferior which causes it to crash from a SIGTRAP. It also happens
> with dprintfs on remote targets, when set disconnected-dprintf is off.
> I believe that the rationale of the line I modified was to leave dprinfs
> inserted in order to support disconnected dprintfs. This adds a check to
> see if the dprintf should actually stay inserted or not.
> bl->target_info.persist will be 1 only if disconnected-dprintf is on and
> we are debugging a remote target. On native, it will always be 0,
> regardless of the value of disconnected-dprintf. This makes sense, since
> disconnected dprintfs are not supported by the native target.
> 2014-07-07 Simon Marchi <email@example.com>
> PR breakpoints/17012
> * breakpoint.c (remove_breakpoints_pid): Only skip removing
> dprintf if it is marked as persistent.
> gdb/breakpoint.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
> diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
> index 908a1ea..fb833d0 100644
> --- a/gdb/breakpoint.c
> +++ b/gdb/breakpoint.c
> @@ -3112,7 +3112,7 @@ remove_breakpoints_pid (int pid)
> if (bl->pspace != inf->pspace)
> - if (bl->owner->type == bp_dprintf)
> + if (bl->owner->type == bp_dprintf && bl->target_info.persist == 1)
I think that we don't really need the "bl->owner->type == bp_dprintf"
check anymore. persist" carries all the semantics we need here.
Also, this is a boolean, so best write:
without the "== 1" part.
But ... most importantly. How do we end up with 'persist' set
on a call-style dprintf, given:
build_target_command_list (struct bp_location *bl)
/* For now, limit to agent-style dprintf breakpoints. */
if (dprintf_style != dprintf_style_agent)
I'm confused, as you say the test fails now, but nowhere in the
test are you setting the style to agent. I think I'm missing
More information about the Gdb-patches