From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12037 invoked by alias); 12 Mar 2013 03:33:24 -0000 Received: (qmail 12015 invoked by uid 22791); 12 Mar 2013 03:33:21 -0000 X-SWARE-Spam-Status: No, hits=-4.6 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 Mar 2013 03:33:11 +0000 Received: from svr-orw-exc-10.mgc.mentorg.com ([147.34.98.58]) by relay1.mentorg.com with esmtp id 1UFFxe-0006O3-Ce from Yao_Qi@mentor.com ; Mon, 11 Mar 2013 20:33:10 -0700 Received: from SVR-ORW-FEM-04.mgc.mentorg.com ([147.34.97.41]) by SVR-ORW-EXC-10.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.4675); Mon, 11 Mar 2013 20:33:10 -0700 Received: from qiyao.dyndns.org (147.34.91.1) by svr-orw-fem-04.mgc.mentorg.com (147.34.97.41) with Microsoft SMTP Server id 14.1.289.1; Mon, 11 Mar 2013 20:33:10 -0700 Message-ID: <513EA1B0.6000005@codesourcery.com> Date: Tue, 12 Mar 2013 03:33:00 -0000 From: Yao Qi User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/17.0 Thunderbird/17.0 MIME-Version: 1.0 To: Tom Tromey CC: Subject: Re: RFC: remove trace_kludge global References: <87k3pdn3es.fsf@fleche.redhat.com> In-Reply-To: <87k3pdn3es.fsf@fleche.redhat.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit 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: 2013-03/txt/msg00502.txt.bz2 Hi, Tom, On 03/12/2013 03:26 AM, Tom Tromey wrote: > @@ -2608,17 +2585,18 @@ agent_eval_command_one (char *exp, int eval, CORE_ADDR pc) > struct cleanup *old_chain = 0; > struct expression *expr; > struct agent_expr *agent; > + int trace_string = 0; > > if (!eval) > { > - trace_string_kludge = 0; > if (*exp == '/') > - exp = decode_agent_options (exp); > + exp = decode_agent_options (exp, &trace_string); 'trace_string' is only set when 'eval' is zero, so... > } > > if (!eval && strcmp (exp, "$_ret") == 0) > { > - agent = gen_trace_for_return_address (pc, get_current_arch ()); > + agent = gen_trace_for_return_address (pc, get_current_arch (), > + trace_string); > old_chain = make_cleanup_free_agent_expr (agent); > } > else > @@ -2626,9 +2604,9 @@ agent_eval_command_one (char *exp, int eval, CORE_ADDR pc) > expr = parse_exp_1 (&exp, pc, block_for_pc (pc), 0); > old_chain = make_cleanup (free_current_contents, &expr); > if (eval) > - agent = gen_eval_for_expr (pc, expr); > + agent = gen_eval_for_expr (pc, expr, trace_string); ... 'trace_string' should be zero here. On the other hand, when 'eval' is true, we are evaluating the result of the expression, so no tracing stuff should be involved. So, we don't have to add the new argument 'trace_string' to gen_eval_for_expr, and set 'ax->trace_string' to zero inside gen_eval_for_expr, and the callers of gen_eval_for_expr are not updated. > else > - agent = gen_trace_for_expr (pc, expr); > + agent = gen_trace_for_expr (pc, expr, trace_string); > make_cleanup_free_agent_expr (agent); > } -- Yao (齐尧)