From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10866 invoked by alias); 28 Oct 2011 20:51:13 -0000 Received: (qmail 10846 invoked by uid 22791); 28 Oct 2011 20:51:12 -0000 X-SWARE-Spam-Status: No, hits=-2.6 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW X-Spam-Check-By: sourceware.org Received: from mail-yw0-f41.google.com (HELO mail-yw0-f41.google.com) (209.85.213.41) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 28 Oct 2011 20:50:56 +0000 Received: by ywa17 with SMTP id 17so4701459ywa.0 for ; Fri, 28 Oct 2011 13:50:55 -0700 (PDT) MIME-Version: 1.0 Received: by 10.236.191.71 with SMTP id f47mr6473522yhn.7.1319835055567; Fri, 28 Oct 2011 13:50:55 -0700 (PDT) Received: by 10.236.108.37 with HTTP; Fri, 28 Oct 2011 13:50:55 -0700 (PDT) In-Reply-To: References: Date: Fri, 28 Oct 2011 20:52:00 -0000 Message-ID: Subject: Re: RFA: implement ambiguous linespec proposal From: Matt Rice To: Tom Tromey Cc: gdb-patches@sourceware.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes 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 X-SW-Source: 2011-10/txt/msg00783.txt.bz2 On Fri, Oct 28, 2011 at 9:28 AM, Tom Tromey wrote: > I'd appreciate comments on this patch. In the following snippet, the initial comment doesn't mention destroy_linespec_result, and some of the field comments mention that the caller is responsible for freeing. destroy_linespec_result seems to fulfill this obligation, I imagine that the comments just predate destroy_linespec_result, or there is an OR situation e.g. if the caller wants to save some fields they are responsible. Anyhow it'd be nice to clarify that in the comments. thanks > =A0/* An instance of this may be filled in by decode_line_1. =A0The caller > =A0 =A0must call init_linespec_result to initialize it. =A0*/ > > @@ -30,22 +49,85 @@ struct linespec_result > =A0 =A0 =A0display mechanism would do the wrong thing. =A0*/ > =A0 int special_display; > > - =A0/* If non-NULL, an array of canonical names for returned > - =A0 =A0 symtab_and_line objects. =A0The array has as many elements as t= he > - =A0 =A0 `nelts' field in the symtabs_and_line returned by decode_line_1. > - =A0 =A0 An element in the array may be NULL. =A0The array and each non-= NULL > - =A0 =A0 element in it are allocated with xmalloc and must be freed by t= he > - =A0 =A0 caller. =A0*/ > - =A0char **canonical; > + =A0/* If non-zero, the linespec result should be considered to be a > + =A0 =A0 "pre-expanded" multi-location linespec. =A0A pre-expanded lines= pec > + =A0 =A0 holds all matching locations in a single linespec_sals > + =A0 =A0 object. =A0*/ > + =A0int pre_expanded; > + > + =A0/* If PRE_EXPANDED is non-zero, this is set to the linespec entered > + =A0 =A0 by the user. =A0This is allocated with xmalloc and the caller is > + =A0 =A0 responsible for freeing it. =A0*/ > + =A0char *addr_string; > + > + =A0/* The sals. =A0The vector should be freed by the caller. =A0*/ > + =A0VEC (linespec_sals) *sals; > =A0}; > > =A0/* Initialize a linespec_result. =A0*/ > > =A0extern void init_linespec_result (struct linespec_result *); > > +/* Destroy a linespec_result. =A0*/ > + > +extern void destroy_linespec_result (struct linespec_result *); > + > +/* Return a cleanup that destroys a linespec_result. =A0*/ > + > +extern struct cleanup * > + =A0 =A0 =A0 =A0make_cleanup_destroy_linespec_result (struct linespec_re= sult *); > +