diff options
author | Michael Snyder <msnyder@specifix.com> | 2002-01-08 00:59:31 +0000 |
---|---|---|
committer | Michael Snyder <msnyder@specifix.com> | 2002-01-08 00:59:31 +0000 |
commit | d2d19e0f0d5086a7845472431a6a2c5155fe544f (patch) | |
tree | 0d2b7dc23916ea888d9b2313e73667dfec5f9d7f /gdb/x86-64-linux-nat.c | |
parent | 27c66d34633b4aa3870da2539919624763dd561b (diff) | |
download | gdb-d2d19e0f0d5086a7845472431a6a2c5155fe544f.tar.gz |
2002-01-07 Michael Snyder <msnyder@redhat.com>
* infptrace.c (GDB_MAX_ALLOCA): New define.
(child_xfer_memory): Use xmalloc/xfree instead of alloca if the
size of the buffer exceeds GDB_MAX_ALLOCA (default 1 megabyte,
can be overridden with whatever value is appropriate to the host).
* infttrace.c (child_xfer_memory): Add FIXME warning about use of
alloca to allocate potentially large buffer.
* rs6000-nat.c (child_xfer_memory): Ditto.
* symm-nat.c (child_xfer_memory): Ditto.
* x86-64-linux-nat.c (child_xfer_memory): Ditto.
Diffstat (limited to 'gdb/x86-64-linux-nat.c')
-rw-r--r-- | gdb/x86-64-linux-nat.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/gdb/x86-64-linux-nat.c b/gdb/x86-64-linux-nat.c index 268aad583bb..85912e81380 100644 --- a/gdb/x86-64-linux-nat.c +++ b/gdb/x86-64-linux-nat.c @@ -147,8 +147,7 @@ fill_gregset (elf_gregset_t * gregsetp, int regno) for (i = 0; i < X86_64_NUM_GREGS; i++) if ((regno == -1 || regno == i)) - *(regp + x86_64_regmap[i]) = - *(elf_greg_t *) & registers[REGISTER_BYTE (i)]; + read_register_gen (i, regp + x86_64_regmap[i]); } /* Fetch all general-purpose registers from process/thread TID and @@ -417,6 +416,9 @@ child_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write, = (((memaddr + len) - addr) + sizeof (PTRACE_XFER_TYPE) - 1) / sizeof (PTRACE_XFER_TYPE); /* Allocate buffer of that many longwords. */ + /* FIXME (alloca): This code, cloned from infptrace.c, is unsafe + because it uses alloca to allocate a buffer of arbitrary size. + For very large xfers, this could crash GDB's stack. */ register PTRACE_XFER_TYPE *buffer = (PTRACE_XFER_TYPE *) alloca (count * sizeof (PTRACE_XFER_TYPE)); |