From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5564 invoked by alias); 31 Jan 2008 19:47:29 -0000 Received: (qmail 5544 invoked by uid 22791); 31 Jan 2008 19:47:28 -0000 X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 31 Jan 2008 19:47:03 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id C811D2A9C65 for ; Thu, 31 Jan 2008 14:47:01 -0500 (EST) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id Y+yCMTjpHy-T for ; Thu, 31 Jan 2008 14:47:01 -0500 (EST) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 8D06C2A9C68 for ; Thu, 31 Jan 2008 14:47:01 -0500 (EST) Received: by joel.gnat.com (Postfix, from userid 1000) id 54221E7ACB; Thu, 31 Jan 2008 11:46:59 -0800 (PST) Date: Thu, 31 Jan 2008 20:03:00 -0000 From: Joel Brobecker To: gdb-patches@sourceware.org Subject: [RFA] Make type of $pc a pointer to function Message-ID: <20080131194659.GA21235@adacore.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="vtzGhvizbBRQ85DL" Content-Disposition: inline User-Agent: Mutt/1.4.2.2i Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2008-01/txt/msg00864.txt.bz2 --vtzGhvizbBRQ85DL Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-length: 822 Hello, This is a followup on: http://www.sourceware.org/ml/gdb-patches/2008-01/msg00699.html. I introduced a test for "ptype $pc", and Daniel remarked that some targets where not returning a function pointer type, except that they should. I found that we're not outputing the expected type on ia64 (used ia64-linux to demonstrate the problem), and traced it down to std-regs.c:value_of_builtin_frame_pc_reg which creates a value whose type is builtin_type_void_data_ptr. So this explains why we get "void *" as the type of $pc. 2008-01-31 Joel Brobecker * std-regs.c (value_of_builtin_frame_pc_reg): Change the returned value type to builtin_type_void_func_ptr. Tested on ia64-linux, fixes gdb.base/ptype.exp: ptype $pc. No regression. Does this look OK? Thanks, -- Joel --vtzGhvizbBRQ85DL Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="pc_type.diff" Content-length: 891 Index: std-regs.c =================================================================== RCS file: /cvs/src/src/gdb/std-regs.c,v retrieving revision 1.25 diff -u -p -r1.25 std-regs.c --- std-regs.c 1 Jan 2008 22:53:13 -0000 1.25 +++ std-regs.c 31 Jan 2008 19:28:46 -0000 @@ -61,12 +61,12 @@ value_of_builtin_frame_pc_reg (struct fr return value_of_register (gdbarch_pc_regnum (gdbarch), frame); else { - struct value *val = allocate_value (builtin_type_void_data_ptr); + struct value *val = allocate_value (builtin_type_void_func_ptr); gdb_byte *buf = value_contents_raw (val); if (frame == NULL) memset (buf, 0, TYPE_LENGTH (value_type (val))); else - gdbarch_address_to_pointer (gdbarch, builtin_type_void_data_ptr, + gdbarch_address_to_pointer (gdbarch, builtin_type_void_func_ptr, buf, get_frame_pc (frame)); return val; } --vtzGhvizbBRQ85DL--