From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32340 invoked by alias); 12 Jun 2012 01:49:04 -0000 Received: (qmail 32174 invoked by uid 22791); 12 Jun 2012 01:49:02 -0000 X-SWARE-Spam-Status: No, hits=-3.0 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,KHOP_THREADED,RCVD_IN_DNSWL_NONE,RCVD_IN_HOSTKARMA_YE,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from elasmtp-banded.atl.sa.earthlink.net (HELO elasmtp-banded.atl.sa.earthlink.net) (209.86.89.70) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 12 Jun 2012 01:48:49 +0000 Received: from [68.96.200.16] (helo=macbook2.local) by elasmtp-banded.atl.sa.earthlink.net with esmtpa (Exim 4.67) (envelope-from ) id 1SeGDx-0000AS-7a; Mon, 11 Jun 2012 21:48:49 -0400 Message-ID: <4FD6A000.7010804@earthlink.net> Date: Tue, 12 Jun 2012 01:49:00 -0000 From: Stan Shebs User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:12.0) Gecko/20120428 Thunderbird/12.0.1 MIME-Version: 1.0 To: Hui Zhu CC: "gdb@sourceware.org" Subject: Re: What about merge function gen_trace_for_expr and function gen_eval_for_expr together? References: <4FD68A3D.7030807@mentor.com> In-Reply-To: <4FD68A3D.7030807@mentor.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-ELNK-Trace: ae6f8838ff913eba0cc1426638a40ef67e972de0d01da9401bc4842e50188d552a66e8b8013664ad350badd9bab72f9c350badd9bab72f9c350badd9bab72f9c 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/msg00055.txt.bz2 On 6/11/12 5:15 PM, Hui Zhu wrote: > Hi guys, > > When I read the code, I found that most part of these functions are same: > 2c2 > < gen_trace_for_expr (CORE_ADDR scope, struct expression *expr) > --- >> gen_eval_for_expr (CORE_ADDR scope, struct expression *expr) > 12c12 > < trace_kludge = 1; > --- >> trace_kludge = 0; > 16,17c16 > < /* Make sure we record the final object, and get rid of it. */ > < gen_traced_pop (expr->gdbarch, ax, &value); > --- >> require_rvalue (ax, &value); > > > What about add a new argument for example trace or eval and merge them > together? I certainly considered that when introducing gen_eval_for_expr, but it seemed like repeatedly testing a flag for the parts that are different was going to make it more complicated than having the two separate functions. I also expected that they might need to diverge a bit more over time, for instance if trace_kludge were to be gotten rid of (as it should be). Stan stan@codesourcery.com