From: Mark Kettenis Date: Sat, 17 Jul 2004 11:03:49 +0000 (+0000) Subject: * vaxbsd-nat.c: Include , and X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7ddd7709149d9789a53d455f7bc9ba4c83635608;p=binutils-gdb.git * vaxbsd-nat.c: Include , and "bsd-kvm.h". (vaxbsd_supply_pcb): New function. (_initialize_vaxbsd_nat): New prototype and function. * config/vax/nbsdaout.mh (NATDEPFILES): Add bsd-kvm.o, solib.o and solib-sunos.o. (LOADLIBES): New variable. * config/vax/nbsdelf.mh (NATDEPFILES): Add bsd-kvm.o. (LOADLIBES): New variable. * config/vax/obsd.mh (NATDEPFILES): Add bsd-kvm.o. (LOADLIBES): New variable. * Makefile.in (vaxbsd-nat.o): Update dependencies. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 7da90e9fae0..ad23a533b1c 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,18 @@ +2004-07-17 Mark Kettenis + + * vaxbsd-nat.c: Include , and + "bsd-kvm.h". + (vaxbsd_supply_pcb): New function. + (_initialize_vaxbsd_nat): New prototype and function. + * config/vax/nbsdaout.mh (NATDEPFILES): Add bsd-kvm.o, solib.o and + solib-sunos.o. + (LOADLIBES): New variable. + * config/vax/nbsdelf.mh (NATDEPFILES): Add bsd-kvm.o. + (LOADLIBES): New variable. + * config/vax/obsd.mh (NATDEPFILES): Add bsd-kvm.o. + (LOADLIBES): New variable. + * Makefile.in (vaxbsd-nat.o): Update dependencies. + 2004-07-16 Andrew Cagney * defs.h (event_loop_p): Replace variable declaration with macro, diff --git a/gdb/Makefile.in b/gdb/Makefile.in index e8dc635df9d..17225d14529 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -2566,7 +2566,8 @@ vax-tdep.o: vax-tdep.c $(defs_h) $(arch_utils_h) $(dis_asm_h) $(frame_h) \ $(frame_base_h) $(frame_unwind_h) $(gdbcore_h) $(osabi_h) \ $(regcache_h) $(regset_h) $(value_h) $(trad_frame_h) \ $(gdb_string_h) $(vax_tdep_h) -vaxbsd-nat.o: vaxbsd-nat.c $(defs_h) $(inferior_h) $(regcache_h) $(vax_tdep_h) +vaxbsd-nat.o: vaxbsd-nat.c $(defs_h) $(inferior_h) $(regcache_h) \ + $(vax_tdep_h) $(bsd_kvm_h) vaxnbsd-tdep.o: vaxnbsd-tdep.c $(defs_h) $(arch_utils_h) $(osabi_h) \ $(vax_tdep_h) $(solib_svr4_h) $(gdb_string_h) win32-nat.o: win32-nat.c $(defs_h) $(frame_h) $(inferior_h) $(target_h) \ diff --git a/gdb/config/vax/nbsdaout.mh b/gdb/config/vax/nbsdaout.mh index ad31e39c05a..688713530d0 100644 --- a/gdb/config/vax/nbsdaout.mh +++ b/gdb/config/vax/nbsdaout.mh @@ -1,4 +1,6 @@ # Host: NetBSD/vax a.out -NATDEPFILES= vaxbsd-nat.o fork-child.o infptrace.o inftarg.o \ +NATDEPFILES= vaxbsd-nat.o bsd-kvm.o fork-child.o infptrace.o inftarg.o \ solib.o solib-sunos.o NAT_FILE= nm-nbsdaout.h + +LOADLIBES= -lkvm diff --git a/gdb/config/vax/nbsdelf.mh b/gdb/config/vax/nbsdelf.mh index 899bff85ac3..eec03994504 100644 --- a/gdb/config/vax/nbsdelf.mh +++ b/gdb/config/vax/nbsdelf.mh @@ -1,3 +1,5 @@ # Host: NetBSD/vax ELF -NATDEPFILES= vaxbsd-nat.o fork-child.o infptrace.o inftarg.o +NATDEPFILES= vaxbsd-nat.o bsd-kvm.o fork-child.o infptrace.o inftarg.o NAT_FILE= nm-nbsd.h + +LOADLIBES= -lkvm diff --git a/gdb/config/vax/obsd.mh b/gdb/config/vax/obsd.mh index cad18322e30..299a38fd330 100644 --- a/gdb/config/vax/obsd.mh +++ b/gdb/config/vax/obsd.mh @@ -1,3 +1,5 @@ # Host: OpenBSD/vax -NATDEPFILES= vaxbsd-nat.o fork-child.o infptrace.o inftarg.o +NATDEPFILES= vaxbsd-nat.o bsd-kvm.o fork-child.o infptrace.o inftarg.o NAT_FILE= nm-obsd.h + +LOADLIBES= -lkvm diff --git a/gdb/vaxbsd-nat.c b/gdb/vaxbsd-nat.c index d2757c56c8f..0529f3eec7e 100644 --- a/gdb/vaxbsd-nat.c +++ b/gdb/vaxbsd-nat.c @@ -92,3 +92,47 @@ store_inferior_registers (int regnum) (PTRACE_ARG3_TYPE) ®s, 0) == -1) perror_with_name ("Couldn't write registers"); } + + +/* Support for debugging kernel virtual memory images. */ + +#include +#include + +#include "bsd-kvm.h" + +static int +vaxbsd_supply_pcb (struct regcache *regcache, struct pcb *pcb) +{ + int regnum; + + /* The following is true for OpenBSD 3.5: + + The pcb contains the register state at the context switch inside + cpu_switch(). */ + + /* The stack pointer shouldn't be zero. */ + if (pcb->KSP == 0) + return 0; + + for (regnum = VAX_R0_REGNUM; regnum < VAX_AP_REGNUM; regnum++) + regcache_raw_supply (regcache, regnum, &pcb->R[regnum - VAX_R0_REGNUM]); + regcache_raw_supply (regcache, VAX_AP_REGNUM, &pcb->AP); + regcache_raw_supply (regcache, VAX_FP_REGNUM, &pcb->FP); + regcache_raw_supply (regcache, VAX_SP_REGNUM, &pcb->KSP); + regcache_raw_supply (regcache, VAX_PC_REGNUM, &pcb->PC); + regcache_raw_supply (regcache, VAX_PS_REGNUM, &pcb->PSL); + + return 1; +} + + +/* Provide a prototype to silence -Wmissing-prototypes. */ +void _initialize_vaxbsd_nat (void); + +void +_initialize_vaxbsd_nat (void) +{ + /* Support debugging kernel virtual memory images. */ + bsd_kvm_add_target (vaxbsd_supply_pcb); +}