From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26753 invoked by alias); 25 Jun 2013 17:15:34 -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 26733 invoked by uid 89); 25 Jun 2013 17:15:33 -0000 X-Spam-SWARE-Status: No, score=-8.1 required=5.0 tests=AWL,BAYES_00,KHOP_THREADED,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.1 Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Tue, 25 Jun 2013 17:15:29 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r5PHFPHS022800 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 25 Jun 2013 13:15:26 -0400 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r5PHFN6M010772; Tue, 25 Jun 2013 13:15:24 -0400 Message-ID: <51C9D02B.7050202@redhat.com> Date: Tue, 25 Jun 2013 17:31:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130514 Thunderbird/17.0.6 MIME-Version: 1.0 To: Yao Qi CC: Eli Zaretskii , gdb-patches@sourceware.org Subject: Re: [PATCH 5/6] New MI command -trace-frame-collected References: <1370610493-26468-1-git-send-email-yao@codesourcery.com> <1371086914-8398-1-git-send-email-yao@codesourcery.com> <1371086914-8398-6-git-send-email-yao@codesourcery.com> <83obbaw425.fsf@gnu.org> <51BAE445.5070300@codesourcery.com> <83vc5hug7e.fsf@gnu.org> <51BEE0F9.3090201@codesourcery.com> <831u80u52n.fsf@gnu.org> <51C0697A.2030604@codesourcery.com> In-Reply-To: <51C0697A.2030604@codesourcery.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2013-06/txt/msg00733.txt.bz2 On 06/18/2013 03:06 PM, Yao Qi wrote: > + > +This command returns the set of collected objects, register names, > +trace state variable names, memory ranges and computed expressions > +that have been collected at a particular trace frame. The optional > +parameters to the command affect the output format in different ways. > +See the output description table below for more details. > + > +The reported names can be used in the normal manner to create > +varobjs and inspect the objects themselves. The items returned by > +this command are categorized so that it is clear which is a variable, > +which is a register, which is a trace state variable, which is a > +memory range and which is a computed expression. > + > +For instance, if the actions were > +@smallexample > +collect myVar, myArray[myIndex], myObj.field, myPtr->field, myCount + 2 > +collect *(int*)0xaf02bef0@@40 > +@end smallexample > + > +@noindent > +the object collected in its entirety would be @code{myVar}. Object > +@code{myArray} is partially collected, because only element on index > +@code{myIndex} is collected. The rest of objects are computed > +expressions. #1 "If the actions were ... then foo would be." sounds right. #2 "If the actions are ... then foo is." would sound right. #3 "If the actions were ... then foo is." sounds odd. s/Object/The object/ "only the element at index" "rest of the objects", or "the remaining objects" That is, I suggest: For instance, if the actions were @smallexample collect myVar, myArray[myIndex], myObj.field, myPtr->field, myCount + 2 collect *(int*)0xaf02bef0@@40 @end smallexample @noindent the object collected in its entirety would be @code{myVar}. The object @code{myArray} would be partially collected, because only the element at index @code{myIndex} would be collected. The remaining objects would be computed expressions. > diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c > index 430d530..0b8740da 100644 > --- a/gdb/mi/mi-main.c > +++ b/gdb/mi/mi-main.c > + > +/* Implement the "-trace-frame-collected" command. */ > + > +void > +mi_cmd_trace_frame_collected (char *command, char **argv, int argc) > +{ ... > + /* This command only makes sense for the current frame, not the > + selected frame. */ > + old_chain = make_cleanup_restore_current_thread (); > + select_frame (get_current_frame ()); ISTR a fix for tdump in the same vein as this. Is it in the queue? Maybe it's already in... > + > + { > + struct collection_list tracepoint_list, stepping_list; > + > + encode_actions (tloc, &tracepoint_list, &stepping_list); > + > + if (stepping_frame) > + clist = &stepping_list; > + else > + clist = &tracepoint_list; > + } This use of scoping is wrong. As soon as the scope ends, the life time of tracepoint_list and stepping_list's ends, so uses of clist's pointee beyond this scope are undefined. > diff --git a/gdb/remote.c b/gdb/remote.c > index 080d048..d06b1ed 100644 > --- a/gdb/remote.c > +++ b/gdb/remote.c > @@ -10524,7 +10524,7 @@ remote_download_tracepoint (struct bp_location *loc) > struct breakpoint *b = loc->owner; > struct tracepoint *t = (struct tracepoint *) b; > > - encode_actions (loc, &tdp_actions, &stepping_actions); > + encode_actions_rsp (loc, &tdp_actions, &stepping_actions); > old_chain = make_cleanup (free_actions_list_cleanup_wrapper, > tdp_actions); > (void) make_cleanup (free_actions_list_cleanup_wrapper, > diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c > index d7d0e88..4f10c93 100644 > --- a/gdb/tracepoint.c > +++ b/gdb/tracepoint.c > @@ -340,6 +340,22 @@ find_trace_state_variable (const char *name) > return NULL; > } > > +/* Return the tsv if its number is NUMBER. Return NULL if not > + found. */ "if its number is" sounds a little odd. /* Return the tsv with number NUMBER. Return NULL if not found. */ Or based on find_trace_state_variable's comment: /* Look for a trace state variable with a given number. Return NULL if not found. */ > + > +struct trace_state_variable * > +find_trace_state_variable_by_number (int number) > +{ > -/* Render all actions into gdb protocol. */ > +/* Encode actions of tracepoint TLOC->owner and fill TRACEPOINT_LIST > + and STEPPING_LIST. Return a cleanup pointer to clean up both > + TRACEPOINT_LIST and STEPPING_LIST. */ I think it'd be good to rename this as: encode_actions_and_make_cleanup Functions that return a cleanup aren't that frequent, and from reading the user code, one gets the impression a cleanup is missing, if there's no such hint. > > -void > -encode_actions (struct bp_location *tloc, char ***tdp_actions, > - char ***stepping_actions) > +struct cleanup * > +encode_actions (struct bp_location *tloc, > + struct collection_list *tracepoint_list, > + struct collection_list *stepping_list) > { This looks good to me with those changes. Thanks! -- Pedro Alves