Source-Changes-HG archive

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

[src/trunk]: src/gnu/dist/gdb Add fetch_kcore_registers. May not be entirely...



details:   https://anonhg.NetBSD.org/src/rev/5608902bcb2f
branches:  trunk
changeset: 504156:5608902bcb2f
user:      matt <matt%NetBSD.org@localhost>
date:      Fri Feb 23 23:09:07 2001 +0000

description:
Add fetch_kcore_registers.  May not be entirely correct.  But
target kcore now works.

diffstat:

 gnu/dist/gdb/ppcnbsd-nat.c |  38 ++++++++++++++++++++++++++++++++++++++
 1 files changed, 38 insertions(+), 0 deletions(-)

diffs (45 lines):

diff -r e3342e086a0e -r 5608902bcb2f gnu/dist/gdb/ppcnbsd-nat.c
--- a/gnu/dist/gdb/ppcnbsd-nat.c        Fri Feb 23 23:07:15 2001 +0000
+++ b/gnu/dist/gdb/ppcnbsd-nat.c        Fri Feb 23 23:09:07 2001 +0000
@@ -142,3 +142,41 @@
 {
   add_core_fns (&ppcnbsd_core_fns);
 }
+
+
+/*
+ * 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;
+{
+  struct trapframe tf;
+  int regno, regs[32];
+
+  /*
+   * get the register values out of the sys pcb and
+   * store them where `read_register' will find them.
+   */
+  if (target_read_memory(pcb->pcb_sp, (char *)&tf, sizeof(tf)))
+    error("Cannot read trapframe.");
+  for (regno = 0; regno < 32; regno++)
+    supply_register(regno, (char *)&tf.fixreg[regno]);
+  supply_register(LR_REGNUM, (char *)&tf.lr);
+  supply_register(PC_REGNUM, (char *)&tf.srr0);
+  supply_register(PS_REGNUM, (char *)&tf.srr1);
+  supply_register(CR_REGNUM, (char *)&tf.cr);
+  supply_register(XER_REGNUM, (char *)&tf.xer);
+  supply_register(CTR_REGNUM, (char *)&tf.ctr);
+
+  /* The kernel does not use the FPU, so ignore it. */
+  registers_fetched ();
+}
+#endif /* FETCH_KCORE_REGISTERS */



Home | Main Index | Thread Index | Old Index