+2013-06-11 Pedro Alves <palves@redhat.com>
+
+ * linux-low.c (regset_disabled, disable_regset): New functions.
+ (regsets_fetch_inferior_registers)
+ (regsets_store_inferior_registers): Use them.
+ (initialize_regsets_info); Don't allocate the disabled_regsets
+ array here.
+ * linux-low.h (struct regsets_info) <disabled_regsets>: Extend
+ comment.
+
2013-06-11 Pedro Alves <palves@redhat.com>
* linux-low.c (initialize_regsets_info): Use xcalloc instead of
#define use_linux_regsets 1
+/* Returns true if REGSET has been disabled. */
+
+static int
+regset_disabled (struct regsets_info *info, struct regset_info *regset)
+{
+ return (info->disabled_regsets != NULL
+ && info->disabled_regsets[regset - info->regsets]);
+}
+
+/* Disable REGSET. */
+
+static void
+disable_regset (struct regsets_info *info, struct regset_info *regset)
+{
+ int dr_offset;
+
+ dr_offset = regset - info->regsets;
+ if (info->disabled_regsets == NULL)
+ info->disabled_regsets = xcalloc (1, info->num_regsets);
+ info->disabled_regsets[dr_offset] = 1;
+}
+
static int
regsets_fetch_inferior_registers (struct regsets_info *regsets_info,
struct regcache *regcache)
void *buf, *data;
int nt_type, res;
- if (regset->size == 0
- || regsets_info->disabled_regsets[regset - regsets_info->regsets])
+ if (regset->size == 0 || regset_disabled (regsets_info, regset))
{
regset ++;
continue;
{
if (errno == EIO)
{
- int dr_offset;
-
/* If we get EIO on a regset, do not try it again for
this process mode. */
- dr_offset = regset - regsets_info->regsets;
- regsets_info->disabled_regsets[dr_offset] = 1;
+ disable_regset (regsets_info, regset);
free (buf);
continue;
}
void *buf, *data;
int nt_type, res;
- if (regset->size == 0
- || regsets_info->disabled_regsets[regset - regsets_info->regsets])
+ if (regset->size == 0 || regset_disabled (regsets_info, regset))
{
regset ++;
continue;
{
if (errno == EIO)
{
- int dr_offset;
-
/* If we get EIO on a regset, do not try it again for
this process mode. */
- dr_offset = regset - regsets_info->regsets;
- regsets_info->disabled_regsets[dr_offset] = 1;
+ disable_regset (regsets_info, regset);
free (buf);
continue;
}
info->regsets[info->num_regsets].size >= 0;
info->num_regsets++)
;
- info->disabled_regsets = xcalloc (1, info->num_regsets);
}
#endif
/* If we get EIO on a regset, do not try it again. Note the set of
supported regsets may depend on processor mode on biarch
- machines. */
+ machines. This is a (lazily allocated) array holding one boolean
+ byte (0/1) per regset, with each element corresponding to the
+ regset in the REGSETS array above at the same offset. */
char *disabled_regsets;
};