public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: Simon Marchi <simon.marchi@ericsson.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH v3 1/2] Only leave dprintf inserted if it is marked as persistent (PR breakpoints/17012)
Date: Thu, 04 Sep 2014 16:45:00 -0000	[thread overview]
Message-ID: <54089730.8040605@redhat.com> (raw)
In-Reply-To: <1408734315-21207-1-git-send-email-simon.marchi@ericsson.com>

On 08/22/2014 08:05 PM, Simon Marchi wrote:
> On Linux native, if dprintf are inserted when detaching, they are left

"dprintfs"

> 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.

s/dprinfs/dprintfs/

A nit: personally I prefer if logs sounds a little more confident
once questions are resolved.  I'd suggest:

 s/I believe that the/The/
 s/line I modified/line modified by the patch/

resulting in:

 The rationale of the line modified by the patch was to leave dprintfs
 inserted in order to support disconnected dprintfs.  However, not all
 dprintfs are persistent.  Also, there's no reason other kinds of
 breakpoints can't be persistent either.  So this replaces the bp_dprintf
 check with a check on whether the location is persistent.

> 
> 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.
> 

> New in v3:
> * Follow-up Pedro's review
>   * Remove == 1 for check on boolean.

There was also a point about removing the "type == bp_dprintf"
check completely.  Did you find we actually need it for some reason?

I think it's better to treat bl->target_info's contents as
undefined if the breakpoint is not inserted.  So I think the
clearest and best would be to merge this check with the one below,
resulting in

-    if (bl->owner->type == bp_dprintf)
-      continue;
-
-    if (bl->inserted)
     if (bl->inserted && !bl->target_info.persist)

I realize this may sound like a nit, but just this past week I was
playing with replacing the bl->target_info field with a pointer to
a refcounted target_info object, and the pointer would only be
set when the breakpoint is inserted   :-)

OK with that change.

Thanks,
Pedro Alves

  parent reply	other threads:[~2014-09-04 16:45 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-22 19:05 Simon Marchi
2014-08-22 19:05 ` [PATCH v3 2/2] Add dprintf and detach test " Simon Marchi
2014-09-04 16:46   ` Pedro Alves
2014-09-04 18:37     ` Simon Marchi
2014-09-05 15:41       ` Pedro Alves
2014-12-10 21:14         ` Simon Marchi
2014-09-02 14:13 ` [PATCH v3 1/2] Only leave dprintf inserted if it is marked as persistent " Simon Marchi
2014-09-04 16:45 ` Pedro Alves [this message]
2014-09-04 18:33   ` Simon Marchi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54089730.8040605@redhat.com \
    --to=palves@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=simon.marchi@ericsson.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).