From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14500 invoked by alias); 19 Sep 2003 18:51:32 -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 14492 invoked from network); 19 Sep 2003 18:51:31 -0000 Received: from unknown (HELO localhost.redhat.com) (207.219.125.105) by sources.redhat.com with SMTP; 19 Sep 2003 18:51:31 -0000 Received: from redhat.com (localhost [127.0.0.1]) by localhost.redhat.com (Postfix) with ESMTP id 0C0AF2B89 for ; Fri, 19 Sep 2003 14:51:30 -0400 (EDT) Message-ID: <3F6B5031.7060102@redhat.com> Date: Fri, 19 Sep 2003 18:51:00 -0000 From: Andrew Cagney User-Agent: Mozilla/5.0 (X11; U; NetBSD macppc; en-US; rv:1.0.2) Gecko/20030820 X-Accept-Language: en-us, en MIME-Version: 1.0 To: gdb-patches@sources.redhat.com Subject: [rfa/ppc64] Only map descriptors to code addresses Content-Type: multipart/mixed; boundary="------------070605040500070607040902" X-SW-Source: 2003-09/txt/msg00413.txt.bz2 This is a multi-part message in MIME format. --------------070605040500070607040902 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Content-length: 424 Hello, This patch modifies ppc64's convert_from_func_ptr_addr so that it only converts a descriptor to the code address when it's sure it's got a descriptor. This way, of the function gets fed a random address, it doesn't map it onto something even more random - I encountered this when trying to debug "break main" with only a minimal symbol table. This also makes the behavior consistent with the ia64. ok? Andrew --------------070605040500070607040902 Content-Type: text/plain; name="diffs" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="diffs" Content-length: 1574 2003-09-19 Andrew Cagney * ppc-linux-tdep.c (ppc64_linux_convert_from_func_ptr_addr): Only convert a descriptor to a function when it's in the ".opd" section. Index: ppc-linux-tdep.c =================================================================== RCS file: /cvs/src/src/gdb/ppc-linux-tdep.c,v retrieving revision 1.40 diff -u -r1.40 ppc-linux-tdep.c --- ppc-linux-tdep.c 16 Sep 2003 23:33:17 -0000 1.40 +++ ppc-linux-tdep.c 19 Sep 2003 18:42:20 -0000 @@ -925,8 +925,10 @@ find_function_addr uses this function to get the function address from a function pointer. */ -/* Return real function address if ADDR (a function pointer) is in the data - space and is therefore a special function pointer. */ +/* If ADDR points at what is clearly a function descriptor, transform + it into the address of the corresponding function. Be + conservative, otherwize GDB will do the transformation on any + random addresses such as occures when there is no symbol table. */ static CORE_ADDR ppc64_linux_convert_from_func_ptr_addr (CORE_ADDR addr) @@ -934,12 +936,12 @@ struct obj_section *s; s = find_pc_section (addr); - if (s && s->the_bfd_section->flags & SEC_CODE) - return addr; - /* ADDR is in the data space, so it's a pointer to a descriptor, not - the entry point. */ - return ppc64_desc_entry_point (addr); + /* Check if ADDR points to a function descriptor. */ + if (s && strcmp (s->the_bfd_section->name, ".opd") == 0) + return read_memory_unsigned_integer (addr, 8); + + return addr; } --------------070605040500070607040902--