Re: one problem about using kdb 'ss' command

Keith Owens <[email protected]>
Newsgroups gmane.linux.kernel.debugging
Message-ID <[email protected]>
"Zhou, Water" (on Mon, 26 Feb 2007 14:13:24 +0800) wrote:
>    Entering kdb (current=0xc460b550, pid 1125) duo to Breakpoint @0xc016ca90
>    kdb> ss
>
>    kdb_ss: pt_regs not available
>
>I think the problem is because of get_irq_regs() inline function
>return NULL when the breakpoint is touched. I don't know why ?

Correct, there are a couple of paths that do not call set_irq_regs().
Could you try this patch, it is against kdb-v4.4-2.6.20-common-4 but
should apply to 2.6.19 as well.  The patch compiles but I will not be
able to test it for for several hours.

Index: linux/kdb/kdbmain.c
===================================================================
--- linux.orig/kdb/kdbmain.c	2007-02-27 00:40:29.996600672 +1100
+++ linux/kdb/kdbmain.c	2007-02-27 00:40:18.934043094 +1100
@@ -1736,6 +1736,7 @@ kdb(kdb_reason_t reason, int error, stru
 	kdb_reason_t reason2 = reason;
 	int result = 0;	/* Default is kdb did not handle it */
 	int ss_event;
+	struct pt_regs *old_regs = NULL;
 	kdb_dbtrap_t db_result=KDB_DB_NOBPT;
 	preempt_disable();
 	atomic_inc(&kdb_event);
@@ -1745,6 +1746,11 @@ kdb(kdb_reason_t reason, int error, stru
 	case KDB_REASON_NMI:
 		KDB_FLAG_SET(CATASTROPHIC);	/* kernel state is dubious now */
 		break;
+	case KDB_REASON_ENTER:
+	case KDB_REASON_ENTER_SLAVE:
+		if (regs != get_irq_regs())
+			old_regs = set_irq_regs(regs);
+		break;
 	default:
 		break;
 	}
@@ -2060,6 +2066,8 @@ kdb(kdb_reason_t reason, int error, stru
 	if (!(KDB_STATE(DOING_SS) || KDB_STATE(SSBPT) || KDB_STATE(RECURSE))) {
 		KDB_DEBUG_STATE("kdb 15", result);
 		kdb_bp_install_local(regs);
+		if (old_regs)
+			set_irq_regs(old_regs);
 		KDB_STATE_CLEAR(KDB_CONTROL);
 	}
 

---------------------------
Use http://oss.sgi.com/ecartis to modify your settings or to unsubscribe.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.