Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFA] Make type of $pc a pointer to function
@ 2008-01-31 20:03 Joel Brobecker
  2008-01-31 20:04 ` Daniel Jacobowitz
  0 siblings, 1 reply; 3+ messages in thread
From: Joel Brobecker @ 2008-01-31 20:03 UTC (permalink / raw)
  To: gdb-patches

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [RFA] Make type of $pc a pointer to function
  2008-01-31 20:03 [RFA] Make type of $pc a pointer to function Joel Brobecker
@ 2008-01-31 20:04 ` Daniel Jacobowitz
  2008-01-31 20:57   ` Joel Brobecker
  0 siblings, 1 reply; 3+ messages in thread
From: Daniel Jacobowitz @ 2008-01-31 20:04 UTC (permalink / raw)
  To: Joel Brobecker; +Cc: gdb-patches

On Thu, Jan 31, 2008 at 11:46:59AM -0800, Joel Brobecker wrote:
> 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.

OK.

-- 
Daniel Jacobowitz
CodeSourcery


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [RFA] Make type of $pc a pointer to function
  2008-01-31 20:04 ` Daniel Jacobowitz
@ 2008-01-31 20:57   ` Joel Brobecker
  0 siblings, 0 replies; 3+ messages in thread
From: Joel Brobecker @ 2008-01-31 20:57 UTC (permalink / raw)
  To: gdb-patches

> > 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.
> 
> OK.

Thanks! Checked in.

-- 
Joel


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-01-31 20:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-01-31 20:03 [RFA] Make type of $pc a pointer to function Joel Brobecker
2008-01-31 20:04 ` Daniel Jacobowitz
2008-01-31 20:57   ` Joel Brobecker

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox