summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Arnez <arnez@linux.vnet.ibm.com>2015-01-15 10:20:45 +0000
committerUlrich Weigand <ulrich.weigand@de.ibm.com>2015-02-04 14:14:32 +0100
commitf962539ad23759af4ba8f7eece1946fdc2f50876 (patch)
tree8df3eaef5b889514933cce7c6b98564c48e003e3
parentdde9acd693251ccbe28d2d9c6c8b3cdc8ca884ed (diff)
downloadbinutils-gdb-f962539ad23759af4ba8f7eece1946fdc2f50876.tar.gz
Warn if core file register section is larger than expected
When reading a core file register section which is larger than expected, emit a warning. Assume that a register section usually has exactly the size specified by the regset section iterator. In some special cases this assumption is wrong, or at least does not match the regset supply function's logic. Thus also add a way to suppress the warning in those cases, using a new flag REGSET_VARIABLE_SIZE. gdb/ChangeLog: * regset.h (struct regset): Add flags field. (REGSET_VARIABLE_SIZE): New value for a regset's flags field. * corelow.c (get_core_register_section): Add warning if the size exceeds the requested size and the regset does not have the REGSET_VARIABLE_SIZE flag set. * alphanbsd-tdep.c (alphanbsd_gregset): Add REGSET_VARIABLE_SIZE flag. * armbsd-tdep.c (armbsd_gregset): Likewise. * hppa-hpux-tdep.c (hppa_hpux_regset): Likewise. * hppaobsd-tdep.c (hppaobsd_gregset): Likewise. * m68kbsd-tdep.c (m68kbsd_gregset): Likewise. * mipsnbsd-tdep.c (mipsnbsd_gregset): Likewise.
-rw-r--r--gdb/ChangeLog15
-rw-r--r--gdb/alphanbsd-tdep.c4
-rw-r--r--gdb/armbsd-tdep.c4
-rw-r--r--gdb/corelow.c5
-rw-r--r--gdb/hppa-hpux-tdep.c4
-rw-r--r--gdb/hppaobsd-tdep.c4
-rw-r--r--gdb/m68kbsd-tdep.c4
-rw-r--r--gdb/mipsnbsd-tdep.c4
-rw-r--r--gdb/regset.h7
9 files changed, 45 insertions, 6 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 822d0d40bc8..6250534b6b1 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,20 @@
2015-02-04 Andreas Arnez <arnez@linux.vnet.ibm.com>
+ * regset.h (struct regset): Add flags field.
+ (REGSET_VARIABLE_SIZE): New value for a regset's flags field.
+ * corelow.c (get_core_register_section): Add warning if the size
+ exceeds the requested size and the regset does not have the
+ REGSET_VARIABLE_SIZE flag set.
+ * alphanbsd-tdep.c (alphanbsd_gregset): Add REGSET_VARIABLE_SIZE
+ flag.
+ * armbsd-tdep.c (armbsd_gregset): Likewise.
+ * hppa-hpux-tdep.c (hppa_hpux_regset): Likewise.
+ * hppaobsd-tdep.c (hppaobsd_gregset): Likewise.
+ * m68kbsd-tdep.c (m68kbsd_gregset): Likewise.
+ * mipsnbsd-tdep.c (mipsnbsd_gregset): Likewise.
+
+2015-02-04 Andreas Arnez <arnez@linux.vnet.ibm.com>
+
* amd64-linux-tdep.c (amd64_linux_iterate_over_regset_sections):
For ".reg-xstate", explicitly specify the requested section size
via X86_XSTATE_SIZE instead of just 0 on input and
diff --git a/gdb/alphanbsd-tdep.c b/gdb/alphanbsd-tdep.c
index 6b13fad5ad4..69be265693c 100644
--- a/gdb/alphanbsd-tdep.c
+++ b/gdb/alphanbsd-tdep.c
@@ -145,7 +145,9 @@ alphanbsd_supply_gregset (const struct regset *regset,
static const struct regset alphanbsd_gregset =
{
NULL,
- alphanbsd_supply_gregset
+ alphanbsd_supply_gregset,
+ NULL,
+ REGSET_VARIABLE_SIZE
};
static const struct regset alphanbsd_fpregset =
diff --git a/gdb/armbsd-tdep.c b/gdb/armbsd-tdep.c
index 7923cadd101..c043b514273 100644
--- a/gdb/armbsd-tdep.c
+++ b/gdb/armbsd-tdep.c
@@ -98,7 +98,9 @@ armbsd_supply_gregset (const struct regset *regset,
static const struct regset armbsd_gregset =
{
NULL,
- armbsd_supply_gregset
+ armbsd_supply_gregset,
+ NULL,
+ REGSET_VARIABLE_SIZE
};
static const struct regset armbsd_fpregset =
diff --git a/gdb/corelow.c b/gdb/corelow.c
index 6a67a989f58..c7d4318e001 100644
--- a/gdb/corelow.c
+++ b/gdb/corelow.c
@@ -536,6 +536,11 @@ get_core_register_section (struct regcache *regcache,
warning (_("Section `%s' in core file too small."), section_name);
return;
}
+ if (size != min_size && !(regset->flags & REGSET_VARIABLE_SIZE))
+ {
+ warning (_("Unexpected size of section `%s' in core file."),
+ section_name);
+ }
contents = alloca (size);
if (! bfd_get_section_contents (core_bfd, section, contents,
diff --git a/gdb/hppa-hpux-tdep.c b/gdb/hppa-hpux-tdep.c
index 0c8575d597b..3c0f3909fdc 100644
--- a/gdb/hppa-hpux-tdep.c
+++ b/gdb/hppa-hpux-tdep.c
@@ -1367,7 +1367,9 @@ hppa_hpux_supply_save_state (const struct regset *regset,
static const struct regset hppa_hpux_regset =
{
NULL,
- hppa_hpux_supply_save_state
+ hppa_hpux_supply_save_state,
+ NULL,
+ REGSET_VARIABLE_SIZE
};
static void
diff --git a/gdb/hppaobsd-tdep.c b/gdb/hppaobsd-tdep.c
index 9ec7fdff81d..c9bc1bf7a91 100644
--- a/gdb/hppaobsd-tdep.c
+++ b/gdb/hppaobsd-tdep.c
@@ -131,7 +131,9 @@ hppaobsd_supply_fpregset (const struct regset *regset,
static const struct regset hppaobsd_gregset =
{
NULL,
- hppaobsd_supply_gregset
+ hppaobsd_supply_gregset,
+ NULL,
+ REGSET_VARIABLE_SIZE
};
static const struct regset hppaobsd_fpregset =
diff --git a/gdb/m68kbsd-tdep.c b/gdb/m68kbsd-tdep.c
index b1ae4c1acee..ae0cecf2d89 100644
--- a/gdb/m68kbsd-tdep.c
+++ b/gdb/m68kbsd-tdep.c
@@ -105,7 +105,9 @@ m68kbsd_supply_gregset (const struct regset *regset,
static const struct regset m68kbsd_gregset =
{
NULL,
- m68kbsd_supply_gregset
+ m68kbsd_supply_gregset,
+ NULL,
+ REGSET_VARIABLE_SIZE
};
static const struct regset m68kbsd_fpregset =
diff --git a/gdb/mipsnbsd-tdep.c b/gdb/mipsnbsd-tdep.c
index ee68f3df447..d15c88c602a 100644
--- a/gdb/mipsnbsd-tdep.c
+++ b/gdb/mipsnbsd-tdep.c
@@ -103,7 +103,9 @@ mipsnbsd_supply_gregset (const struct regset *regset,
static const struct regset mipsnbsd_gregset =
{
NULL,
- mipsnbsd_supply_gregset
+ mipsnbsd_supply_gregset,
+ NULL,
+ REGSET_VARIABLE_SIZE
};
static const struct regset mipsnbsd_fpregset =
diff --git a/gdb/regset.h b/gdb/regset.h
index 35853223a80..d6edaa5cd29 100644
--- a/gdb/regset.h
+++ b/gdb/regset.h
@@ -43,6 +43,13 @@ struct regset
/* Function collecting values in a register set from a register cache. */
collect_regset_ftype *collect_regset;
+
+ unsigned flags;
};
+/* Values for a regset's 'flags' field. */
+
+#define REGSET_VARIABLE_SIZE 1 /* Accept a larger regset section size
+ in a core file without warning. */
+
#endif /* regset.h */