Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 5 Jul 2004 22:00:31 GMT
From:      Marcel Moolenaar <marcel@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 56545 for review
Message-ID:  <200407052200.i65M0VIu092121@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=56545

Change 56545 by marcel@marcel_nfs on 2004/07/05 21:59:39

	Implement makectx() on i386. Tested and working.

Affected files ...

.. //depot/projects/gdb/sys/i386/i386/machdep.c#12 edit

Differences ...

==== //depot/projects/gdb/sys/i386/i386/machdep.c#12 (text+ko) ====

@@ -2217,6 +2217,25 @@
 }
 #endif /* defined(I586_CPU) && !NO_F00F_HACK */
 
+/*
+ * Construct a PCB from a trapframe. This is called from kdb_trap() where
+ * we want to start a backtrace from the function that caused us to enter
+ * the debugger. We have the context in the trapframe, but base the trace
+ * on the PCB. The PCB doesn't have to be perfect, as long as it contains
+ * enough for a backtrace.
+ */
+void
+makectx(struct trapframe *tf, struct pcb *pcb)
+{
+
+	pcb->pcb_edi = tf->tf_edi;
+	pcb->pcb_esi = tf->tf_esi;
+	pcb->pcb_ebp = tf->tf_ebp;
+	pcb->pcb_ebx = tf->tf_ebx;
+	pcb->pcb_eip = tf->tf_eip;
+	pcb->pcb_esp = (ISPL(tf->tf_cs)) ? tf->tf_esp : (int)(tf + 1) - 8;
+}
+
 int
 ptrace_set_pc(struct thread *td, u_long addr)
 {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200407052200.i65M0VIu092121>