summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbde <bde@FreeBSD.org>1998-05-12 16:49:13 +0000
committerbde <bde@FreeBSD.org>1998-05-12 16:49:13 +0000
commit400020b8c9bd026bcc630e4377ad85dbe96ac57a (patch)
treec937f5128327ae1218114eca1e94a3bd91c08f63
parentcf33162fa63c2bb11e908cc0d96fa52619e60bc8 (diff)
downloadFreeBSD-src-400020b8c9bd026bcc630e4377ad85dbe96ac57a.zip
FreeBSD-src-400020b8c9bd026bcc630e4377ad85dbe96ac57a.tar.gz
Don't attempt to read process context from the kernel when (the
kernel's) curproc is null. This fixes endless recursion in xfer_umem() for attempts to read from user addresses, in particular for attempts to read %fs and %gs from the pcb for `info reg'.
-rw-r--r--gnu/usr.bin/binutils/gdb/i386/kvm-fbsd.c4
-rw-r--r--gnu/usr.bin/binutils/gdb/kvm-fbsd.c4
-rw-r--r--gnu/usr.bin/gdb/gdb/kvm-fbsd.c4
3 files changed, 6 insertions, 6 deletions
diff --git a/gnu/usr.bin/binutils/gdb/i386/kvm-fbsd.c b/gnu/usr.bin/binutils/gdb/i386/kvm-fbsd.c
index 1f75dbe..eca0f70 100644
--- a/gnu/usr.bin/binutils/gdb/i386/kvm-fbsd.c
+++ b/gnu/usr.bin/binutils/gdb/i386/kvm-fbsd.c
@@ -361,7 +361,7 @@ get_kcore_registers (regno)
struct user *uaddr;
/* find the pcb for the current process */
- if (kvread (&cur_proc->p_addr, &uaddr))
+ if (cur_proc == NULL || kvread (&cur_proc->p_addr, &uaddr))
error ("cannot read u area ptr for proc at %#x", cur_proc);
if (read_pcb (core_kd, (CORE_ADDR)&uaddr->u_pcb) < 0)
error ("cannot read pcb at %#x", &uaddr->u_pcb);
@@ -418,7 +418,7 @@ xfer_umem (memaddr, myaddr, len, write)
int n;
struct proc proc;
- if (kvread (cur_proc, &proc))
+ if (cur_proc == NULL || kvread (cur_proc, &proc))
error ("cannot read proc at %#x", cur_proc);
n = kvm_uread (core_kd, &proc, memaddr, myaddr, len) ;
diff --git a/gnu/usr.bin/binutils/gdb/kvm-fbsd.c b/gnu/usr.bin/binutils/gdb/kvm-fbsd.c
index 1f75dbe..eca0f70 100644
--- a/gnu/usr.bin/binutils/gdb/kvm-fbsd.c
+++ b/gnu/usr.bin/binutils/gdb/kvm-fbsd.c
@@ -361,7 +361,7 @@ get_kcore_registers (regno)
struct user *uaddr;
/* find the pcb for the current process */
- if (kvread (&cur_proc->p_addr, &uaddr))
+ if (cur_proc == NULL || kvread (&cur_proc->p_addr, &uaddr))
error ("cannot read u area ptr for proc at %#x", cur_proc);
if (read_pcb (core_kd, (CORE_ADDR)&uaddr->u_pcb) < 0)
error ("cannot read pcb at %#x", &uaddr->u_pcb);
@@ -418,7 +418,7 @@ xfer_umem (memaddr, myaddr, len, write)
int n;
struct proc proc;
- if (kvread (cur_proc, &proc))
+ if (cur_proc == NULL || kvread (cur_proc, &proc))
error ("cannot read proc at %#x", cur_proc);
n = kvm_uread (core_kd, &proc, memaddr, myaddr, len) ;
diff --git a/gnu/usr.bin/gdb/gdb/kvm-fbsd.c b/gnu/usr.bin/gdb/gdb/kvm-fbsd.c
index 1f75dbe..eca0f70 100644
--- a/gnu/usr.bin/gdb/gdb/kvm-fbsd.c
+++ b/gnu/usr.bin/gdb/gdb/kvm-fbsd.c
@@ -361,7 +361,7 @@ get_kcore_registers (regno)
struct user *uaddr;
/* find the pcb for the current process */
- if (kvread (&cur_proc->p_addr, &uaddr))
+ if (cur_proc == NULL || kvread (&cur_proc->p_addr, &uaddr))
error ("cannot read u area ptr for proc at %#x", cur_proc);
if (read_pcb (core_kd, (CORE_ADDR)&uaddr->u_pcb) < 0)
error ("cannot read pcb at %#x", &uaddr->u_pcb);
@@ -418,7 +418,7 @@ xfer_umem (memaddr, myaddr, len, write)
int n;
struct proc proc;
- if (kvread (cur_proc, &proc))
+ if (cur_proc == NULL || kvread (cur_proc, &proc))
error ("cannot read proc at %#x", cur_proc);
n = kvm_uread (core_kd, &proc, memaddr, myaddr, len) ;
OpenPOWER on IntegriCloud