This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[PATCH] Some BSD libkvm interface fixes
- From: Mark Kettenis <kettenis at chello dot nl>
- To: gdb-patches at sources dot redhat dot com
- Date: Sun, 27 Jun 2004 17:56:23 +0200 (CEST)
- Subject: [PATCH] Some BSD libkvm interface fixes
This makes "target kvm" actually working on FreeBSD 5.x.
Committed,
Mark
Index: ChangeLog
from Mark Kettenis <kettenis@gnu.org>
* bsd-kvm.c (bsd_kvm_fetch_registers): Directly return after
fetching from BSD_KVM_PADDR. Correctly lookup address for
"_thread0".
Index: bsd-kvm.c
===================================================================
RCS file: /cvs/src/src/gdb/bsd-kvm.c,v
retrieving revision 1.1
diff -u -p -r1.1 bsd-kvm.c
--- bsd-kvm.c 22 May 2004 17:21:35 -0000 1.1
+++ bsd-kvm.c 27 Jun 2004 15:54:50 -0000
@@ -128,7 +128,10 @@ bsd_kvm_fetch_registers (int regnum)
struct nlist nl[2];
if (bsd_kvm_paddr)
- bsd_kvm_fetch_pcb (bsd_kvm_paddr);
+ {
+ bsd_kvm_fetch_pcb (bsd_kvm_paddr);
+ return;
+ }
/* On dumping core, BSD kernels store the faulting context (PCB)
in the variable "dumppcb". */
@@ -185,8 +188,8 @@ bsd_kvm_fetch_registers (int regnum)
struct pcb *paddr;
/* Found thread0. */
- nl[1].n_value += offsetof (struct thread, td_pcb);
- if (kvm_read (core_kd, nl[1].n_value, &paddr, sizeof paddr) == -1)
+ nl[0].n_value += offsetof (struct thread, td_pcb);
+ if (kvm_read (core_kd, nl[0].n_value, &paddr, sizeof paddr) == -1)
error ("%s", kvm_geterr (core_kd));
bsd_kvm_fetch_pcb (paddr);