From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7542 invoked by alias); 21 Sep 2007 21:53:26 -0000 Received: (qmail 7534 invoked by uid 22791); 21 Sep 2007 21:53:25 -0000 X-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00,DK_POLICY_SIGNSOME,SPF_HELO_PASS,SPF_PASS,TW_DW X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 21 Sep 2007 21:53:23 +0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.13.1/8.13.1) with ESMTP id l8LLqXDV008225 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 21 Sep 2007 17:52:33 -0400 Received: from pobox.corp.redhat.com (pobox.corp.redhat.com [10.11.255.20]) by int-mx1.corp.redhat.com (8.13.1/8.13.1) with ESMTP id l8LLqWuS011758; Fri, 21 Sep 2007 17:52:32 -0400 Received: from [127.0.0.1] (sebastian-int.corp.redhat.com [172.16.52.221]) by pobox.corp.redhat.com (8.13.1/8.13.1) with ESMTP id l8LLqWWZ014758; Fri, 21 Sep 2007 17:52:32 -0400 Message-ID: <46F43D52.1040602@redhat.com> Date: Fri, 21 Sep 2007 21:53:00 -0000 From: Andrew Cagney User-Agent: Thunderbird 1.5.0.12 (X11/20070530) MIME-Version: 1.0 To: pearly.zhao@oracle.com CC: Frysk Mailing List Subject: Re: [patch] Accept symbolic addresses in spin button, bug 4673. References: <1189584690.4843.23.camel@linux-pzhao.site> <17474866.1189604007745.JavaMail.oracle@acsmt303.oracle.com> <1190165163.24118.3.camel@linux-pzhao.site> In-Reply-To: <1190165163.24118.3.camel@linux-pzhao.site> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact frysk-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: frysk-owner@sourceware.org X-SW-Source: 2007-q3/txt/msg00399.txt.bz2 Pearly, > Hi, > This is a new patch. It adds getSymbol(task, name) method to > SymbolFactory. The BreakpointManager and FunctionBreakpoint are changed > to use this method instead of using the one defined by themselves. > > Any suggestions are welcomed. > > Pearly > On Wed, 2007-09-12 at 08:33 -0500, PEARLY.ZHAO@oracle.com wrote: > > > Actually, retrieving symbol addresses in the classes implementing the disssembly and memory windows is a wrong way to implement this functionality. Maybe it should be designed at core. The classes handling the windows merely use it to obtain the information. Yes, agreed; but rather than assuming the string is a symbol, would it be more robust to evaluate the string as an expression? Thus allowing arbitrary expressions and symbols vis: foo+10 and not limiting things to symbols (See DisassembleCommand for how it evaluates its parameters). BTW, + + /** + * Get address list by symbol name + * @param task + * @param name + * @return address list + */ + public static LinkedList getSymbol(Task task, String name) { + Dwfl dwfl = DwflCache.getDwfl(task); + DwflModule[] modules = dwfl.getModules(); + final LinkedList addrs = new LinkedList(); is for searching out duplicate symbols so that a breakpoint can be inserted at all locations; since here only a single location (based on the current pc and elf/c scope rules) is needed, using it and discarding all but the first address isn't correct. You can assume that the expression evaluator will get this right, and if it doesn't we've an expression evaluation bug. In refactoring getSymbol to frysk.symtab.SymbolFactory did you take the opportunity to add a test case? Andrew