Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 6 Jul 2004 01:53:20 GMT
From:      Marcel Moolenaar <marcel@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 56565 for review
Message-ID:  <200407060153.i661rK4E099224@repoman.freebsd.org>

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

Change 56565 by marcel@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)
 {



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