svn commit: r232576 - head/sys/mips/mips

Juli Mallett jmallett at FreeBSD.org
Tue Mar 6 02:23:16 UTC 2012


Author: jmallett
Date: Tue Mar  6 02:23:15 2012
New Revision: 232576
URL: http://svn.freebsd.org/changeset/base/232576

Log:
  In the trap messages that aid the primitive debugging environment of MIPS,
  include the tid as well, so it's easier to tell which thread of a process
  with multiple is responsible for a crash.

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

Modified: head/sys/mips/mips/trap.c
==============================================================================
--- head/sys/mips/mips/trap.c	Mon Mar  5 22:36:50 2012	(r232575)
+++ head/sys/mips/mips/trap.c	Tue Mar  6 02:23:15 2012	(r232576)
@@ -1312,15 +1312,19 @@ log_illegal_instruction(const char *msg,
 	pt_entry_t *ptep;
 	pd_entry_t *pdep;
 	unsigned int *addr;
-	struct proc *p = curproc;
+	struct thread *td;
+	struct proc *p;
 	register_t pc;
 
+	td = curthread;
+	p = td->td_proc;
+
 #ifdef SMP
 	printf("cpuid = %d\n", PCPU_GET(cpuid));
 #endif
 	pc = frame->pc + (DELAYBRANCH(frame->cause) ? 4 : 0);
-	log(LOG_ERR, "%s: pid %d (%s), uid %d: pc %#jx ra %#jx\n",
-	    msg, p->p_pid, p->p_comm,
+	log(LOG_ERR, "%s: pid %d tid %ld (%s), uid %d: pc %#jx ra %#jx\n",
+	    msg, p->p_pid, (long)td->td_tid, p->p_comm,
 	    p->p_ucred ? p->p_ucred->cr_uid : -1,
 	    (intmax_t)pc,
 	    (intmax_t)frame->ra);
@@ -1357,12 +1361,16 @@ log_bad_page_fault(char *msg, struct tra
 	pt_entry_t *ptep;
 	pd_entry_t *pdep;
 	unsigned int *addr;
-	struct proc *p = curproc;
+	struct thread *td;
+	struct proc *p;
 	char *read_or_write;
 	register_t pc;
 
 	trap_type &= ~T_USER;
 
+	td = curthread;
+	p = td->td_proc;
+
 #ifdef SMP
 	printf("cpuid = %d\n", PCPU_GET(cpuid));
 #endif
@@ -1381,8 +1389,8 @@ log_bad_page_fault(char *msg, struct tra
 	}
 
 	pc = frame->pc + (DELAYBRANCH(frame->cause) ? 4 : 0);
-	log(LOG_ERR, "%s: pid %d (%s), uid %d: pc %#jx got a %s fault at %#jx\n",
-	    msg, p->p_pid, p->p_comm,
+	log(LOG_ERR, "%s: pid %d tid %ld (%s), uid %d: pc %#jx got a %s fault at %#jx\n",
+	    msg, p->p_pid, (long)td->td_tid, p->p_comm,
 	    p->p_ucred ? p->p_ucred->cr_uid : -1,
 	    (intmax_t)pc,
 	    read_or_write,


More information about the svn-src-all mailing list