Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/gnu/dist/toolchain/gdb Re-add kcore support for i386.



details:   https://anonhg.NetBSD.org/src/rev/96ad2d7f2131
branches:  trunk
changeset: 510531:96ad2d7f2131
user:      tv <tv%NetBSD.org@localhost>
date:      Thu May 31 16:39:08 2001 +0000

description:
Re-add kcore support for i386.

diffstat:

 gnu/dist/toolchain/gdb/config/i386/nbsd.mh |   3 +-
 gnu/dist/toolchain/gdb/i386nbsd-nat.c      |  46 ++++++++++++++++++++++++++++++
 2 files changed, 48 insertions(+), 1 deletions(-)

diffs (74 lines):

diff -r 85a53824ca90 -r 96ad2d7f2131 gnu/dist/toolchain/gdb/config/i386/nbsd.mh
--- a/gnu/dist/toolchain/gdb/config/i386/nbsd.mh        Thu May 31 16:30:04 2001 +0000
+++ b/gnu/dist/toolchain/gdb/config/i386/nbsd.mh        Thu May 31 16:39:08 2001 +0000
@@ -1,5 +1,6 @@
 # Host: Intel 386 running NetBSD
 XDEPFILES= ser-tcp.o
-NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o i386nbsd-nat.o
+NAT_CLIBS= -lkvm
+NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o i386nbsd-nat.o kcore-nbsd.o
 XM_FILE= xm-nbsd.h
 NAT_FILE= nm-nbsd.h
diff -r 85a53824ca90 -r 96ad2d7f2131 gnu/dist/toolchain/gdb/i386nbsd-nat.c
--- a/gnu/dist/toolchain/gdb/i386nbsd-nat.c     Thu May 31 16:30:04 2001 +0000
+++ b/gnu/dist/toolchain/gdb/i386nbsd-nat.c     Thu May 31 16:39:08 2001 +0000
@@ -24,6 +24,7 @@
 #include <sys/ptrace.h>
 #include <machine/reg.h>
 #include <machine/frame.h>
+#include <machine/pcb.h>
 #include "inferior.h"
 #include "gdbcore.h" /* for registers_fetched() */
 
@@ -199,6 +200,51 @@
   registers_fetched ();
 }
 
+/*
+ * kernel_u_size() is not helpful on NetBSD because
+ * the "u" struct is NOT in the core dump file.
+ */
+
+#ifdef FETCH_KCORE_REGISTERS
+/*
+ * Get registers from a kernel crash dump or live kernel.
+ * Called by kcore-nbsd.c:get_kcore_registers().
+ */
+void
+fetch_kcore_registers (pcb)
+     struct pcb *pcb;
+{
+  int i, regno, regs[4];
+
+  /*
+   * get the register values out of the sys pcb and
+   * store them where `read_register' will find them.
+   */
+  if (target_read_memory(pcb->pcb_tss.tss_esp+4,
+                        (char *)regs, sizeof(regs)))
+    error("Cannot read ebx, esi, and edi.");
+  for (i = 0, regno = 0; regno < 3; regno++)
+    supply_register(regno, (char *)&i);
+  supply_register(3, (char *)&regs[2]);
+  supply_register(4, (char *)&pcb->pcb_tss.tss_esp);
+  supply_register(5, (char *)&pcb->pcb_tss.tss_ebp);
+  supply_register(6, (char *)&regs[1]);
+  supply_register(7, (char *)&regs[0]);
+  supply_register(8, (char *)&regs[3]);
+  for (i = 0, regno = 9; regno < 10; regno++)
+    supply_register(regno, (char *)&i);
+#if 0
+  i = 0x08;
+  supply_register(10, (char *)&i);
+  i = 0x10;
+  supply_register(11, (char *)&i);
+#endif
+
+  /* The kernel does not use the FPU, so ignore it. */
+  registers_fetched ();
+}
+#endif /* FETCH_KCORE_REGISTERS */
+
 /* Register that we are able to handle i386nbsd core file formats.
    FIXME: is this really bfd_target_unknown_flavour? */
 



Home | Main Index | Thread Index | Old Index