Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Joel Brobecker <brobecker@adacore.com>
To: gdb-patches@sourceware.org
Subject: [RFA] Make type of $pc a pointer to function
Date: Thu, 31 Jan 2008 20:03:00 -0000	[thread overview]
Message-ID: <20080131194659.GA21235@adacore.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 822 bytes --]

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  <brobecker@adacore.com>

        * 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

[-- Attachment #2: pc_type.diff --]
[-- Type: text/plain, Size: 891 bytes --]

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;
     }

             reply	other threads:[~2008-01-31 19:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-31 20:03 Joel Brobecker [this message]
2008-01-31 20:04 ` Daniel Jacobowitz
2008-01-31 20:57   ` Joel Brobecker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080131194659.GA21235@adacore.com \
    --to=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox