Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 26 Jan 2010 03:29:52 +0000 (UTC)
From:      Neel Natu <neel@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r202999 - head/sys/mips/mips
Message-ID:  <201001260329.o0Q3TqWw064060@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: neel
Date: Tue Jan 26 03:29:52 2010
New Revision: 202999
URL: http://svn.freebsd.org/changeset/base/202999

Log:
  Add a DDB command "show trapframe" to dump out contents of the trapframe
  specified by the first argument.
  
  Approved by: imp (mentor)

Modified:
  head/sys/mips/mips/vm_machdep.c

Modified: head/sys/mips/mips/vm_machdep.c
==============================================================================
--- head/sys/mips/mips/vm_machdep.c	Tue Jan 26 03:24:11 2010	(r202998)
+++ head/sys/mips/mips/vm_machdep.c	Tue Jan 26 03:29:52 2010	(r202999)
@@ -599,26 +599,12 @@ cpu_throw(struct thread *old, struct thr
 #define DB_PRINT_REG_ARRAY(ptr, arrname, regname)	\
 	db_printf("  %-12s 0x%lx\n", #regname, (long)((ptr)->arrname[regname]))
 
-DB_SHOW_COMMAND(pcb, ddb_dump_pcb)
+static void
+dump_trapframe(struct trapframe *trapframe)
 {
-	struct thread *td;
-	struct pcb *pcb;
-	struct trapframe *trapframe;
-
-	/* Determine which thread to examine. */
-	if (have_addr)
-		td = db_lookup_thread(addr, FALSE);
-	else
-		td = curthread;
-	
-	pcb = td->td_pcb;
 
-	db_printf("Thread %d at %p\n", td->td_tid, td);
-
-	db_printf("PCB at %p\n", pcb);
-
-	trapframe = &pcb->pcb_regs;
 	db_printf("Trapframe at %p\n", trapframe);
+
 	DB_PRINT_REG(trapframe, zero);
 	DB_PRINT_REG(trapframe, ast);
 	DB_PRINT_REG(trapframe, v0);
@@ -657,6 +643,28 @@ DB_SHOW_COMMAND(pcb, ddb_dump_pcb)
 	DB_PRINT_REG(trapframe, badvaddr);
 	DB_PRINT_REG(trapframe, cause);
 	DB_PRINT_REG(trapframe, pc);
+}
+
+DB_SHOW_COMMAND(pcb, ddb_dump_pcb)
+{
+	struct thread *td;
+	struct pcb *pcb;
+	struct trapframe *trapframe;
+
+	/* Determine which thread to examine. */
+	if (have_addr)
+		td = db_lookup_thread(addr, TRUE);
+	else
+		td = curthread;
+	
+	pcb = td->td_pcb;
+
+	db_printf("Thread %d at %p\n", td->td_tid, td);
+
+	db_printf("PCB at %p\n", pcb);
+
+	trapframe = &pcb->pcb_regs;
+	dump_trapframe(trapframe);
 
 	db_printf("PCB Context:\n");
 	DB_PRINT_REG_ARRAY(pcb, pcb_context, PCB_REG_S0);
@@ -684,4 +692,16 @@ DB_SHOW_COMMAND(pcb, ddb_dump_pcb)
 	}
 }
 
+/*
+ * Dump the trapframe beginning at address specified by first argument.
+ */
+DB_SHOW_COMMAND(trapframe, ddb_dump_trapframe)
+{
+	
+	if (!have_addr)
+		return;
+
+	dump_trapframe((struct trapframe *)addr);
+}
+
 #endif	/* DDB */



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