From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18475 invoked by alias); 15 Jul 2014 17:26:17 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 18406 invoked by uid 89); 15 Jul 2014 17:26:15 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Tue, 15 Jul 2014 17:26:14 +0000 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s6FHQ88l016572 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 15 Jul 2014 13:26:09 -0400 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s6FHQ7On001263; Tue, 15 Jul 2014 13:26:08 -0400 Message-ID: <53C5642E.4010103@redhat.com> Date: Tue, 15 Jul 2014 19:27:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 MIME-Version: 1.0 To: Simon Marchi , gdb-patches@sourceware.org Subject: Re: [PATCH v2 2/2] Only leave dprintf inserted if it is marked as persistent (PR breakpoints/17012) References: <1404760664-17289-1-git-send-email-simon.marchi@ericsson.com> <1404760664-17289-2-git-send-email-simon.marchi@ericsson.com> In-Reply-To: <1404760664-17289-2-git-send-email-simon.marchi@ericsson.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-SW-Source: 2014-07/txt/msg00403.txt.bz2 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. > > gdb/Changelog: > > 2014-07-07 Simon Marchi > > 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) > continue; > > - if (bl->owner->type == bp_dprintf) > + if (bl->owner->type == bp_dprintf && bl->target_info.persist == 1) > continue; 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: if (bl->target_info.persist) continue; without the "== 1" part. But ... most importantly. How do we end up with 'persist' set on a call-style dprintf, given: static void build_target_command_list (struct bp_location *bl) { ... /* For now, limit to agent-style dprintf breakpoints. */ if (dprintf_style != dprintf_style_agent) return; 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 something. :-) -- Pedro Alves