PERFORCE change 56565 for review

Marcel Moolenaar marcel at FreeBSD.org
Mon Jul 5 18:53:22 PDT 2004


http://perforce.freebsd.org/chv.cgi?CH=56565

Change 56565 by marcel at marcel_sledge on 2004/07/06 01:52:46

	Implement makectx() on amd64. It compiles. I think it'll work,
	but I can't test amd64 at all...

Affected files ...

.. //depot/projects/gdb/sys/amd64/amd64/machdep.c#15 edit

Differences ...

==== //depot/projects/gdb/sys/amd64/amd64/machdep.c#15 (text+ko) ====

@@ -1283,6 +1283,27 @@
 	pcpu->pc_acpi_id = 0xffffffff;
 }
 
+/*
+ * 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_r12 = tf->tf_r12;
+	pcb->pcb_r13 = tf->tf_r13;
+	pcb->pcb_r14 = tf->tf_r14;
+	pcb->pcb_r15 = tf->tf_r15;
+	pcb->pcb_rbp = tf->tf_rbp;
+	pcb->pcb_rbx = tf->tf_rbx;
+	pcb->pcb_rip = tf->tf_rip;
+	pcb->pcb_rsp = (ISPL(tf->tf_cs)) ? tf->tf_rsp : (long)(tf + 1) - 8;
+}
+
 int
 ptrace_set_pc(struct thread *td, unsigned long addr)
 {


More information about the p4-projects mailing list