| @@ -27,26 +27,27 @@ | | | @@ -27,26 +27,27 @@ |
27 | #include "value.h" | | 27 | #include "value.h" |
28 | #include "gdbcore.h" /* for get_exec_file */ | | 28 | #include "gdbcore.h" /* for get_exec_file */ |
29 | #include "gdbthread.h" | | 29 | #include "gdbthread.h" |
30 | | | 30 | |
31 | #include "gdb_assert.h" | | 31 | #include "gdb_assert.h" |
32 | #include <fcntl.h> | | 32 | #include <fcntl.h> |
33 | #include <kvm.h> | | 33 | #include <kvm.h> |
34 | #ifdef HAVE_NLIST_H | | 34 | #ifdef HAVE_NLIST_H |
35 | #include <nlist.h> | | 35 | #include <nlist.h> |
36 | #endif | | 36 | #endif |
37 | #include <paths.h> | | 37 | #include <paths.h> |
38 | #include "readline/readline.h" | | 38 | #include "readline/readline.h" |
39 | #include <sys/param.h> | | 39 | #include <sys/param.h> |
| | | 40 | #define _KMEMUSER |
40 | #include <sys/proc.h> | | 41 | #include <sys/proc.h> |
41 | #include <sys/user.h> | | 42 | #include <sys/user.h> |
42 | | | 43 | |
43 | #include "bsd-kvm.h" | | 44 | #include "bsd-kvm.h" |
44 | | | 45 | |
45 | /* Kernel memory device file. */ | | 46 | /* Kernel memory device file. */ |
46 | static const char *bsd_kvm_corefile; | | 47 | static const char *bsd_kvm_corefile; |
47 | | | 48 | |
48 | /* Kernel memory interface descriptor. */ | | 49 | /* Kernel memory interface descriptor. */ |
49 | static kvm_t *core_kd; | | 50 | static kvm_t *core_kd; |
50 | | | 51 | |
51 | /* Address of process control block. */ | | 52 | /* Address of process control block. */ |
52 | static struct pcb *bsd_kvm_paddr; | | 53 | static struct pcb *bsd_kvm_paddr; |
| @@ -228,27 +229,27 @@ bsd_kvm_fetch_registers (struct target_o | | | @@ -228,27 +229,27 @@ bsd_kvm_fetch_registers (struct target_o |
228 | | | 229 | |
229 | if (kvm_nlist (core_kd, nl) == -1) | | 230 | if (kvm_nlist (core_kd, nl) == -1) |
230 | error (("%s"), kvm_geterr (core_kd)); | | 231 | error (("%s"), kvm_geterr (core_kd)); |
231 | | | 232 | |
232 | if (nl[0].n_value != 0) | | 233 | if (nl[0].n_value != 0) |
233 | { | | 234 | { |
234 | struct pcb *paddr; | | 235 | struct pcb *paddr; |
235 | | | 236 | |
236 | /* Found lwp0. */ | | 237 | /* Found lwp0. */ |
237 | nl[0].n_value += offsetof (struct lwp, l_addr); | | 238 | nl[0].n_value += offsetof (struct lwp, l_addr); |
238 | if (kvm_read (core_kd, nl[0].n_value, &paddr, sizeof paddr) == -1) | | 239 | if (kvm_read (core_kd, nl[0].n_value, &paddr, sizeof paddr) == -1) |
239 | error (("%s"), kvm_geterr (core_kd)); | | 240 | error (("%s"), kvm_geterr (core_kd)); |
240 | | | 241 | |
241 | bsd_kvm_fetch_pcb (paddr); | | 242 | bsd_kvm_fetch_pcb (regcache, paddr); |
242 | return; | | 243 | return; |
243 | } | | 244 | } |
244 | #endif | | 245 | #endif |
245 | | | 246 | |
246 | #ifdef HAVE_STRUCT_THREAD_TD_PCB | | 247 | #ifdef HAVE_STRUCT_THREAD_TD_PCB |
247 | /* In FreeBSD kernels for 5.0-RELEASE and later, the PCB no longer | | 248 | /* In FreeBSD kernels for 5.0-RELEASE and later, the PCB no longer |
248 | lives in `struct proc' but in `struct thread'. The `struct | | 249 | lives in `struct proc' but in `struct thread'. The `struct |
249 | thread' for the initial thread for proc0 can be found in the | | 250 | thread' for the initial thread for proc0 can be found in the |
250 | variable "thread0". */ | | 251 | variable "thread0". */ |
251 | | | 252 | |
252 | memset (nl, 0, sizeof nl); | | 253 | memset (nl, 0, sizeof nl); |
253 | nl[0].n_name = "_thread0"; | | 254 | nl[0].n_name = "_thread0"; |
254 | | | 255 | |