Module Name:    src
Committed By:   hannken
Date:           Sun Feb 20 10:24:45 UTC 2011

Modified Files:
        src/sys/ddb: db_cpu.c

Log Message:
When looking for the next element of cpu_queue compare the pointer to the
address of the head, not to the head itself.  Not sure if the cast of the
arg to db_value_name() is right, but works on i386 and compiles on sparc64.

Stack traces from ddb work again on i386.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/ddb/db_cpu.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/ddb/db_cpu.c
diff -u src/sys/ddb/db_cpu.c:1.3 src/sys/ddb/db_cpu.c:1.4
--- src/sys/ddb/db_cpu.c:1.3	Mon Mar  9 06:07:05 2009
+++ src/sys/ddb/db_cpu.c	Sun Feb 20 10:24:45 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_cpu.c,v 1.3 2009/03/09 06:07:05 mrg Exp $	*/
+/*	$NetBSD: db_cpu.c,v 1.4 2011/02/20 10:24:45 hannken Exp $	*/
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: db_cpu.c,v 1.3 2009/03/09 06:07:05 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_cpu.c,v 1.4 2011/02/20 10:24:45 hannken Exp $");
 
 #ifndef _KERNEL
 #include <stdbool.h>
@@ -43,12 +43,14 @@
 #include <ddb/ddb.h>
 
 static struct cpu_info	*head;
+static void *head_addr;
 
 struct cpu_info *
 db_cpu_first(void)
 {
 
 	head = db_read_ptr("cpu_queue");
+	(void) db_value_of_name("cpu_queue", (db_expr_t *)&head_addr);
 	return head;
 }
 
@@ -58,7 +60,7 @@
 
 	db_read_bytes((db_addr_t)&ci->ci_data.cpu_qchain.cqe_next,
 	    sizeof(ci), (char *)&ci);
-	if (ci == head) {
+	if (ci == head_addr) {
 		ci = NULL;
 	}
 	return ci;

Reply via email to