* [rfa:ppc] Make empty registers empty
@ 2003-06-21 1:31 Andrew Cagney
2003-06-23 19:50 ` Kevin Buettner
0 siblings, 1 reply; 3+ messages in thread
From: Andrew Cagney @ 2003-06-21 1:31 UTC (permalink / raw)
To: gdb-patches
[-- Attachment #1: Type: text/plain, Size: 951 bytes --]
Hello,
The PPC, for some processor variants, has an empty register R0:
#define R0 { 0, 0, 0, 0, 0 }
/* UISA-level SPRs for PowerPC without floating point support. */
#define PPC_UISA_NOFP_SPRS \
/* 66 */ R4(cr), R(lr), R(ctr), R4(xer), R0
/* Motorola e500. */
static const struct reg registers_e500[] =
{
R(pc), R(ps),
/* cr, lr, ctr, xer, "" */
PPC_UISA_NOFP_SPRS,
...
}
The problem is that register_virtual_type for those registers returns
int32 and, when things are added up, that doesn't agree with
register_raw_size (aka regsize), et.al. This makes regcache.[hc] grumpy
(try 'set architecture powerpc:e500 :-).
The attached adds an empty integer type (for want of a better choice)
and then modifies register_virtual_type so that it is returned when the
register is zero.
With this in place it becomes possible (well in theory) to delete all
the deprecated register * methods.
Ok? GDB 6 branch?
Andrew
[-- Attachment #2: diffs --]
[-- Type: text/plain, Size: 2690 bytes --]
2003-06-20 Andrew Cagney <cagney@redhat.com>
* rs6000-tdep.c (rs6000_register_virtual_type): Add explict cases
for 0 "int0" and 4 "int32" sized registers.
* gdbtypes.c (builtin_type_int0): Define.
(build_gdbtypes): Initialize builtin_type_int0.
* gdbtypes.h (builtin_type_int0): Declare.
Index: gdbtypes.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbtypes.c,v
retrieving revision 1.73
diff -u -r1.73 gdbtypes.c
--- gdbtypes.c 8 Jun 2003 18:27:13 -0000 1.73
+++ gdbtypes.c 21 Jun 2003 01:04:54 -0000
@@ -60,6 +60,7 @@
struct type *builtin_type_complex;
struct type *builtin_type_double_complex;
struct type *builtin_type_string;
+struct type *builtin_type_int0;
struct type *builtin_type_int8;
struct type *builtin_type_uint8;
struct type *builtin_type_int16;
@@ -3410,6 +3411,10 @@
init_type (TYPE_CODE_STRING, TARGET_CHAR_BIT / TARGET_CHAR_BIT,
0,
"string", (struct objfile *) NULL);
+ builtin_type_int0 =
+ init_type (TYPE_CODE_INT, 0 / 8,
+ 0,
+ "int0_t", (struct objfile *) NULL);
builtin_type_int8 =
init_type (TYPE_CODE_INT, 8 / 8,
0,
Index: gdbtypes.h
===================================================================
RCS file: /cvs/src/src/gdb/gdbtypes.h,v
retrieving revision 1.47
diff -u -r1.47 gdbtypes.h
--- gdbtypes.h 14 May 2003 17:43:17 -0000 1.47
+++ gdbtypes.h 21 Jun 2003 01:04:55 -0000
@@ -956,7 +956,10 @@
(cf MIPS). */
extern struct type *builtin_type_bfd_vma;
-/* Explicit sizes - see C9X <intypes.h> for naming scheme */
+/* Explicit sizes - see C9X <intypes.h> for naming scheme. The "int0"
+ is for when an architecture needs to describe a register that has
+ no size. */
+extern struct type *builtin_type_int0;
extern struct type *builtin_type_int8;
extern struct type *builtin_type_uint8;
extern struct type *builtin_type_int16;
Index: rs6000-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/rs6000-tdep.c,v
retrieving revision 1.145
diff -u -r1.145 rs6000-tdep.c
--- rs6000-tdep.c 16 Jun 2003 16:47:42 -0000 1.145
+++ rs6000-tdep.c 21 Jun 2003 01:04:58 -0000
@@ -1894,6 +1894,10 @@
int size = regsize (reg, tdep->wordsize);
switch (size)
{
+ case 0:
+ return builtin_type_int0;
+ case 4:
+ return builtin_type_int32;
case 8:
if (tdep->ppc_ev0_regnum <= n && n <= tdep->ppc_ev31_regnum)
return builtin_type_vec64;
@@ -1904,8 +1908,8 @@
return builtin_type_vec128;
break;
default:
- return builtin_type_int32;
- break;
+ internal_error (__FILE__, __LINE__, "Register %d size %d unknown",
+ n, size);
}
}
}
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [rfa:ppc] Make empty registers empty
2003-06-21 1:31 [rfa:ppc] Make empty registers empty Andrew Cagney
@ 2003-06-23 19:50 ` Kevin Buettner
2003-06-23 21:39 ` Andrew Cagney
0 siblings, 1 reply; 3+ messages in thread
From: Kevin Buettner @ 2003-06-23 19:50 UTC (permalink / raw)
To: Andrew Cagney, gdb-patches
On Jun 20, 9:30pm, Andrew Cagney wrote:
> Ok? GDB 6 branch?
>
> 2003-06-20 Andrew Cagney <cagney@redhat.com>
>
> * rs6000-tdep.c (rs6000_register_virtual_type): Add explict cases
> for 0 "int0" and 4 "int32" sized registers.
Okay. (Branch too, if you want.)
Kevin
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [rfa:ppc] Make empty registers empty
2003-06-23 19:50 ` Kevin Buettner
@ 2003-06-23 21:39 ` Andrew Cagney
0 siblings, 0 replies; 3+ messages in thread
From: Andrew Cagney @ 2003-06-23 21:39 UTC (permalink / raw)
To: Kevin Buettner; +Cc: gdb-patches
> On Jun 20, 9:30pm, Andrew Cagney wrote:
>
>
>> Ok? GDB 6 branch?
>>
>> 2003-06-20 Andrew Cagney <cagney@redhat.com>
>>
>> * rs6000-tdep.c (rs6000_register_virtual_type): Add explict cases
>> for 0 "int0" and 4 "int32" sized registers.
>
>
> Okay. (Branch too, if you want.)
Done, and Done.
tks, Andrew
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2003-06-23 21:39 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-06-21 1:31 [rfa:ppc] Make empty registers empty Andrew Cagney
2003-06-23 19:50 ` Kevin Buettner
2003-06-23 21:39 ` Andrew Cagney
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox