This is the mail archive of the gdb-patches@sourceware.org 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: RFA: implement ambiguous linespec proposal


On Fri, Oct 28, 2011 at 9:28 AM, Tom Tromey <tromey@redhat.com> 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

> ?/* An instance of this may be filled in by decode_line_1. ?The caller
> ? ?must call init_linespec_result to initialize it. ?*/
>
> @@ -30,22 +49,85 @@ struct linespec_result
> ? ? ?display mechanism would do the wrong thing. ?*/
> ? int special_display;
>
> - ?/* If non-NULL, an array of canonical names for returned
> - ? ? symtab_and_line objects. ?The array has as many elements as the
> - ? ? `nelts' field in the symtabs_and_line returned by decode_line_1.
> - ? ? An element in the array may be NULL. ?The array and each non-NULL
> - ? ? element in it are allocated with xmalloc and must be freed by the
> - ? ? caller. ?*/
> - ?char **canonical;
> + ?/* If non-zero, the linespec result should be considered to be a
> + ? ? "pre-expanded" multi-location linespec. ?A pre-expanded linespec
> + ? ? holds all matching locations in a single linespec_sals
> + ? ? object. ?*/
> + ?int pre_expanded;
> +
> + ?/* If PRE_EXPANDED is non-zero, this is set to the linespec entered
> + ? ? by the user. ?This is allocated with xmalloc and the caller is
> + ? ? responsible for freeing it. ?*/
> + ?char *addr_string;
> +
> + ?/* The sals. ?The vector should be freed by the caller. ?*/
> + ?VEC (linespec_sals) *sals;
> ?};
>
> ?/* Initialize a linespec_result. ?*/
>
> ?extern void init_linespec_result (struct linespec_result *);
>
> +/* Destroy a linespec_result. ?*/
> +
> +extern void destroy_linespec_result (struct linespec_result *);
> +
> +/* Return a cleanup that destroys a linespec_result. ?*/
> +
> +extern struct cleanup *
> + ? ? ? ?make_cleanup_destroy_linespec_result (struct linespec_result *);
> +


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