Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* RFA: i386 Linux: provide correct type for orig_eax register
@ 2002-01-11 14:23 Jim Blandy
  2002-01-12  5:13 ` Mark Kettenis
  0 siblings, 1 reply; 6+ messages in thread
From: Jim Blandy @ 2002-01-11 14:23 UTC (permalink / raw)
  To: gdb-patches


This fixes a failure in callfuncs.exp.

2002-01-11  Jim Blandy  <jimb@redhat.com>

	Return the correct virtual type for orig_eax.
	* i386-linux-tdep.c (i386_linux_register_virtual_type): New function.
	* config/i386/tm-linux.h (i386_linux_register_virtual_type): New
	declaration.
	(REGISTER_VIRTUAL_TYPE): Override definition in tm-i386.h; use the
	Linux-specific version.

Index: gdb/i386-linux-tdep.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gdb/i386-linux-tdep.c,v
retrieving revision 2.7
diff -c -r2.7 i386-linux-tdep.c
*** gdb/i386-linux-tdep.c	2001/11/10 03:02:19	2.7
--- gdb/i386-linux-tdep.c	2002/01/11 21:51:28
***************
*** 64,69 ****
--- 64,79 ----
  
    return i386_register_raw_size (reg);
  }
+ 
+ struct type *
+ i386_linux_register_virtual_type (int reg)
+ {
+   /* Deal with the extra "orig_eax" pseudo register.  */
+   if (reg == I386_LINUX_ORIG_EAX_REGNUM)
+     return builtin_type_int;
+ 
+   return i386_register_virtual_type (reg);
+ }
  \f
  /* Recognizing signal handler frames.  */
  
Index: gdb/config/i386/tm-linux.h
===================================================================
RCS file: /cvs/cvsfiles/devo/gdb/config/i386/tm-linux.h,v
retrieving revision 1.28
diff -c -r1.28 tm-linux.h
*** gdb/config/i386/tm-linux.h	2001/11/10 03:02:20	1.28
--- gdb/config/i386/tm-linux.h	2002/01/11 21:51:28
***************
*** 60,65 ****
--- 60,69 ----
  #define REGISTER_RAW_SIZE(reg) i386_linux_register_raw_size ((reg))
  extern int i386_linux_register_raw_size (int reg);
  
+ #undef REGISTER_VIRTUAL_TYPE
+ #define REGISTER_VIRTUAL_TYPE(reg) i386_linux_register_virtual_type ((reg))
+ extern struct type *i386_linux_register_virtual_type (int reg);
+ 
  /* Linux/ELF uses stabs-in-ELF with the DWARF register numbering
     scheme by default, so we must redefine STAB_REG_TO_REGNUM.  This
     messes up the floating-point registers for a.out, but there is not


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

* Re: RFA: i386 Linux: provide correct type for orig_eax register
  2002-01-11 14:23 RFA: i386 Linux: provide correct type for orig_eax register Jim Blandy
@ 2002-01-12  5:13 ` Mark Kettenis
  2002-01-12 15:14   ` Jim Blandy
  0 siblings, 1 reply; 6+ messages in thread
From: Mark Kettenis @ 2002-01-12  5:13 UTC (permalink / raw)
  To: Jim Blandy; +Cc: gdb-patches

Jim Blandy <jimb@zwingli.cygnus.com> writes:

> This fixes a failure in callfuncs.exp.

What failure?

> 2002-01-11  Jim Blandy  <jimb@redhat.com>
> 
> 	Return the correct virtual type for orig_eax.
> 	* i386-linux-tdep.c (i386_linux_register_virtual_type): New function.
> 	* config/i386/tm-linux.h (i386_linux_register_virtual_type): New
> 	declaration.
> 	(REGISTER_VIRTUAL_TYPE): Override definition in tm-i386.h; use the
> 	Linux-specific version.

Hmm.  You're compiling GDB on a system that doesn't have
PTRACE_GETFPXREGS in <sys/ptrace.h> isn't it?  In that case, I think
your patch is just papering over a more fundamental flaw in the
Linux/x86 port: not always including the SSE registers in the register
file.

I think we should #define HAVE_SSE_REGS unconditionally in
config/i386/tm-linux.h.  Later, when things are properly multi-arched,
we can decide whether we actually display thos registers based on the
actual processor model.

Mark


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

* Re: RFA: i386 Linux: provide correct type for orig_eax register
  2002-01-12  5:13 ` Mark Kettenis
@ 2002-01-12 15:14   ` Jim Blandy
  2002-01-12 15:40     ` Andrew Cagney
  0 siblings, 1 reply; 6+ messages in thread
From: Jim Blandy @ 2002-01-12 15:14 UTC (permalink / raw)
  To: Mark Kettenis; +Cc: gdb-patches


Mark Kettenis <kettenis@science.uva.nl> writes:
> Jim Blandy <jimb@zwingli.cygnus.com> writes:
> 
> > This fixes a failure in callfuncs.exp.
> 
> What failure?

gdb.base/callfuncs.exp: gdb function calls preserve register contents

GDB was actually preserving the registers' contents correctly.  The
real problem is that GDB was returning the SSE registers' type for
orig_eax, so that the printed value included bits off the end of the
register array.

> > 2002-01-11  Jim Blandy  <jimb@redhat.com>
> > 
> > 	Return the correct virtual type for orig_eax.
> > 	* i386-linux-tdep.c (i386_linux_register_virtual_type): New function.
> > 	* config/i386/tm-linux.h (i386_linux_register_virtual_type): New
> > 	declaration.
> > 	(REGISTER_VIRTUAL_TYPE): Override definition in tm-i386.h; use the
> > 	Linux-specific version.
> 
> Hmm.  You're compiling GDB on a system that doesn't have
> PTRACE_GETFPXREGS in <sys/ptrace.h> isn't it?

Yep.

> In that case, I think your patch is just papering over a more
> fundamental flaw in the Linux/x86 port: not always including the SSE
> registers in the register file.
> 
> I think we should #define HAVE_SSE_REGS unconditionally in
> config/i386/tm-linux.h.  Later, when things are properly multi-arched,
> we can decide whether we actually display thos registers based on the
> actual processor model.

Okay.  I'll give that a try.


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

* Re: RFA: i386 Linux: provide correct type for orig_eax register
  2002-01-12 15:14   ` Jim Blandy
@ 2002-01-12 15:40     ` Andrew Cagney
  2002-01-14 13:58       ` Jim Blandy
  0 siblings, 1 reply; 6+ messages in thread
From: Andrew Cagney @ 2002-01-12 15:40 UTC (permalink / raw)
  To: Jim Blandy; +Cc: Mark Kettenis, gdb-patches

> I think we should #define HAVE_SSE_REGS unconditionally in
>> config/i386/tm-linux.h.  Later, when things are properly multi-arched,
>> we can decide whether we actually display thos registers based on the
>> actual processor model.
> 
> 
> Okay.  I'll give that a try.


I'm trying to decide if it will break something.

The old ``remote packet is defined by the layout of the register 
buffer'' problem is lurking ready to strike :-(  This would put the SSE 
registers into the register buffer causing GDB to try to send them to a 
target that, rightly, doesn't expect them (hmm and also doesn't support 
a register-write packet)

It is why I was hacking on remote.c.  I've two more things to do: the 
protocol format command and sort out what ever happend to a 
read-register packet proposal that was posted.

Andrew


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

* Re: RFA: i386 Linux: provide correct type for orig_eax register
  2002-01-12 15:40     ` Andrew Cagney
@ 2002-01-14 13:58       ` Jim Blandy
  2002-01-14 14:31         ` Mark Kettenis
  0 siblings, 1 reply; 6+ messages in thread
From: Jim Blandy @ 2002-01-14 13:58 UTC (permalink / raw)
  To: Andrew Cagney; +Cc: Mark Kettenis, gdb-patches


Andrew Cagney <ac131313@cygnus.com> writes:
> > I think we should #define HAVE_SSE_REGS unconditionally in
> >> config/i386/tm-linux.h.  Later, when things are properly multi-arched,
> >> we can decide whether we actually display thos registers based on the
> >> actual processor model.
> > Okay.  I'll give that a try.
> 
> 
> I'm trying to decide if it will break something.
> 
> The old ``remote packet is defined by the layout of the register
> buffer'' problem is lurking ready to strike :-(  This would put the
> SSE registers into the register buffer causing GDB to try to send them
> to a target that, rightly, doesn't expect them (hmm and also doesn't
> support a register-write packet)
> 
> It is why I was hacking on remote.c.  I've two more things to do: the
> protocol format command and sort out what ever happend to a
> read-register packet proposal that was posted.

Well, in that context, may I at least commit the change I posted?  It
simply extends the pattern of i386_linux_register_raw_size,
i386_linux_register_byte, and i386_linux_register_name.


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

* Re: RFA: i386 Linux: provide correct type for orig_eax register
  2002-01-14 13:58       ` Jim Blandy
@ 2002-01-14 14:31         ` Mark Kettenis
  0 siblings, 0 replies; 6+ messages in thread
From: Mark Kettenis @ 2002-01-14 14:31 UTC (permalink / raw)
  To: jimb; +Cc: ac131313, gdb-patches

   From: Jim Blandy <jimb@zwingli.cygnus.com>
   Date: 14 Jan 2002 16:59:49 -0500

   Andrew Cagney <ac131313@cygnus.com> writes:
   > > I think we should #define HAVE_SSE_REGS unconditionally in
   > >> config/i386/tm-linux.h.  Later, when things are properly multi-arched,
   > >> we can decide whether we actually display thos registers based on the
   > >> actual processor model.
   > > Okay.  I'll give that a try.
   > 
   > 
   > I'm trying to decide if it will break something.
   > 
   > The old ``remote packet is defined by the layout of the register
   > buffer'' problem is lurking ready to strike :-(  This would put the
   > SSE registers into the register buffer causing GDB to try to send them
   > to a target that, rightly, doesn't expect them (hmm and also doesn't
   > support a register-write packet)

The new orig_eax register isn't in any publically released version of
GDB yet.  And actually I think your worries about the remote packet is
actually an argument to try to keep the remote packet the same for all
Linux targets.  Right now it will depend on the header files installed
on the system where GDB is built.

   Well, in that context, may I at least commit the change I posted?  It
   simply extends the pattern of i386_linux_register_raw_size,
   i386_linux_register_byte, and i386_linux_register_name.

I'd really prefer the unconditional #define of HAVE_SSE_REGS.

Mark


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

end of thread, other threads:[~2002-01-14 22:31 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-01-11 14:23 RFA: i386 Linux: provide correct type for orig_eax register Jim Blandy
2002-01-12  5:13 ` Mark Kettenis
2002-01-12 15:14   ` Jim Blandy
2002-01-12 15:40     ` Andrew Cagney
2002-01-14 13:58       ` Jim Blandy
2002-01-14 14:31         ` Mark Kettenis

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