* bsd-kvm.c: Include "cli/cli-cmds.h", "command.h", "value.h" and
<sys/proc.h>. (bsd_kvm_cmdlist): New variable. (bsd_kvm_cmd, bsd_kvm_proc_cmd, bsd_kvm_pcb_cmd): New functions. (bsd_kvm_add_target): Register "kvm" command prefix, "kvm pcb" command and "kvm proc" command. * Makefile.in (bsd-kvm.o): Update dependencies.
This commit is contained in:
parent
00577cd69a
commit
963c417494
|
@ -1,3 +1,13 @@
|
||||||
|
2004-07-03 Mark Kettenis <kettenis@gnu.org>
|
||||||
|
|
||||||
|
* bsd-kvm.c: Include "cli/cli-cmds.h", "command.h", "value.h" and
|
||||||
|
<sys/proc.h>.
|
||||||
|
(bsd_kvm_cmdlist): New variable.
|
||||||
|
(bsd_kvm_cmd, bsd_kvm_proc_cmd, bsd_kvm_pcb_cmd): New functions.
|
||||||
|
(bsd_kvm_add_target): Register "kvm" command prefix, "kvm pcb"
|
||||||
|
command and "kvm proc" command.
|
||||||
|
* Makefile.in (bsd-kvm.o): Update dependencies.
|
||||||
|
|
||||||
2004-07-02 Mark Kettenis <kettenis@gnu.org>
|
2004-07-02 Mark Kettenis <kettenis@gnu.org>
|
||||||
|
|
||||||
* osabi.c: Update copyright year.
|
* osabi.c: Update copyright year.
|
||||||
|
|
|
@ -1646,8 +1646,9 @@ breakpoint.o: breakpoint.c $(defs_h) $(symtab_h) $(frame_h) $(breakpoint_h) \
|
||||||
$(objfiles_h) $(source_h) $(linespec_h) $(completer_h) $(gdb_h) \
|
$(objfiles_h) $(source_h) $(linespec_h) $(completer_h) $(gdb_h) \
|
||||||
$(ui_out_h) $(cli_script_h) $(gdb_assert_h) $(block_h) \
|
$(ui_out_h) $(cli_script_h) $(gdb_assert_h) $(block_h) \
|
||||||
$(gdb_events_h)
|
$(gdb_events_h)
|
||||||
bsd-kvm.o: bsd-kvm.c $(defs_h) $(frame_h) $(regcache_h) $(target_h) \
|
bsd-kvm.o: bsd-kvm.c $(defs_h) $(cli_cmds.h) $(command_h) $(value_h) \
|
||||||
$(gdb_assert_h) $(readline_h) $(bsd_kvm_h)
|
$(frame_h) $(regcache_h) $(target_h) $(gdb_assert_h) $(readline_h) \
|
||||||
|
$(bsd_kvm_h)
|
||||||
buildsym.o: buildsym.c $(defs_h) $(bfd_h) $(gdb_obstack_h) $(symtab_h) \
|
buildsym.o: buildsym.c $(defs_h) $(bfd_h) $(gdb_obstack_h) $(symtab_h) \
|
||||||
$(symfile_h) $(objfiles_h) $(gdbtypes_h) $(gdb_assert_h) \
|
$(symfile_h) $(objfiles_h) $(gdbtypes_h) $(gdb_assert_h) \
|
||||||
$(complaints_h) $(gdb_string_h) $(expression_h) $(language_h) \
|
$(complaints_h) $(gdb_string_h) $(expression_h) $(language_h) \
|
||||||
|
|
|
@ -20,9 +20,12 @@
|
||||||
Boston, MA 02111-1307, USA. */
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
#include "defs.h"
|
#include "defs.h"
|
||||||
|
#include "cli/cli-cmds.h"
|
||||||
|
#include "command.h"
|
||||||
#include "frame.h"
|
#include "frame.h"
|
||||||
#include "regcache.h"
|
#include "regcache.h"
|
||||||
#include "target.h"
|
#include "target.h"
|
||||||
|
#include "value.h"
|
||||||
|
|
||||||
#include "gdb_assert.h"
|
#include "gdb_assert.h"
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
@ -30,6 +33,7 @@
|
||||||
#include <nlist.h>
|
#include <nlist.h>
|
||||||
#include "readline/readline.h"
|
#include "readline/readline.h"
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
|
#include <sys/proc.h>
|
||||||
#include <sys/user.h>
|
#include <sys/user.h>
|
||||||
|
|
||||||
#include "bsd-kvm.h"
|
#include "bsd-kvm.h"
|
||||||
|
@ -201,6 +205,61 @@ bsd_kvm_fetch_registers (int regnum)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Kernel memory interface commands. */
|
||||||
|
struct cmd_list_element *bsd_kvm_cmdlist = NULL;
|
||||||
|
|
||||||
|
static void
|
||||||
|
bsd_kvm_cmd (char *arg, int fromtty)
|
||||||
|
{
|
||||||
|
/* ??? Should this become an alias for "target kvm"? */
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifndef HAVE_STRUCT_THREAD_TD_PCB
|
||||||
|
|
||||||
|
static void
|
||||||
|
bsd_kvm_proc_cmd (char *arg, int fromtty)
|
||||||
|
{
|
||||||
|
CORE_ADDR addr;
|
||||||
|
|
||||||
|
if (arg == NULL)
|
||||||
|
error_no_arg ("proc address");
|
||||||
|
|
||||||
|
if (core_kd == NULL)
|
||||||
|
error ("No kernel memory image.");
|
||||||
|
|
||||||
|
addr = parse_and_eval_address (arg);
|
||||||
|
addr += offsetof (struct proc, p_addr);
|
||||||
|
|
||||||
|
if (kvm_read (core_kd, addr, &bsd_kvm_paddr, sizeof bsd_kvm_paddr) == -1)
|
||||||
|
error ("%s", kvm_geterr (core_kd));
|
||||||
|
|
||||||
|
target_fetch_registers (-1);
|
||||||
|
|
||||||
|
flush_cached_frames ();
|
||||||
|
select_frame (get_current_frame ());
|
||||||
|
print_stack_frame (get_selected_frame (), -1, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static void
|
||||||
|
bsd_kvm_pcb_cmd (char *arg, int fromtty)
|
||||||
|
{
|
||||||
|
if (arg == NULL)
|
||||||
|
error_no_arg ("pcb address");
|
||||||
|
|
||||||
|
if (core_kd == NULL)
|
||||||
|
error ("No kernel memory image.");
|
||||||
|
|
||||||
|
bsd_kvm_paddr = (struct pcb *) parse_and_eval_address (arg);
|
||||||
|
|
||||||
|
target_fetch_registers (-1);
|
||||||
|
|
||||||
|
flush_cached_frames ();
|
||||||
|
select_frame (get_current_frame ());
|
||||||
|
print_stack_frame (get_selected_frame (), -1, 1);
|
||||||
|
}
|
||||||
|
|
||||||
/* Add the libkvm interface to the list of all possible targets and
|
/* Add the libkvm interface to the list of all possible targets and
|
||||||
register CUPPLY_PCB as the architecture-specific process control
|
register CUPPLY_PCB as the architecture-specific process control
|
||||||
block interpreter. */
|
block interpreter. */
|
||||||
|
@ -226,4 +285,15 @@ Optionally specify the filename of a core dump.";
|
||||||
bsd_kvm_ops.to_magic = OPS_MAGIC;
|
bsd_kvm_ops.to_magic = OPS_MAGIC;
|
||||||
|
|
||||||
add_target (&bsd_kvm_ops);
|
add_target (&bsd_kvm_ops);
|
||||||
|
|
||||||
|
add_prefix_cmd ("kvm", class_obscure, bsd_kvm_cmd, "\
|
||||||
|
Generic command for manipulating the kernel memory interface.",
|
||||||
|
&bsd_kvm_cmdlist, "kvm ", 0, &cmdlist);
|
||||||
|
|
||||||
|
#ifndef HAVE_STRUCT_THREAD_TD_PCB
|
||||||
|
add_cmd ("proc", class_obscure, bsd_kvm_proc_cmd,
|
||||||
|
"Set current context from proc address", &bsd_kvm_cmdlist);
|
||||||
|
#endif
|
||||||
|
add_cmd ("pcb", class_obscure, bsd_kvm_pcb_cmd,
|
||||||
|
"Set current context from pcb address", &bsd_kvm_cmdlist);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue