Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [patch rfc rfa:i386] Add i386 specific register groups
@ 2002-11-08  9:53 Andrew Cagney
  2002-11-08 12:21 ` Mark Kettenis
  0 siblings, 1 reply; 10+ messages in thread
From: Andrew Cagney @ 2002-11-08  9:53 UTC (permalink / raw)
  To: gdb-patches

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

Hello,

The attached patch adds two i386 specific register groups:

+struct reggroup *i386_sse_reggroup;
+struct reggroup *i386_mmx_reggroup;

(hmm, I'll make them static :-) The registers are then distributed 
according to the attached output.

I should note that the orig_eax register is only a member of the system, 
save and restore reggroups, and hence is no longer displayed by either 
`info registers' or `info all-registers'.  If you're really desperate 
you can use the `maint print raw-registers` (which is in the manual :-)

This ok?

--

At a more general level, the current mechanism for adding register 
groups requires the architecture add all relevant groups explicitly vis:

+static void
+i386_add_reggroups (struct gdbarch *gdbarch)
+{
+  reggroup_add (gdbarch, i386_sse_reggroup);
+  reggroup_add (gdbarch, i386_mmx_reggroup);
+  reggroup_add (gdbarch, general_reggroup);
+  reggroup_add (gdbarch, float_reggroup);
+  reggroup_add (gdbarch, all_reggroup);
+  reggroup_add (gdbarch, save_reggroup);
+  reggroup_add (gdbarch, restore_reggroup);
+  reggroup_add (gdbarch, vector_reggroup);
+  reggroup_add (gdbarch, system_reggroup);
+}

this could be changed so that there is a standard pre-defined set, 
architectures only needing to add architecture specific groups.

Thoughts?

Andrew

[-- Attachment #2: out --]
[-- Type: text/plain, Size: 4266 bytes --]

(top-gdb) maint print register-groups 
 Name         Nr  Rel Offset    Size  Type            Groups
 eax           0    0      0       4  int             general,all,save,restore
 ecx           1    1      4       4  int             general,all,save,restore
 edx           2    2      8       4  int             general,all,save,restore
 ebx           3    3     12       4  int             general,all,save,restore
 esp           4    4     16       4  *1              general,all,save,restore
 ebp           5    5     20       4  *1              general,all,save,restore
 esi           6    6     24       4  int             general,all,save,restore
 edi           7    7     28       4  int             general,all,save,restore
 eip           8    8     32       4  *1              general,all,save,restore
 eflags        9    9     36       4  int             general,all,save,restore
 cs           10   10     40       4  int             general,all,save,restore
 ss           11   11     44       4  int             general,all,save,restore
 ds           12   12     48       4  int             general,all,save,restore
 es           13   13     52       4  int             general,all,save,restore
 fs           14   14     56       4  int             general,all,save,restore
 gs           15   15     60       4  int             general,all,save,restore
 st0          16   16     64      10  _i387_ext       general,float,all,save,restore
 st1          17   17     74      10  _i387_ext       general,float,all,save,restore
 st2          18   18     84      10  _i387_ext       general,float,all,save,restore
 st3          19   19     94      10  _i387_ext       general,float,all,save,restore
 st4          20   20    104      10  _i387_ext       general,float,all,save,restore
 st5          21   21    114      10  _i387_ext       general,float,all,save,restore
 st6          22   22    124      10  _i387_ext       general,float,all,save,restore
 st7          23   23    134      10  _i387_ext       general,float,all,save,restore
 fctrl        24   24    144       4  int             general,float,all,save,restore
 fstat        25   25    148       4  int             general,float,all,save,restore
 ftag         26   26    152       4  int             general,float,all,save,restore
 fiseg        27   27    156       4  int             general,float,all,save,restore
 fioff        28   28    160       4  int             general,float,all,save,restore
 foseg        29   29    164       4  int             general,float,all,save,restore
 fooff        30   30    168       4  int             general,float,all,save,restore
 fop          31   31    172       4  int             general,float,all,save,restore
 xmm0         32   32    176      16  _vec128i        sse,general,all,save,restore,vector
 xmm1         33   33    192      16  _vec128i        sse,general,all,save,restore,vector
 xmm2         34   34    208      16  _vec128i        sse,general,all,save,restore,vector
 xmm3         35   35    224      16  _vec128i        sse,general,all,save,restore,vector
 xmm4         36   36    240      16  _vec128i        sse,general,all,save,restore,vector
 xmm5         37   37    256      16  _vec128i        sse,general,all,save,restore,vector
 xmm6         38   38    272      16  _vec128i        sse,general,all,save,restore,vector
 xmm7         39   39    288      16  _vec128i        sse,general,all,save,restore,vector
 mxcsr        40   40    304       4  int             sse,general,all,save,restore,vector
 orig_eax     41   41    308       4  int             save,restore,system
 mm0          42    0    312       8  _vec64i         mmx,general,all,vector
 mm1          43    1    320       8  _vec64i         mmx,general,all,vector
 mm2          44    2    328       8  _vec64i         mmx,general,all,vector
 mm3          45    3    336       8  _vec64i         mmx,general,all,vector
 mm4          46    4    344       8  _vec64i         mmx,general,all,vector
 mm5          47    5    352       8  _vec64i         mmx,general,all,vector
 mm6          48    6    360       8  _vec64i         mmx,general,all,vector
 mm7          49    7    368       8  _vec64i         mmx,general,all,vector
*1: Register type's name NULL.
(top-gdb) 

[-- Attachment #3: diffs --]
[-- Type: text/plain, Size: 5433 bytes --]

2002-11-08  Andrew Cagney  <ac131313@redhat.com>

	* i386-linux-tdep.c: Include "reggroups.h".
	(i386_linux_register_reggroup_p): New function.
	(i386_linux_init_abi): Set register_reggroup_p to
	i386_linux_register_reggroup_p.
	* i386-tdep.h (i386_register_reggroup_p): Declare.
	* i386-tdep.c: Include "reggroups.h".
	(i386_init_reggroups): New function.
	(i386_add_reggroups): New function.
	(i386_register_reggroup_p): New function.
	(i386_sse_reggroup, i386_mmx_reggroup): New variables.
	(_initialize_i386_tdep): Call i386_init_reggroups.
	(i386_gdbarch_init): Set register_reggroup_p and add in the i386
	specific reggroups.

Index: i386-linux-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/i386-linux-tdep.c,v
retrieving revision 1.18
diff -u -r1.18 i386-linux-tdep.c
--- i386-linux-tdep.c	31 Oct 2002 20:51:15 -0000	1.18
+++ i386-linux-tdep.c	8 Nov 2002 17:39:47 -0000
@@ -25,6 +25,7 @@
 #include "value.h"
 #include "regcache.h"
 #include "inferior.h"
+#include "reggroups.h"
 
 /* For i386_linux_skip_solib_resolver.  */
 #include "symtab.h"
@@ -47,6 +48,20 @@
 
   return i386_register_name (reg);
 }
+
+/* Return non-zero, when the register is in the corresponding register
+   group.  Put the LINUX_ORIG_EAX register in the system group.  */
+static int
+i386_linux_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
+				struct reggroup *group)
+{
+  if (regnum == I386_LINUX_ORIG_EAX_REGNUM)
+    return (group == system_reggroup
+	    || group == save_reggroup
+	    || group == restore_reggroup);
+  return i386_register_reggroup_p (gdbarch, regnum, group);
+}
+
 \f
 /* Recognizing signal handler frames.  */
 
@@ -442,6 +457,7 @@
   set_gdbarch_write_pc (gdbarch, i386_linux_write_pc);
   set_gdbarch_num_regs (gdbarch, I386_SSE_NUM_REGS + 1);
   set_gdbarch_register_name (gdbarch, i386_linux_register_name);
+  set_gdbarch_register_reggroup_p (gdbarch, i386_linux_register_reggroup_p);
   set_gdbarch_register_bytes (gdbarch, I386_SSE_SIZEOF_REGS + 4);
 
   tdep->jb_pc_offset = 20;	/* From <bits/setjmp.h>.  */
Index: i386-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/i386-tdep.c,v
retrieving revision 1.92
diff -u -r1.92 i386-tdep.c
--- i386-tdep.c	8 Nov 2002 16:52:37 -0000	1.92
+++ i386-tdep.c	8 Nov 2002 17:39:47 -0000
@@ -37,6 +37,7 @@
 #include "doublest.h"
 #include "value.h"
 #include "gdb_assert.h"
+#include "reggroups.h"
 
 #include "i386-tdep.h"
 #include "i387-tdep.h"
@@ -1443,6 +1444,56 @@
 }
 \f
 
+/* i386 register groups.  In addition to the normal groups, add "mmx"
+   and "sse".  */
+
+struct reggroup *i386_sse_reggroup;
+struct reggroup *i386_mmx_reggroup;
+
+static void
+i386_init_reggroups (void)
+{
+  i386_sse_reggroup = reggroup_new ("sse", USER_REGGROUP);
+  i386_mmx_reggroup = reggroup_new ("mmx", USER_REGGROUP);
+}
+
+static void
+i386_add_reggroups (struct gdbarch *gdbarch)
+{
+  reggroup_add (gdbarch, i386_sse_reggroup);
+  reggroup_add (gdbarch, i386_mmx_reggroup);
+  reggroup_add (gdbarch, general_reggroup);
+  reggroup_add (gdbarch, float_reggroup);
+  reggroup_add (gdbarch, all_reggroup);
+  reggroup_add (gdbarch, save_reggroup);
+  reggroup_add (gdbarch, restore_reggroup);
+  reggroup_add (gdbarch, vector_reggroup);
+  reggroup_add (gdbarch, system_reggroup);
+}
+
+int
+i386_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
+			  struct reggroup *group)
+{
+  int sse_regnum_p = (i386_sse_regnum_p (regnum)
+		      || i386_mxcsr_regnum_p (regnum));
+  int fp_regnum_p = (i386_fp_regnum_p (regnum)
+		     || i386_fpc_regnum_p (regnum));
+  int mmx_regnum_p = (i386_mmx_regnum_p (regnum));
+  if (group == i386_mmx_reggroup)
+    return mmx_regnum_p;
+  if (group == i386_sse_reggroup)
+    return sse_regnum_p;
+  if (group == vector_reggroup)
+    return (mmx_regnum_p || sse_regnum_p);
+  if (group == float_reggroup)
+    return fp_regnum_p;
+  if (group == general_reggroup)
+    return 1;
+  return default_register_reggroup_p (gdbarch, regnum, group);
+}
+
+\f
 static struct gdbarch *
 i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 {
@@ -1601,6 +1652,10 @@
 
   set_gdbarch_print_insn (gdbarch, i386_print_insn);
 
+  /* Add the i386 register groups.  */
+  i386_add_reggroups (gdbarch);
+  set_gdbarch_register_reggroup_p (gdbarch, i386_register_reggroup_p);
+
   /* Hook in ABI-specific overrides, if they have been registered.  */
   gdbarch_init_osabi (info, gdbarch, osabi);
 
@@ -1671,4 +1726,7 @@
 			  i386_go32_init_abi);
   gdbarch_register_osabi (bfd_arch_i386, GDB_OSABI_NETWARE,
 			  i386_nw_init_abi);
+
+  /* Initialize the i386 specific register groups.  */
+  i386_init_reggroups ();
 }
Index: i386-tdep.h
===================================================================
RCS file: /cvs/src/src/gdb/i386-tdep.h,v
retrieving revision 1.16
diff -u -r1.16 i386-tdep.h
--- i386-tdep.h	8 Nov 2002 17:03:27 -0000	1.16
+++ i386-tdep.h	8 Nov 2002 17:39:47 -0000
@@ -167,6 +167,10 @@
 /* Return the name of register REG.  */
 extern char const *i386_register_name (int reg);
 
+/* Return non-zero if REGNUM is a member of the specified group.  */
+extern int i386_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
+				     struct reggroup *group);
+
 /* Initialize a basic ELF architecture variant.  */
 extern void i386_elf_init_abi (struct gdbarch_info, struct gdbarch *);
 

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

* Re: [patch rfc rfa:i386] Add i386 specific register groups
  2002-11-08  9:53 [patch rfc rfa:i386] Add i386 specific register groups Andrew Cagney
@ 2002-11-08 12:21 ` Mark Kettenis
  2002-11-08 12:32   ` Andrew Cagney
  0 siblings, 1 reply; 10+ messages in thread
From: Mark Kettenis @ 2002-11-08 12:21 UTC (permalink / raw)
  To: Andrew Cagney; +Cc: gdb-patches

Andrew Cagney <ac131313@redhat.com> writes:

> I should note that the orig_eax register is only a member of the system, 
> save and restore reggroups, and hence is no longer displayed by either 
> `info registers' or `info all-registers'.  If you're really desperate 
> you can use the `maint print raw-registers` (which is in the manual :-)

Yeah!  And you can always say "print $orig_eax", can't you?

> This ok?

Hmm, why are all registers in group "general"?  I'd expect the group
general to only include the general-purpose registers.

Mark


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

* Re: [patch rfc rfa:i386] Add i386 specific register groups
  2002-11-08 12:21 ` Mark Kettenis
@ 2002-11-08 12:32   ` Andrew Cagney
  2002-11-08 12:34     ` Daniel Jacobowitz
  2002-11-08 12:56     ` Mark Kettenis
  0 siblings, 2 replies; 10+ messages in thread
From: Andrew Cagney @ 2002-11-08 12:32 UTC (permalink / raw)
  To: Mark Kettenis; +Cc: gdb-patches

> Andrew Cagney <ac131313@redhat.com> writes:
> 
> 
>> I should note that the orig_eax register is only a member of the system, 
>> save and restore reggroups, and hence is no longer displayed by either 
>> `info registers' or `info all-registers'.  If you're really desperate 
>> you can use the `maint print raw-registers` (which is in the manual :-)
> 
> 
> Yeah!  And you can always say "print $orig_eax", can't you?

(er, quickly checking ...)

(top-gdb) print $orig_eax
$1 = -1
(top-gdb) maint print raw-registers
...
  orig_eax     41   41    308       4  int             0xffffffff

Yep, of course you can.

What about save/restore?  Should it be saved/restored across an inferior 
function call?

>> This ok?
> 
> 
> Hmm, why are all registers in group "general"?

Preserving existing behavior? :-^

 > I'd expect the group
> general to only include the general-purpose registers.

So you'd like the mmx and sse registers excluded
(general corresponds to `info all-registers')?

Just give the word,

Andrew



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

* Re: [patch rfc rfa:i386] Add i386 specific register groups
  2002-11-08 12:32   ` Andrew Cagney
@ 2002-11-08 12:34     ` Daniel Jacobowitz
  2002-11-08 12:43       ` Andrew Cagney
  2002-11-08 12:56     ` Mark Kettenis
  1 sibling, 1 reply; 10+ messages in thread
From: Daniel Jacobowitz @ 2002-11-08 12:34 UTC (permalink / raw)
  To: Andrew Cagney; +Cc: Mark Kettenis, gdb-patches

On Fri, Nov 08, 2002 at 03:32:20PM -0500, Andrew Cagney wrote:
> >Andrew Cagney <ac131313@redhat.com> writes:
> >
> >
> >>I should note that the orig_eax register is only a member of the system, 
> >>save and restore reggroups, and hence is no longer displayed by either 
> >>`info registers' or `info all-registers'.  If you're really desperate 
> >>you can use the `maint print raw-registers` (which is in the manual :-)
> >
> >
> >Yeah!  And you can always say "print $orig_eax", can't you?
> 
> (er, quickly checking ...)
> 
> (top-gdb) print $orig_eax
> $1 = -1
> (top-gdb) maint print raw-registers
> ...
>  orig_eax     41   41    308       4  int             0xffffffff
> 
> Yep, of course you can.
> 
> What about save/restore?  Should it be saved/restored across an inferior 
> function call?

Absolutely - in fact, that's the whole reason it was added :)

> >>This ok?
> >
> >
> >Hmm, why are all registers in group "general"?
> 
> Preserving existing behavior? :-^
> 
> > I'd expect the group
> >general to only include the general-purpose registers.
> 
> So you'd like the mmx and sse registers excluded
> (general corresponds to `info all-registers')?
> 
> Just give the word,

Wait - does general correspond to `all-registers' or `registers'?

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer


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

* Re: [patch rfc rfa:i386] Add i386 specific register groups
  2002-11-08 12:34     ` Daniel Jacobowitz
@ 2002-11-08 12:43       ` Andrew Cagney
  2002-11-08 12:51         ` Daniel Jacobowitz
  0 siblings, 1 reply; 10+ messages in thread
From: Andrew Cagney @ 2002-11-08 12:43 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: Mark Kettenis, gdb-patches

> This ok?
> 
>> >
>> >
>> >Hmm, why are all registers in group "general"?
> 
>> 
>> Preserving existing behavior? :-^
>> 
> 
>> > I'd expect the group
>> >general to only include the general-purpose registers.
> 
>> 
>> So you'd like the mmx and sse registers excluded
>> (general corresponds to `info all-registers')?
>> 
>> Just give the word,
> 
> 
> Wait - does general correspond to `all-registers' or `registers'?

Oops, yes, other way:

general == info registers
all == info all-registers

Andrew



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

* Re: [patch rfc rfa:i386] Add i386 specific register groups
  2002-11-08 12:43       ` Andrew Cagney
@ 2002-11-08 12:51         ` Daniel Jacobowitz
  0 siblings, 0 replies; 10+ messages in thread
From: Daniel Jacobowitz @ 2002-11-08 12:51 UTC (permalink / raw)
  To: Andrew Cagney; +Cc: Mark Kettenis, gdb-patches

On Fri, Nov 08, 2002 at 03:43:51PM -0500, Andrew Cagney wrote:
> >This ok?
> >
> >>>
> >>>
> >>>Hmm, why are all registers in group "general"?
> >
> >>
> >>Preserving existing behavior? :-^
> >>
> >
> >>> I'd expect the group
> >>>general to only include the general-purpose registers.
> >
> >>
> >>So you'd like the mmx and sse registers excluded
> >>(general corresponds to `info all-registers')?
> >>
> >>Just give the word,
> >
> >
> >Wait - does general correspond to `all-registers' or `registers'?
> 
> Oops, yes, other way:
> 
> general == info registers
> all == info all-registers

In that case, I'll throw my preference for excluding mmx/sse from info
registers.

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer


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

* Re: [patch rfc rfa:i386] Add i386 specific register groups
  2002-11-08 12:32   ` Andrew Cagney
  2002-11-08 12:34     ` Daniel Jacobowitz
@ 2002-11-08 12:56     ` Mark Kettenis
  2002-11-08 15:09       ` Andrew Cagney
  1 sibling, 1 reply; 10+ messages in thread
From: Mark Kettenis @ 2002-11-08 12:56 UTC (permalink / raw)
  To: ac131313; +Cc: gdb-patches

   Date: Fri, 08 Nov 2002 15:32:20 -0500
   From: Andrew Cagney <ac131313@redhat.com>

   > Yeah!  And you can always say "print $orig_eax", can't you?

   (er, quickly checking ...)

   (top-gdb) print $orig_eax
   $1 = -1
   (top-gdb) maint print raw-registers
   ...
     orig_eax     41   41    308       4  int             0xffffffff

   Yep, of course you can.

   What about save/restore?  Should it be saved/restored across an inferior 
   function call?

Yes it should, so save/restore is OK.

   > Hmm, why are all registers in group "general"?

   Preserving existing behavior? :-^

Not quite I think.  Existing behaviour is for "info registers" to
print everything except st0...st7 and xmm0...xmm7.  So it doesn't
print float and vector registers.  However it does print the
floating-point control registers and mxcsr which is the SSE control
register.  Now that doesn't make any sense to me.  Therefore I'd like
"info registers" to print only the general-purpose registers, that is
everything up to and including gs, but nothing else.

   (general corresponds to `info all-registers')?

Nope it doesn't.  It's "all" that corresponds to "info all-registers",
and "general" that corresponds to "info registers".  So I'd want:

  if (group == general_reggroup)
    return (!fp_regnum_p && !mmx_regnum_p && !sse_regnum_p);

Mark


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

* Re: [patch rfc rfa:i386] Add i386 specific register groups
  2002-11-08 12:56     ` Mark Kettenis
@ 2002-11-08 15:09       ` Andrew Cagney
  2002-11-08 15:14         ` Mark Kettenis
  0 siblings, 1 reply; 10+ messages in thread
From: Andrew Cagney @ 2002-11-08 15:09 UTC (permalink / raw)
  To: Mark Kettenis, Daniel Jacobowitz; +Cc: gdb-patches

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

How does the attached look then?

Andrew

[-- Attachment #2: out --]
[-- Type: text/plain, Size: 4558 bytes --]

(top-gdb) maint print register-groups 
 Name         Nr  Rel Offset    Size  Type            Groups
 eax           0    0      0       4  int             general,all,save,restore
 ecx           1    1      4       4  int             general,all,save,restore
 edx           2    2      8       4  int             general,all,save,restore
 ebx           3    3     12       4  int             general,all,save,restore
 esp           4    4     16       4  *1              general,all,save,restore
 ebp           5    5     20       4  *1              general,all,save,restore
 esi           6    6     24       4  int             general,all,save,restore
 edi           7    7     28       4  int             general,all,save,restore
 eip           8    8     32       4  *1              general,all,save,restore
 eflags        9    9     36       4  int             general,all,save,restore
 cs           10   10     40       4  int             general,all,save,restore
 ss           11   11     44       4  int             general,all,save,restore
 ds           12   12     48       4  int             general,all,save,restore
 es           13   13     52       4  int             general,all,save,restore
 fs           14   14     56       4  int             general,all,save,restore
 gs           15   15     60       4  int             general,all,save,restore
 st0          16   16     64      10  _i387_ext       float,all,save,restore
 st1          17   17     74      10  _i387_ext       float,all,save,restore
 st2          18   18     84      10  _i387_ext       float,all,save,restore
 st3          19   19     94      10  _i387_ext       float,all,save,restore
 st4          20   20    104      10  _i387_ext       float,all,save,restore
 st5          21   21    114      10  _i387_ext       float,all,save,restore
 st6          22   22    124      10  _i387_ext       float,all,save,restore
 st7          23   23    134      10  _i387_ext       float,all,save,restore
 fctrl        24   24    144       4  int             float,all,save,restore
 fstat        25   25    148       4  int             float,all,save,restore
 ftag         26   26    152       4  int             float,all,save,restore
 fiseg        27   27    156       4  int             float,all,save,restore
 fioff        28   28    160       4  int             float,all,save,restore
 foseg        29   29    164       4  int             float,all,save,restore
 fooff        30   30    168       4  int             float,all,save,restore
 fop          31   31    172       4  int             float,all,save,restore
 xmm0         32   32    176      16  _vec128i        sse,all,save,restore,vector
 xmm1         33   33    192      16  _vec128i        sse,all,save,restore,vector
 xmm2         34   34    208      16  _vec128i        sse,all,save,restore,vector
 xmm3         35   35    224      16  _vec128i        sse,all,save,restore,vector
 xmm4         36   36    240      16  _vec128i        sse,all,save,restore,vector
 xmm5         37   37    256      16  _vec128i        sse,all,save,restore,vector
 xmm6         38   38    272      16  _vec128i        sse,all,save,restore,vector
 xmm7         39   39    288      16  _vec128i        sse,all,save,restore,vector
 mxcsr        40   40    304       4  int             sse,all,save,restore,vector
 orig_eax     41   41    308       4  int             save,restore,system
 mm0          42    0    312       8  _vec64i         mmx,all,vector
 mm1          43    1    320       8  _vec64i         mmx,all,vector
 mm2          44    2    328       8  _vec64i         mmx,all,vector
 mm3          45    3    336       8  _vec64i         mmx,all,vector
 mm4          46    4    344       8  _vec64i         mmx,all,vector
 mm5          47    5    352       8  _vec64i         mmx,all,vector
 mm6          48    6    360       8  _vec64i         mmx,all,vector
 mm7          49    7    368       8  _vec64i         mmx,all,vector
*1: Register type's name NULL.
(top-gdb) info registers
eax            0x1      1
ecx            0x0      0
edx            0xbffff844       -1073743804
ebx            0x401d1e34       1075650100
esp            0xbffff7b4       0xbffff7b4
ebp            0xbffff7d8       0xbffff7d8
esi            0x40016b4c       1073834828
edi            0xbffff844       -1073743804
eip            0x8074b3c        0x8074b3c
eflags         0x286    646
cs             0x23     35
ss             0x2b     43
ds             0x2b     43
es             0x2b     43
fs             0x0      0
gs             0x0      0

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

* Re: [patch rfc rfa:i386] Add i386 specific register groups
  2002-11-08 15:09       ` Andrew Cagney
@ 2002-11-08 15:14         ` Mark Kettenis
  2002-11-08 16:00           ` Andrew Cagney
  0 siblings, 1 reply; 10+ messages in thread
From: Mark Kettenis @ 2002-11-08 15:14 UTC (permalink / raw)
  To: ac131313; +Cc: drow, gdb-patches

   Date: Fri, 08 Nov 2002 18:09:46 -0500
   From: Andrew Cagney <ac131313@redhat.com>

   How does the attached look then?

Great!  Please go ahead and check in the code that produced this output.

Mark


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

* Re: [patch rfc rfa:i386] Add i386 specific register groups
  2002-11-08 15:14         ` Mark Kettenis
@ 2002-11-08 16:00           ` Andrew Cagney
  0 siblings, 0 replies; 10+ messages in thread
From: Andrew Cagney @ 2002-11-08 16:00 UTC (permalink / raw)
  To: Mark Kettenis; +Cc: drow, gdb-patches

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

I've checked in the attached.

Andrew

>    Date: Fri, 08 Nov 2002 18:09:46 -0500
>    From: Andrew Cagney <ac131313@redhat.com>
> 
>    How does the attached look then?
> 
> Great!  Please go ahead and check in the code that produced this output.
> 
> Mark
> 


[-- Attachment #2: diffs --]
[-- Type: text/plain, Size: 5494 bytes --]

2002-11-08  Andrew Cagney  <ac131313@redhat.com>

	* i386-linux-tdep.c: Include "reggroups.h".
	(i386_linux_register_reggroup_p): New function.
	(i386_linux_init_abi): Set register_reggroup_p to
	i386_linux_register_reggroup_p.
	* i386-tdep.h (i386_register_reggroup_p): Declare.
	* i386-tdep.c: Include "reggroups.h".
	(i386_init_reggroups): New function.
	(i386_add_reggroups): New function.
	(i386_register_reggroup_p): New function.
	(i386_sse_reggroup, i386_mmx_reggroup): New variables.
	(_initialize_i386_tdep): Call i386_init_reggroups.
	(i386_gdbarch_init): Set register_reggroup_p and add in the i386
	specific reggroups.

Index: i386-linux-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/i386-linux-tdep.c,v
retrieving revision 1.18
diff -u -r1.18 i386-linux-tdep.c
--- i386-linux-tdep.c	31 Oct 2002 20:51:15 -0000	1.18
+++ i386-linux-tdep.c	8 Nov 2002 23:57:43 -0000
@@ -25,6 +25,7 @@
 #include "value.h"
 #include "regcache.h"
 #include "inferior.h"
+#include "reggroups.h"
 
 /* For i386_linux_skip_solib_resolver.  */
 #include "symtab.h"
@@ -47,6 +48,20 @@
 
   return i386_register_name (reg);
 }
+
+/* Return non-zero, when the register is in the corresponding register
+   group.  Put the LINUX_ORIG_EAX register in the system group.  */
+static int
+i386_linux_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
+				struct reggroup *group)
+{
+  if (regnum == I386_LINUX_ORIG_EAX_REGNUM)
+    return (group == system_reggroup
+	    || group == save_reggroup
+	    || group == restore_reggroup);
+  return i386_register_reggroup_p (gdbarch, regnum, group);
+}
+
 \f
 /* Recognizing signal handler frames.  */
 
@@ -442,6 +457,7 @@
   set_gdbarch_write_pc (gdbarch, i386_linux_write_pc);
   set_gdbarch_num_regs (gdbarch, I386_SSE_NUM_REGS + 1);
   set_gdbarch_register_name (gdbarch, i386_linux_register_name);
+  set_gdbarch_register_reggroup_p (gdbarch, i386_linux_register_reggroup_p);
   set_gdbarch_register_bytes (gdbarch, I386_SSE_SIZEOF_REGS + 4);
 
   tdep->jb_pc_offset = 20;	/* From <bits/setjmp.h>.  */
Index: i386-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/i386-tdep.c,v
retrieving revision 1.93
diff -u -r1.93 i386-tdep.c
--- i386-tdep.c	8 Nov 2002 17:34:31 -0000	1.93
+++ i386-tdep.c	8 Nov 2002 23:57:43 -0000
@@ -37,6 +37,7 @@
 #include "doublest.h"
 #include "value.h"
 #include "gdb_assert.h"
+#include "reggroups.h"
 
 #include "i386-tdep.h"
 #include "i387-tdep.h"
@@ -1443,6 +1444,56 @@
 }
 \f
 
+/* i386 register groups.  In addition to the normal groups, add "mmx"
+   and "sse".  */
+
+static struct reggroup *i386_sse_reggroup;
+static struct reggroup *i386_mmx_reggroup;
+
+static void
+i386_init_reggroups (void)
+{
+  i386_sse_reggroup = reggroup_new ("sse", USER_REGGROUP);
+  i386_mmx_reggroup = reggroup_new ("mmx", USER_REGGROUP);
+}
+
+static void
+i386_add_reggroups (struct gdbarch *gdbarch)
+{
+  reggroup_add (gdbarch, i386_sse_reggroup);
+  reggroup_add (gdbarch, i386_mmx_reggroup);
+  reggroup_add (gdbarch, general_reggroup);
+  reggroup_add (gdbarch, float_reggroup);
+  reggroup_add (gdbarch, all_reggroup);
+  reggroup_add (gdbarch, save_reggroup);
+  reggroup_add (gdbarch, restore_reggroup);
+  reggroup_add (gdbarch, vector_reggroup);
+  reggroup_add (gdbarch, system_reggroup);
+}
+
+int
+i386_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
+			  struct reggroup *group)
+{
+  int sse_regnum_p = (i386_sse_regnum_p (regnum)
+		      || i386_mxcsr_regnum_p (regnum));
+  int fp_regnum_p = (i386_fp_regnum_p (regnum)
+		     || i386_fpc_regnum_p (regnum));
+  int mmx_regnum_p = (i386_mmx_regnum_p (regnum));
+  if (group == i386_mmx_reggroup)
+    return mmx_regnum_p;
+  if (group == i386_sse_reggroup)
+    return sse_regnum_p;
+  if (group == vector_reggroup)
+    return (mmx_regnum_p || sse_regnum_p);
+  if (group == float_reggroup)
+    return fp_regnum_p;
+  if (group == general_reggroup)
+    return (!fp_regnum_p && !mmx_regnum_p && !sse_regnum_p);
+  return default_register_reggroup_p (gdbarch, regnum, group);
+}
+
+\f
 static struct gdbarch *
 i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 {
@@ -1601,6 +1652,10 @@
 
   set_gdbarch_print_insn (gdbarch, i386_print_insn);
 
+  /* Add the i386 register groups.  */
+  i386_add_reggroups (gdbarch);
+  set_gdbarch_register_reggroup_p (gdbarch, i386_register_reggroup_p);
+
   /* Hook in ABI-specific overrides, if they have been registered.  */
   gdbarch_init_osabi (info, gdbarch, osabi);
 
@@ -1671,4 +1726,7 @@
 			  i386_go32_init_abi);
   gdbarch_register_osabi (bfd_arch_i386, GDB_OSABI_NETWARE,
 			  i386_nw_init_abi);
+
+  /* Initialize the i386 specific register groups.  */
+  i386_init_reggroups ();
 }
Index: i386-tdep.h
===================================================================
RCS file: /cvs/src/src/gdb/i386-tdep.h,v
retrieving revision 1.18
diff -u -r1.18 i386-tdep.h
--- i386-tdep.h	8 Nov 2002 23:35:14 -0000	1.18
+++ i386-tdep.h	8 Nov 2002 23:57:43 -0000
@@ -167,6 +167,10 @@
 /* Return the name of register REG.  */
 extern char const *i386_register_name (int reg);
 
+/* Return non-zero if REGNUM is a member of the specified group.  */
+extern int i386_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
+				     struct reggroup *group);
+
 /* Initialize a basic ELF architecture variant.  */
 extern void i386_elf_init_abi (struct gdbarch_info, struct gdbarch *);
 

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

end of thread, other threads:[~2002-11-09  0:00 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-11-08  9:53 [patch rfc rfa:i386] Add i386 specific register groups Andrew Cagney
2002-11-08 12:21 ` Mark Kettenis
2002-11-08 12:32   ` Andrew Cagney
2002-11-08 12:34     ` Daniel Jacobowitz
2002-11-08 12:43       ` Andrew Cagney
2002-11-08 12:51         ` Daniel Jacobowitz
2002-11-08 12:56     ` Mark Kettenis
2002-11-08 15:09       ` Andrew Cagney
2002-11-08 15:14         ` Mark Kettenis
2002-11-08 16:00           ` Andrew Cagney

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