[PATCH] fix crash in kdba bt command

linas at austin.ibm.com linas at austin.ibm.com
Sat Apr 17 06:43:20 EST 2004


Anton,

Please apply attached patch to ameslab.  Note, this is just the first,
there will probably be some more patches coming in the next few days.

This patch fixes a minor bug in th backtrace command; bt <addr>
was failing to actually trace the stack at addr.

--linas

-------------- next part --------------
--- kdba_bt.c.orig	2004-04-16 14:45:44.000000000 -0500
+++ kdba_bt.c	2004-04-16 15:29:42.000000000 -0500
@@ -126,7 +126,7 @@ kdba_bt_stack_ppc(struct pt_regs *regs,
 	if (!addr)
 		addr = (kdb_machreg_t *)p->thread.ksp;

-	if (addr && !task_curr(p)) {
+	if (addr && (!p || !task_curr(p))) {
 		eip = 0;
 		esp = *addr;
 		ebp = 0;
@@ -183,7 +183,8 @@ kdba_bt_stack_ppc(struct pt_regs *regs,
 		/*		kdbnearsym(eip, &symtab); */
 		kdba_find_tb_table(eip, &tbtab);

-		/*		sym = symtab.sym_name ? &symtab : &tbtab.symtab; *//* use fake symtab if necessary */
+		/* sym = symtab.sym_name ? &symtab : &tbtab.symtab; */
+		/* use fake symtab if necessary */
 		name = NULL;
 		if (esp >= PAGE_OFFSET) {
 			/*if ((sym) )*/
@@ -288,8 +289,8 @@ kdba_bt_stack(struct pt_regs *regs, kdb_
 /*
  * kdba_bt_address
  *
- *	Do a backtrace starting at a specified stack address.  Use this if the
- *	heuristics get the i386 stack decode wrong.
+ *	Do a backtrace starting at a specified stack address.  Handy
+ *	if the stack is somwhere unexpected/unusual.
  *
  * Inputs:
  *	addr	Address provided to 'bt' command.
@@ -300,9 +301,6 @@ kdba_bt_stack(struct pt_regs *regs, kdb_
  *	zero for success, a kdb diagnostic if error
  * Locking:
  *	none.
- * Remarks:
- *	mds %esp comes in handy when examining the stack to do a manual
- *	traceback.
  */

 int


More information about the Linuxppc64-dev mailing list