* inferior.h (call_ptrace): Replace PTRACE_ARG3_TYPE with
[deliverable/binutils-gdb.git] / gdb / bsd-kvm.c
index 3ed57d652bd7a98f439a382978a233e42a0e2809..64869e5464c2284c20165aeb1df7d8108165936c 100644 (file)
 #include "regcache.h"
 #include "target.h"
 #include "value.h"
+#include "gdbcore.h"           /* for get_exec_file */
 
 #include "gdb_assert.h"
 #include <fcntl.h>
 #include <kvm.h>
+#ifdef HAVE_NLIST_H
 #include <nlist.h>
+#endif
 #include "readline/readline.h"
 #include <sys/param.h>
 #include <sys/proc.h>
@@ -73,6 +76,7 @@ bsd_kvm_open (char *filename, int from_tty)
        }
     }
 
+  execfile = get_exec_file (0);
   temp_kd = kvm_openfiles (execfile, filename, NULL, O_RDONLY, errbuf);
   if (temp_kd == NULL)
     error ("%s", errbuf);
@@ -206,7 +210,7 @@ bsd_kvm_fetch_registers (int regnum)
 \f
 
 /* Kernel memory interface commands.  */
-struct cmd_list_element *bsd_kvm_cmdlist = NULL;
+struct cmd_list_element *bsd_kvm_cmdlist;
 
 static void
 bsd_kvm_cmd (char *arg, int fromtty)
@@ -228,7 +232,11 @@ bsd_kvm_proc_cmd (char *arg, int fromtty)
     error ("No kernel memory image.");
 
   addr = parse_and_eval_address (arg);
+#ifdef HAVE_STRUCT_LWP
+  addr += offsetof (struct lwp, l_addr);
+#else
   addr += offsetof (struct proc, p_addr);
+#endif
 
   if (kvm_read (core_kd, addr, &bsd_kvm_paddr, sizeof bsd_kvm_paddr) == -1)
     error ("%s", kvm_geterr (core_kd));
This page took 0.039571 seconds and 4 git commands to generate.