From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14739 invoked by alias); 12 Jun 2012 13:15:52 -0000 Received: (qmail 14388 invoked by uid 22791); 12 Jun 2012 13:15:50 -0000 X-SWARE-Spam-Status: No, hits=-4.3 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL X-Spam-Check-By: sourceware.org Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 12 Jun 2012 13:15:37 +0000 Received: from svr-orw-exc-10.mgc.mentorg.com ([147.34.98.58]) by relay1.mentorg.com with esmtp id 1SeQwa-0006TR-Iw from Yao_Qi@mentor.com ; Tue, 12 Jun 2012 06:15:36 -0700 Received: from SVR-ORW-FEM-02.mgc.mentorg.com ([147.34.96.206]) by SVR-ORW-EXC-10.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.4675); Tue, 12 Jun 2012 06:15:02 -0700 Received: from [127.0.0.1] (147.34.91.1) by svr-orw-fem-02.mgc.mentorg.com (147.34.96.168) with Microsoft SMTP Server id 14.1.289.1; Tue, 12 Jun 2012 06:15:33 -0700 Message-ID: <4FD740E9.7080909@codesourcery.com> Date: Tue, 12 Jun 2012 13:15:00 -0000 From: Yao Qi User-Agent: Mozilla/5.0 (X11; Linux i686; rv:13.0) Gecko/20120601 Thunderbird/13.0 MIME-Version: 1.0 To: Hui Zhu CC: Hui Zhu , "gdb@sourceware.org" Subject: Re: What about add new commands "maintenance agent-breakpoint id expression" and "maintenance agent-eval-breakpoint id expression" References: <4FD68A1A.2040600@mentor.com> <4FD6A346.4010108@codesourcery.com> In-Reply-To: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2012-06/txt/msg00058.txt.bz2 On 06/12/2012 07:41 PM, Hui Zhu wrote: >> > Agent expression evaluation makes sense in the context of "current >> > scope" or "current frame". We can't switch to a frame at any arbitrary >> > address, because the frame maybe does not exist. >> > > What your worry about is line "expr = parse_expression (exp);" cannot > work, right? > It can be change to function "parse_exp_1" to handle this issue. > > BTW if agent generate need current scope or current frame, how this > code generate when breakpoint or tracepoint use it? :) My reply was on the context of "maint agent"/"maint agent-expr" which you asked about. My full reply should be "In 'maint agent'/'maint agent-expr', agent expression evaluation makes in ....". I am not worried about parse_expression, but struct frame_info *fi = get_current_frame (); /* need current scope */ ...... agent = gen_eval_for_expr (get_frame_pc (fi), expr); gives me the feeling that we need a correct frame here. When using variable in condition or actions in breakpoint or tracepoint, the variable should be *visible* under a certain frame (not current frame that we are setting breakpoint/tracepoint, as I observed). > It have too much limit. For example, it will not work when we want > collect an local var inside of a function. It is odd. I can collect a local variable ii in function foo. (gdb) target remote :1234 (gdb) b end Breakpoint 1 at 0x80483c9: file 1.c, line 10. (gdb) trace foo:label Tracepoint 2 at 0x80483c1: file 1.c, line 5. (gdb) actions Enter actions for tracepoint 2, one per line. End with a line saying just "end". >collect ii >end (gdb) tstart (gdb) c Continuing. Breakpoint 1, end () at 1.c:10 10 void end () {} (gdb) tstop (gdb) tfind Found trace frame 0, tracepoint 2 #0 foo () at 1.c:6 6 return ii; (gdb) tdump Data collected at tracepoint 2, trace frame 0: ii = 0 ---- 1.c ---- int foo (void) { int ii = 0; label: return ii; } void end () {} int main (void) { int i = foo (); end (); return 0; } -- Yao (齐尧)