aboutsummaryrefslogtreecommitdiff
path: root/gdb/gdbarch.h
diff options
context:
space:
mode:
authorAndreas Arnez <arnez@linux.vnet.ibm.com>2015-01-14 12:01:38 +0000
committerUlrich Weigand <ulrich.weigand@de.ibm.com>2015-02-04 14:14:31 +0100
commit1528345d6c4a407e0b36b3474eb458cbd04146f7 (patch)
treee1fab52ee8539ddbec833fdd9256d67cbb468b92 /gdb/gdbarch.h
parent8962a307ae3dd59166a4a6dc4e60a4da880686cd (diff)
downloadgdb-1528345d6c4a407e0b36b3474eb458cbd04146f7.zip
gdb-1528345d6c4a407e0b36b3474eb458cbd04146f7.tar.gz
gdb-1528345d6c4a407e0b36b3474eb458cbd04146f7.tar.bz2
Fix internal error when core file section is too big
As reported in PR 17808, a test case with a forged (invalid) core file can crash GDB with an assertion failure. In that particular case the prstatus of an i386 core file looks like that from an AMD64 core file. Consequently the respective regset supply function i386_supply_gregset is invoked with a larger buffer than usual. But i386_supply_gregset asserts a specific buffer size, and this assertion fails. The patch relaxes all buffer size assertions in regset supply functions such that they merely check for a sufficiently large buffer. For consistency the regset collect functions are adjusted as well. gdb/ChangeLog: PR corefiles/17808: * gdbarch.sh (iterate_over_regset_sections_cb): Document this function type, particularly its SIZE parameter. * gdbarch.h: Regenerate. * amd64-tdep.c (amd64_supply_fpregset): In gdb_assert, compare actual against required size using ">=" instead of "==". (amd64_collect_fpregset): Likewise. * i386-tdep.c (i386_supply_gregset): Likewise. (i386_collect_gregset): Likewise. (i386_supply_fpregset): Likewise. (i386_collect_fpregset): Likewise. * mips-linux-tdep.c (mips_supply_gregset_wrapper): Likewise. (mips_fill_gregset_wrapper): Likewise. (mips_supply_fpregset_wrapper): Likewise. (mips_fill_fpregset_wrapper): Likewise. (mips64_supply_gregset_wrapper): Likewise. (mips64_fill_gregset_wrapper): Likewise. (mips64_supply_fpregset_wrapper): Likewise. (mips64_fill_fpregset_wrapper): Likewise. * mn10300-linux-tdep.c (am33_supply_gregset_method): Likewise. (am33_supply_fpregset_method): Likewise. (am33_collect_gregset_method): Likewise. (am33_collect_fpregset_method): Likewise.
Diffstat (limited to 'gdb/gdbarch.h')
-rw-r--r--gdb/gdbarch.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h
index b266530..b67d9f6 100644
--- a/gdb/gdbarch.h
+++ b/gdb/gdbarch.h
@@ -85,6 +85,12 @@ extern struct gdbarch *target_gdbarch (void);
typedef int (iterate_over_objfiles_in_search_order_cb_ftype)
(struct objfile *objfile, void *cb_data);
+/* Callback type for regset section iterators. The callback usually
+ invokes the REGSET's supply or collect method, to which it must
+ pass a buffer with at least the given SIZE. SECT_NAME is a BFD
+ section name, and HUMAN_NAME is used for diagnostic messages.
+ CB_DATA should have been passed unchanged through the iterator. */
+
typedef void (iterate_over_regset_sections_cb)
(const char *sect_name, int size, const struct regset *regset,
const char *human_name, void *cb_data);