From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14890 invoked by alias); 31 Jul 2003 22:01:17 -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 14793 invoked from network); 31 Jul 2003 22:01:15 -0000 Received: from unknown (HELO touchme.toronto.redhat.com) (207.219.125.105) by sources.redhat.com with SMTP; 31 Jul 2003 22:01:15 -0000 Received: from redhat.com (toocool.toronto.redhat.com [172.16.14.72]) by touchme.toronto.redhat.com (Postfix) with ESMTP id 8478880001E for ; Thu, 31 Jul 2003 18:01:14 -0400 (EDT) Message-ID: <3F2991AA.2050400@redhat.com> Date: Thu, 31 Jul 2003 22:01:00 -0000 From: "J. Johnston" Organization: Red Hat Inc. User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.1) Gecko/20020823 Netscape/7.0 X-Accept-Language: en-us, en MIME-Version: 1.0 To: gdb-patches@sources.redhat.com Subject: RFA: patch to display ia64 function pointers Content-Type: multipart/mixed; boundary="------------010504080302070606000206" X-SW-Source: 2003-07/txt/msg00566.txt.bz2 This is a multi-part message in MIME format. --------------010504080302070606000206 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Content-length: 597 The following patch fixes the problem when displaying structs or function pointers that actually point to a function descriptor per the ia64 ABI. Currently, the function descriptor pointer is erroneously interpreted as pointing to a function and so gdb spits out some meaningless information. With the patch, you get to see the actual function that the pointer is referencing via the function descriptor. Ok to commit? 2003-07-31 Jeff Johnston * ia64-tdep.c (ia64_convert_from_func_addr): New function. (ia64_gdbarch_init): Call set_gdbarch_convert_from_func_addr(). --------------010504080302070606000206 Content-Type: text/plain; name="ia64-tdep.funcdesc.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="ia64-tdep.funcdesc.patch" Content-length: 1575 Index: ia64-tdep.c =================================================================== RCS file: /cvs/src/src/gdb/ia64-tdep.c,v retrieving revision 1.92 diff -u -p -r1.92 ia64-tdep.c --- ia64-tdep.c 23 Jul 2003 18:32:19 -0000 1.92 +++ ia64-tdep.c 31 Jul 2003 21:55:46 -0000 @@ -1852,6 +1852,23 @@ find_func_descr (CORE_ADDR faddr, CORE_A return fdesc; } +/* Use the following routine when printing out function pointers + so the user can see the function address rather than just the + function descriptor. */ +static CORE_ADDR +ia64_convert_from_func_ptr_addr (CORE_ADDR addr) +{ + struct obj_section *s; + + s = find_pc_section (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; +} + static CORE_ADDR ia64_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr, struct regcache *regcache, CORE_ADDR bp_addr, @@ -2277,6 +2294,7 @@ ia64_gdbarch_init (struct gdbarch_info i set_gdbarch_deprecated_register_convertible (gdbarch, ia64_register_convertible); set_gdbarch_deprecated_register_convert_to_virtual (gdbarch, ia64_register_convert_to_virtual); set_gdbarch_deprecated_register_convert_to_raw (gdbarch, ia64_register_convert_to_raw); + set_gdbarch_convert_from_func_ptr_addr (gdbarch, ia64_convert_from_func_ptr_addr); set_gdbarch_use_struct_convention (gdbarch, ia64_use_struct_convention); set_gdbarch_deprecated_extract_return_value (gdbarch, ia64_extract_return_value); --------------010504080302070606000206--