summaryrefslogtreecommitdiffstats
path: root/gnu/usr.bin/gdb
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/usr.bin/gdb')
-rw-r--r--gnu/usr.bin/gdb/gdb/kvm-fbsd.c33
1 files changed, 21 insertions, 12 deletions
diff --git a/gnu/usr.bin/gdb/gdb/kvm-fbsd.c b/gnu/usr.bin/gdb/gdb/kvm-fbsd.c
index 970d3a8..3c869f2 100644
--- a/gnu/usr.bin/gdb/gdb/kvm-fbsd.c
+++ b/gnu/usr.bin/gdb/gdb/kvm-fbsd.c
@@ -382,21 +382,30 @@ kcore_xfer_kmem (memaddr, myaddr, len, write, target)
int write;
struct target_ops *target;
{
- int n;
-
- if (!memaddr)
- return (0);
+ int ns;
+ int nu;
- if (memaddr < kernel_start)
- return xfer_umem (memaddr, myaddr, len, write);
+ if (memaddr >= (CORE_ADDR)VM_MAXUSER_ADDRESS)
+ nu = 0;
+ else
+ {
+ nu = xfer_umem (memaddr, myaddr, len, write);
+ if (nu <= 0)
+ return (0);
+ if (nu == len)
+ return (nu);
+ memaddr += nu;
+ if (memaddr != (CORE_ADDR)VM_MAXUSER_ADDRESS)
+ return (nu);
+ myaddr += nu;
+ len -= nu;
+ }
- n = write ?
- kvm_write (core_kd, memaddr, myaddr, len) :
- kvm_read (core_kd, memaddr, myaddr, len) ;
+ ns = (write ? kvm_write : kvm_read) (core_kd, memaddr, myaddr, len);
+ if (ns < 0)
+ ns = 0;
- if (n < 0)
- return 0;
- return n;
+ return (nu + ns);
}
static int
OpenPOWER on IntegriCloud