Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 29 Feb 2012 02:32:51 GMT
From:      Oleksandr Tymoshenko <gonzo@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 207063 for review
Message-ID:  <201202290232.q1T2WpK7048777@skunkworks.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://p4web.freebsd.org/@@207063?ac=10

Change 207063 by gonzo@gonzo_thinkpad on 2012/02/29 02:32:40

	- Remove output from backtrace function
	- Let args/validargs be optional

Affected files ...

.. //depot/projects/dtrace-mips/sys/mips/mips/backtrace.c#3 edit

Differences ...

==== //depot/projects/dtrace-mips/sys/mips/mips/backtrace.c#3 (text+ko) ====

@@ -76,24 +76,25 @@
 	unsigned int frames = 0;
 	int more, stksize;
 	register_t ra = 0;
-	int arg;
+	int arg, r;
 
 	/*
 	 * Invalidate arguments values
 	 */
-	valid_args[0] = 0;
-	valid_args[1] = 0;
-	valid_args[2] = 0;
-	valid_args[3] = 0;
-/* Jump here after a nonstandard (interrupt handler) frame */
+	if (valid_args) {
+		for (r = 0; r < 8; r++)
+			valid_args[r] = 0;
+	}
+
+	/* Jump here after a nonstandard (interrupt handler) frame */
 	stksize = 0;
 	if (frames++ > 100) {
 		/* return breaks stackframe-size heuristics with gcc -O2 */
 		goto error;	/* XXX */
 	}
+
 	/* check for bad SP: could foul up next frame */
 	if (!MIPS_IS_VALID_KERNELADDR(*sp)) {
-		printf("SP 0x%jx: not in kernel\n", *sp);
 		goto error;
 	}
 #define Between(x, y, z) \
@@ -103,9 +104,9 @@
 
 	/* check for bad PC */
 	if (!MIPS_IS_VALID_KERNELADDR(*pc)) {
-		printf("PC 0x%jx: not in kernel\n", *pc);
 		goto error;
 	}
+
 	/*
 	 * Find the beginning of the current subroutine by scanning
 	 * backwards from the current PC for the end of the previous
@@ -231,8 +232,10 @@
 			case 11:/* a7 */
 #endif
 				arg = i.IType.rt - 4;
-				args[arg] = kdbpeekd((int *)(*sp + (short)i.IType.imm));
-				valid_args[arg] = 1;
+				if (args)
+					args[arg] = kdbpeekd((int *)(*sp + (short)i.IType.imm));
+				if (valid_args)
+					valid_args[arg] = 1;
 				break;
 
 			case 31:	/* ra */



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