@@ -4263,6 +4263,14 @@ regsets_fetch_inferior_registers (struct regsets_info *regsets_info,
free (buf);
continue;
}
+ else if (errno == ENODATA)
+ {
+ /* ENODATA may be returned if the regset is currently
+ not "active". Provide a zeroed buffer and assume
+ that the store_function deals with this
+ appropriately. */
+ memset (buf, 0, regset->size);
+ }
else
{
char s[256];
@@ -4300,7 +4308,8 @@ regsets_store_inferior_registers (struct regsets_info *regsets_info,
void *buf, *data;
int nt_type, res;
- if (regset->size == 0 || regset_disabled (regsets_info, regset))
+ if (regset->size == 0 || regset_disabled (regsets_info, regset)
+ || regset->fill_function == NULL)
{
regset ++;
continue;
@@ -290,12 +290,6 @@ s390_fill_gregset (struct regcache *regcache, void *buf)
/* Fill and store functions for extended register sets. */
static void
-s390_fill_last_break (struct regcache *regcache, void *buf)
-{
- /* Last break address is read-only. */
-}
-
-static void
s390_store_last_break (struct regcache *regcache, const void *buf)
{
const char *p;
@@ -316,13 +310,44 @@ s390_store_system_call (struct regcache *regcache, const void *buf)
supply_register_by_name (regcache, "system_call", buf);
}
+static void
+s390_store_tdb (struct regcache *regcache, const void *buf)
+{
+ int tdb0 = find_regno (regcache->tdesc, "tdb0");
+ int tr0 = find_regno (regcache->tdesc, "tr0");
+ int i;
+
+ if (*(const unsigned char *) buf != 0x01)
+ {
+ /* Invalid/unrecognized TDB format. Invalidate. */
+ for (i = 0; i < 4; i++)
+ supply_register (regcache, tdb0 + i, NULL);
+
+ for (i = 0; i < 16; i++)
+ supply_register (regcache, tr0 + i, NULL);
+
+ return;
+ }
+
+ for (i = 0; i < 4; i++)
+ supply_register (regcache, tdb0 + i,
+ (const char *) buf + 8 * i);
+
+ for (i = 0; i < 16; i++)
+ supply_register (regcache, tr0 + i,
+ (const char *) buf + 8 * (16 + i));
+}
+
static struct regset_info s390_regsets[] = {
{ 0, 0, 0, 0, GENERAL_REGS, s390_fill_gregset, NULL },
- /* Last break address is read-only; do not attempt PTRACE_SETREGSET. */
- { PTRACE_GETREGSET, PTRACE_GETREGSET, NT_S390_LAST_BREAK, 0,
- EXTENDED_REGS, s390_fill_last_break, s390_store_last_break },
+ /* Last break address is read-only; no fill function. */
+ { PTRACE_GETREGSET, -1, NT_S390_LAST_BREAK, 0, EXTENDED_REGS,
+ NULL, s390_store_last_break },
{ PTRACE_GETREGSET, PTRACE_SETREGSET, NT_S390_SYSTEM_CALL, 0,
EXTENDED_REGS, s390_fill_system_call, s390_store_system_call },
+ /* TDB is read-only. */
+ { PTRACE_GETREGSET, -1, NT_S390_TDB, 0, EXTENDED_REGS,
+ NULL, s390_store_tdb },
{ 0, 0, 0, -1, -1, NULL, NULL }
};
@@ -485,7 +510,7 @@ s390_arch_setup (void)
#endif
/* Update target_regsets according to available register sets. */
- for (regset = s390_regsets; regset->fill_function != NULL; regset++)
+ for (regset = s390_regsets; regset->size >= 0; regset++)
if (regset->get_request == PTRACE_GETREGSET)
switch (regset->nt_type)
{