PERFORCE change 50340 for review
Marcel Moolenaar
marcel at FreeBSD.org
Sun Apr 4 11:02:24 PDT 2004
http://perforce.freebsd.org/chv.cgi?CH=50340
Change 50340 by marcel at marcel_nfs on 2004/04/04 11:01:35
Make backtraces work on sparc64. Note that continuing does
not work yet, because we need to increment the PC. Now we
simply re-execute the "ta" instruction again and reenter
the debugger.
Affected files ...
.. //depot/projects/gdb/sys/sparc64/include/gdb_machdep.h#4 edit
.. //depot/projects/gdb/sys/sparc64/sparc64/gdb_machdep.c#4 edit
.. //depot/projects/gdb/sys/sparc64/sparc64/trap.c#4 edit
Differences ...
==== //depot/projects/gdb/sys/sparc64/include/gdb_machdep.h#4 (text+ko) ====
@@ -30,13 +30,13 @@
#define _MACHINE_GDB_MACHDEP_H_
#define GDB_BUFSZ 600
-#define GDB_NREGS 462
+#define GDB_NREGS 86
#define GDB_REG_PC 80
static __inline size_t
gdb_cpu_regsz(int regnum)
{
- return (sizeof(long)); /* XXX not really. */
+ return ((regnum >= 32 && regnum < 64) ? sizeof(float) : sizeof(long));
}
static __inline int
==== //depot/projects/gdb/sys/sparc64/sparc64/gdb_machdep.c#4 (text+ko) ====
@@ -29,6 +29,7 @@
#include <sys/param.h>
#include <sys/systm.h>
+#include <sys/kdb.h>
#include <sys/kernel.h>
#include <sys/signal.h>
@@ -41,9 +42,36 @@
void *
gdb_cpu_getreg(int regnum, size_t *regsz)
{
+ struct trapframe *tf = kdb_frame;
*regsz = gdb_cpu_regsz(regnum);
switch (regnum) {
+ case 0: return (&tf->tf_global[0]);
+ case 1: return (&tf->tf_global[1]);
+ case 2: return (&tf->tf_global[2]);
+ case 3: return (&tf->tf_global[3]);
+ case 4: return (&tf->tf_global[4]);
+ case 5: return (&tf->tf_global[5]);
+ case 6: return (&tf->tf_global[6]);
+ case 7: return (&tf->tf_global[7]);
+ /* 8-15: o0-o7 */
+ /* 16-23: l0-l7 */
+ case 24: return (&tf->tf_out[0]);
+ case 25: return (&tf->tf_out[1]);
+ case 26: return (&tf->tf_out[2]);
+ case 27: return (&tf->tf_out[3]);
+ case 28: return (&tf->tf_out[4]);
+ case 29: return (&tf->tf_out[5]);
+ case 30: return (&tf->tf_out[6]);
+ case 31: return (&tf->tf_out[7]);
+ /* 32-63: f0-f31 */
+ /* 64-79: f32-f62 (16 double FP) */
+ case 80: return (&tf->tf_tpc);
+ case 81: return (&tf->tf_tnpc);
+ case 82: return (&tf->tf_tstate);
+ case 83: return (&tf->tf_fsr);
+ case 84: return (&tf->tf_fprs);
+ case 85: return (&tf->tf_y);
}
return (NULL);
}
==== //depot/projects/gdb/sys/sparc64/sparc64/trap.c#4 (text+ko) ====
@@ -242,6 +242,7 @@
(TRAPF_USERMODE(tf) ? "user" : "kernel"), rdpr(pil));
atomic_add_int(&cnt.v_trap, 1);
+ td->td_last_frame = tf;
if ((tf->tf_tstate & TSTATE_PRIV) == 0) {
KASSERT(td != NULL, ("trap: curthread NULL"));
@@ -515,6 +516,7 @@
sticks = td->td_sticks;
td->td_frame = tf;
+ td->td_last_frame = tf;
if (td->td_ucred != p->p_ucred)
cred_update_thread(td);
if (p->p_flag & P_SA)
More information about the p4-projects
mailing list