aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/gdbserver/ChangeLog10
-rw-r--r--gdb/gdbserver/linux-low.c39
-rw-r--r--gdb/gdbserver/linux-low.h4
3 files changed, 39 insertions, 14 deletions
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog
index 169bb53..f3e47a8 100644
--- a/gdb/gdbserver/ChangeLog
+++ b/gdb/gdbserver/ChangeLog
@@ -1,5 +1,15 @@
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
xmalloc.
diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c
index 2114b07..bb7298a 100644
--- a/gdb/gdbserver/linux-low.c
+++ b/gdb/gdbserver/linux-low.c
@@ -4051,6 +4051,28 @@ unstop_all_lwps (int unsuspend, struct lwp_info *except)
#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)
@@ -4068,8 +4090,7 @@ regsets_fetch_inferior_registers (struct regsets_info *regsets_info,
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;
@@ -4097,12 +4118,9 @@ regsets_fetch_inferior_registers (struct regsets_info *regsets_info,
{
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;
}
@@ -4143,8 +4161,7 @@ regsets_store_inferior_registers (struct regsets_info *regsets_info,
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;
@@ -4191,12 +4208,9 @@ regsets_store_inferior_registers (struct regsets_info *regsets_info,
{
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;
}
@@ -6072,7 +6086,6 @@ initialize_regsets_info (struct regsets_info *info)
info->regsets[info->num_regsets].size >= 0;
info->num_regsets++)
;
- info->disabled_regsets = xcalloc (1, info->num_regsets);
}
#endif
diff --git a/gdb/gdbserver/linux-low.h b/gdb/gdbserver/linux-low.h
index bce0288..a8de378 100644
--- a/gdb/gdbserver/linux-low.h
+++ b/gdb/gdbserver/linux-low.h
@@ -60,7 +60,9 @@ struct regsets_info
/* 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;
};