This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH v2 13/13] IA64 Linux: Define regset structures.


On Tue, Jul 15 2014, Ulrich Weigand wrote:

> Andreas Arnez wrote:
>
>> +static const struct regcache_map_entry ia64_linux_gregmap[] =
>> +  {
>> +    { 32, IA64_GR0_REGNUM },	/* r0 ... r31 */
>> +    { 8, REGCACHE_MAP_SKIP_BYTES }, /* FIXME: NAT collection bits? */
>> +    { 1, IA64_PR_REGNUM },
>> +    { 8, IA64_BR0_REGNUM },	/* b0 ... b7 */
>> +    { 1, IA64_IP_REGNUM },
>> +    { 1, IA64_CFM_REGNUM },
>> +    { 1, IA64_PSR_REGNUM },
>> +    { 1, IA64_RSC_REGNUM },
>> +    { 1, IA64_BSP_REGNUM },
>> +    { 1, IA64_BSPSTORE_REGNUM },
>> +    { 1, IA64_RNAT_REGNUM },
>> +    { 1, IA64_CCV_REGNUM },
>> +    { 1, IA64_UNAT_REGNUM },
>> +    { 1, IA64_FPSR_REGNUM },
>> +    { 1, IA64_PFS_REGNUM },
>> +    { 1, IA64_LC_REGNUM },
>> +    { 1, IA64_EC_REGNUM },
>> +    { 0 }
>> +  };
>> +
>> +#define IA64_LINUX_GREGS_SIZE (55 * 8)
>
> If I'm reading the kernel sources correctly, the core file note will actually
> contain 128 register slots.

Right... the comment to the definition of ELF_NREG says "we really need
just 72 but let's leave some headroom..."  In fact, GDB only uses 55
slots.  And the change would make GDB consistent in itself; that's why I
just declared 55 slots here.

However, an old GDB rejects a core file that doesn't have exactly 128
register slots.  Thus it certainly makes sense to increase this constant
to 128 * 8, such that users can write a core file with a new GDB and
read it with an old one.

OK, done.

>
>> +static const struct regcache_map_entry ia64_linux_fpregmap[] =
>> +  {
>> +    { 128, IA64_FR0_REGNUM },	/* f0 ... f127 */
>> +    { 0 }
>> +  };
>> +
>> +#define IA64_LINUX_FPREGS_SIZE (128 * 8)
>
> The size of one FP register should be 16 bytes, not 8.

Absolutely.  Fixed.

Incremental patch below.

--

diff --git a/gdb/ia64-linux-tdep.c b/gdb/ia64-linux-tdep.c
index 9989602..ff44d80 100644
--- a/gdb/ia64-linux-tdep.c
+++ b/gdb/ia64-linux-tdep.c
@@ -156,7 +156,10 @@ static const struct regcache_map_entry ia64_linux_gregmap[] =
     { 0 }
   };
 
-#define IA64_LINUX_GREGS_SIZE (55 * 8)
+/* Size of 'gregset_t', as defined by the Linux kernel.  Note that
+   this is more than actually mapped in the regmap above.  */
+
+#define IA64_LINUX_GREGS_SIZE (128 * 8)
 
 static const struct regcache_map_entry ia64_linux_fpregmap[] =
   {
@@ -164,7 +167,7 @@ static const struct regcache_map_entry ia64_linux_fpregmap[] =
     { 0 }
   };
 
-#define IA64_LINUX_FPREGS_SIZE (128 * 8)
+#define IA64_LINUX_FPREGS_SIZE (128 * 16)
 
 static void
 ia64_linux_supply_fpregset (const struct regset *regset,


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]