diff options
author | Mark Kettenis <kettenis@gnu.org> | 2005-05-16 16:36:24 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@gnu.org> | 2005-05-16 16:36:24 +0000 |
commit | 961cb7b5ccf3306779af52da20094a2bac8030c6 (patch) | |
tree | 6d5c8b462c46849cd967c027158202367f79e62a /gdb/bsd-kvm.c | |
parent | d01e66a5389d9003c549a1836010b35e78d65c7e (diff) | |
download | gdb-961cb7b5ccf3306779af52da20094a2bac8030c6.zip gdb-961cb7b5ccf3306779af52da20094a2bac8030c6.tar.gz gdb-961cb7b5ccf3306779af52da20094a2bac8030c6.tar.bz2 |
* corelow.c (core_xfer_partial): Change type of readbuf and
writebuf to `gdb_byte *'.
* sparc-nat.c (sparc_xfer_wcookie, sparc_xfer_partial): Change
type of readbuf and writebuf to `gdb_byte *'.
* bsd-uthread.c (bsd_uthread_xfer_partial): Change type of readbuf
and writebuf to `gdb_byte *'.
* inf-ptrace.c (inf_ptrace_xfer_partial): Change type of readbuf
and writebuf to `gdb_byte *'.
* bsd-kvm.c (bsd_kvm_xfer_memory): Replace.
(bsd_kvm_xfer_partial): New function.
(bsd_kvm_add_target): Set to_xfer_partial instead of
to_xfer_memory.
* bfd-target.c (target_bfd_xfer_partial): Change type of readbuf
and writebuf to `gdb_byte *'.
* target.c (deprecated_debug_xfer_memory): Remove prototype.
(deprecated_debug_xfer_memory): Change type of second argument to
`gdb_byte *'.
* remote.c (remote_xfer_memory): Remove prototype.
(remote_xfer_memory): Change type of second argument to `gdb_byte
*'.
(remote_xfer_partial): Change type of readbuf and writebuf to
`gdb_byte *'.
Diffstat (limited to 'gdb/bsd-kvm.c')
-rw-r--r-- | gdb/bsd-kvm.c | 38 |
1 files changed, 27 insertions, 11 deletions
diff --git a/gdb/bsd-kvm.c b/gdb/bsd-kvm.c index e9636a5..db60052e 100644 --- a/gdb/bsd-kvm.c +++ b/gdb/bsd-kvm.c @@ -1,6 +1,6 @@ /* BSD Kernel Data Access Library (libkvm) interface. - Copyright 2004 Free Software Foundation, Inc. + Copyright 2004, 2005 Free Software Foundation, Inc. This file is part of GDB. @@ -103,17 +103,33 @@ bsd_kvm_close (int quitting) } } -static int -bsd_kvm_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, - int write, struct mem_attrib *attrib, - struct target_ops *ops) +static LONGEST +bsd_kvm_xfer_memory (CORE_ADDR addr, ULONGEST len, + gdb_byte *readbuf, const gdb_byte *writebuf) { - if (write) - return kvm_write (core_kd, memaddr, myaddr, len); - else - return kvm_read (core_kd, memaddr, myaddr, len); + ssize_t nbytes = len; + + if (readbuf) + nbytes = kvm_read (core_kd, addr, readbuf, nbytes); + if (writebuf && nbytes > 0) + nbytes = kvm_write (core_kd, addr, writebuf, nbytes); + return nbytes; +} - return -1; +static LONGEST +bsd_kvm_xfer_partial (struct target_ops *ops, enum target_object object, + const char *annex, gdb_byte *readbuf, + const gdb_byte *writebuf, + ULONGEST offset, LONGEST len) +{ + switch (object) + { + case TARGET_OBJECT_MEMORY: + return bsd_kvm_xfer_memory (offset, len, readbuf, writebuf); + + default: + return -1; + } } /* Fetch process control block at address PADDR. */ @@ -287,7 +303,7 @@ Optionally specify the filename of a core dump."); bsd_kvm_ops.to_open = bsd_kvm_open; bsd_kvm_ops.to_close = bsd_kvm_close; bsd_kvm_ops.to_fetch_registers = bsd_kvm_fetch_registers; - bsd_kvm_ops.deprecated_xfer_memory = bsd_kvm_xfer_memory; + bsd_kvm_ops.to_xfer_partial = bsd_kvm_xfer_partial; bsd_kvm_ops.to_stratum = process_stratum; bsd_kvm_ops.to_has_memory = 1; bsd_kvm_ops.to_has_stack = 1; |