#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>
}
}
+ execfile = get_exec_file (0);
temp_kd = kvm_openfiles (execfile, filename, NULL, O_RDONLY, errbuf);
if (temp_kd == NULL)
error ("%s", errbuf);
\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)
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));