NetBSD Problem Report #41788

From www@NetBSD.org  Sun Jul 26 20:08:49 2009
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by www.NetBSD.org (Postfix) with ESMTP id 666BD63B8E9
	for <gnats-bugs@gnats.netbsd.org>; Sun, 26 Jul 2009 20:08:49 +0000 (UTC)
Message-Id: <20090726200849.327A163B8DB@www.NetBSD.org>
Date: Sun, 26 Jul 2009 20:08:49 +0000 (UTC)
From: to.my.trociny@gmail.com
Reply-To: to.my.trociny@gmail.com
To: gnats-bugs@NetBSD.org
Subject: gdbscripts/lwps does not work correctly
X-Send-Pr-Version: www-1.0

>Number:         41788
>Category:       kern
>Synopsis:       gdbscripts/lwps does not work correctly
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    kern-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Jul 26 20:10:01 +0000 2009
>Closed-Date:    Tue Jul 28 10:41:13 +0000 2009
>Last-Modified:  Fri Aug 07 06:25:01 +0000 2009
>Originator:     Mikolaj Golub
>Release:        CURRENT
>Organization:
>Environment:
NetBSD  5.99.15 NetBSD 5.99.15 (XEN3_DOMU) #0: Sun Jul 26 12:08:10 GMT 2009  golub@ukbuild.datech.ltd.uk:/home/golub/nbsd/obj/sys/arch/amd64/compile/XEN3_DOMU amd64

>Description:
gdbscripts/lwps when traversing process' LWPs uses l_list while it should use l_sibling (proc's list of LWPs). As a result the output is wrong.

I use current but suppose 5.0 is affected too.
>How-To-Repeat:
Run lwps script in gdb and observe e.g. repeating lid == 1 for system process (pid == 0)

$ sudo gdb /netbsd.gdb 
(gdb) target kvm 
(gdb) source ~/nbsd/src/sys/gdbscripts/lwps 
(gdb) lwps 
             lwp   pid   lid     flag            wchan
... [skipped] ...
ffffa0003de45800     0    34      204 ffffa0003ddaff18 (nfsiod)
ffffa0003de45c00     0    33      204 ffffa0003ddafeb8 (nfsiod)
ffffa0003de40000     0    32      204 ffffa0003ddafe58 (nfsiod)
ffffa0003de40400     0    31      204 ffffa0003ddafdf8 (nfsiod)
ffffa0003dd8a000     0     1       84 ffffa0003dd9e8c8 (wait)
ffffa0003dd8a400     0     1       84 ffffa0003c990850 (select)
ffffa0003dd8ac00     0     1       84 ffffa000018645e0 (netio)
ffffa0003d98c800     0     1       84 ffffa0003d98c800 (nanoslp)
ffffa0003d98c000     0     1       84 ffffa0003d98c000 (nanoslp)
ffffa0003437dc00     0     1       84 ffffa0003437dc00 (nanoslp)
ffffa0003437d800     0     1       84 ffffa0003cd61588 (ttyraw)
ffffa0003437f000     0     1       84 ffffa0003437f000 (nanoslp)
ffffa0003dd8a800     0     1       84 ffffa0003cc9a4f8 (kqueue)
ffffa0003d98c400     0     1       84 ffffa0003c990850 (select)
ffffa0003437f400     0     1       84 ffffa0003cc9a478 (kqueue)
ffffa0003d98cc00     0    30      204 ffffa0003cc9a3e0 (physiod)
ffffa0003437d400     0    29      204 ffffa0003cc9a360 (vmem_rehash)
ffffa0003437d000     0    28      204 ffffa0003cc9a2e0 (aiodoned)
ffffa0003437ec00     0    27      204 ffffffff805c99e0 (syncer)
ffffa0003437e800     0    26      204 ffffffff80642a0c (pgdaemon)
ffffa00034375000     0    25      204 ffffffff805daff0 (crypto_wait)
ffffa0003437e400     0     1       84 ffffa0003d7a1b90 (wait)
ffffa0003437e000     0    24      204 ffffffff805caec0 (unpgc)
ffffa0003437f800     0    23      204 ffffffff80645490 (rdst)
ffffa0003437fc00     0    22      204 ffffffff80591450 (evtsq)

>Fix:
Index: lwps
===================================================================
RCS file: /cvsroot/src/sys/gdbscripts/lwps,v
retrieving revision 1.1
diff -u -r1.1 lwps
--- lwps        20 Feb 2008 20:56:35 -0000      1.1
+++ lwps        26 Jul 2009 19:43:11 -0000
@@ -19,7 +19,7 @@
                                if ($l->l_wmesg)
                                        printf " (%s)", (char *)$l->l_wmesg
                                end
-                               set $l = $l->l_list.le_next
+                               set $l = $l->l_sibling.le_next
                                printf "\n"
                                set $j++
                        end

>Release-Note:

>Audit-Trail:
From: Nick Hudson <skrll@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/41788 CVS commit: src/sys/gdbscripts
Date: Tue, 28 Jul 2009 10:38:21 +0000

 Module Name:	src
 Committed By:	skrll
 Date:		Tue Jul 28 10:38:20 UTC 2009

 Modified Files:
 	src/sys/gdbscripts: lwps

 Log Message:
 Use the right pointer to traverse the proc's lwp list.

 From PR 41788.


 To generate a diff of this commit:
 cvs rdiff -u -r1.1 -r1.2 src/sys/gdbscripts/lwps

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

State-Changed-From-To: open->closed
State-Changed-By: skrll@NetBSD.org
State-Changed-When: Tue, 28 Jul 2009 10:41:13 +0000
State-Changed-Why:
Fix committed. Thanks for the PR.


From: Soren Jacobsen <snj@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/41788 CVS commit: [netbsd-5] src/sys/gdbscripts
Date: Fri, 7 Aug 2009 06:20:31 +0000

 Module Name:	src
 Committed By:	snj
 Date:		Fri Aug  7 06:20:31 UTC 2009

 Modified Files:
 	src/sys/gdbscripts [netbsd-5]: lwps

 Log Message:
 Pull up following revision(s) (requested by skrll in ticket #893):
 	sys/gdbscripts/lwps: revision 1.2
 Use the right pointer to traverse the proc's lwp list.
 From PR 41788.


 To generate a diff of this commit:
 cvs rdiff -u -r1.1 -r1.1.24.1 src/sys/gdbscripts/lwps

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

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.