From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30162 invoked by alias); 15 May 2003 16:49:33 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 29980 invoked from network); 15 May 2003 16:49:28 -0000 Received: from unknown (HELO localhost.redhat.com) (24.157.166.107) by sources.redhat.com with SMTP; 15 May 2003 16:49:28 -0000 Received: from redhat.com (localhost [127.0.0.1]) by localhost.redhat.com (Postfix) with ESMTP id 50DF72B2F; Thu, 15 May 2003 12:49:19 -0400 (EDT) Message-ID: <3EC3C50F.1060700@redhat.com> Date: Thu, 15 May 2003 16:49:00 -0000 From: Andrew Cagney User-Agent: Mozilla/5.0 (X11; U; NetBSD macppc; en-US; rv:1.0.2) Gecko/20030223 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Kevin Buettner Cc: gdb-patches@sources.redhat.com Subject: Re: [patch rfc] Eliminate extract_address References: <3EC23225.4090605@redhat.com> <1030514164201.ZM9355@localhost.localdomain> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2003-05/txt/msg00241.txt.bz2 > Can you explain why you doing > > s/extract_address/extract_unsigned_integer/ > > is a good thing? > Perhaps this has been discussed already, but I see two drawbacks... > > First, the return types are different. extract_address() returns > CORE_ADDR while extract_unsigned_integer returns ULONGEST. If > we were to encounter a scenario where this is a problem, it's easier > to fix a wrapper (extract_address()) instead of the myriad places in > the code which presently call extract_address(). (This point is > probably moot because I suspect we already have a lot of code which > assumes that CORE_ADDR may be interchanged with LONGEST or ULONGEST > anyway.) sizeof(CORE_ADDR) <= sizeof(ULONGEST) so this isn't a problem. > Second, having function calls to extract_address() provides > information to the reader that you don't get by having calls to > extract_unsigned_integer(). It tells the reader that we're expecting > to get an address and not an integer. This really helps when someone > reading gdb's code is wondering about what the thing is that's being > extracted. The extract_address function doesn't extract an address, it extracts an unsigned integer. On the MIPS, extract_address needs to sign extend. On the d10v, extract address needs to know the address space. If the code needs to extract an address it can use extract_typed_address which corectly handles all these cases. Is it a good thing? It eliminates a lie. enjoy, Andrew