diff options
author | Mark Kettenis <kettenis@gnu.org> | 2002-11-08 23:48:38 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@gnu.org> | 2002-11-08 23:48:38 +0000 |
commit | 371a6e84e5b12ed0c971ec604cfe60b8e978372c (patch) | |
tree | e0fbdf51e3a0c053d1c7cf4edca13a4f7489ab09 /gdb | |
parent | 94ba925ab94e45314d60f194da98418f08149eed (diff) | |
download | gdb-371a6e84e5b12ed0c971ec604cfe60b8e978372c.zip gdb-371a6e84e5b12ed0c971ec604cfe60b8e978372c.tar.gz gdb-371a6e84e5b12ed0c971ec604cfe60b8e978372c.tar.bz2 |
* infptrace.c (child_xfer_memory): Make use of the new PT_IO
request that's available in *BSD.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 3 | ||||
-rw-r--r-- | gdb/infptrace.c | 31 |
2 files changed, 34 insertions, 0 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index f63f78a..8f8ad2c 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,8 @@ 2002-11-09 Mark Kettenis <kettenis@gnu.org> + * infptrace.c (child_xfer_memory): Make use of the new PT_IO + request that's available in *BSD. + * i386-tdep.h (IS_FPU_CTRL_REGNUM): Remove. * i387-tdep.c (i387_fill_fxsave): Use FOOFF_REGNUM instead of diff --git a/gdb/infptrace.c b/gdb/infptrace.c index 777a5b4..601e157 100644 --- a/gdb/infptrace.c +++ b/gdb/infptrace.c @@ -514,6 +514,37 @@ child_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write, PTRACE_XFER_TYPE *buffer; struct cleanup *old_chain = NULL; +#ifdef PT_IO + /* OpenBSD 3.1, NetBSD 1.6 and FreeBSD 5.0 have a new PT_IO request + that promises to be much more efficient in reading and writing + data in the traced process's address space. */ + + { + struct ptrace_io_desc piod; + + /* NOTE: We assume that there are no distinct address spaces for + instruction and data. */ + piod.piod_op = write ? PIOD_WRITE_D : PIOD_READ_D; + piod.piod_offs = (void *) memaddr; + piod.piod_addr = myaddr; + piod.piod_len = len; + + if (ptrace (PT_IO, PIDGET (inferior_ptid), (caddr_t) &piod, 0) == -1) + { + /* If the PT_IO request is somehow not supported, fallback on + using PT_WRITE_D/PT_READ_D. Otherwise we will return zero + to indicate failure. */ + if (errno != EINVAL) + return 0; + } + else + { + /* Return the actual number of bytes read or written. */ + return piod.piod_len; + } + } +#endif + /* Allocate buffer of that many longwords. */ if (len < GDB_MAX_ALLOCA) { |