NetBSD Problem Report #37061

From aaron@frye.com  Thu Oct  4 21:56:43 2007
Return-Path: <aaron@frye.com>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by narn.NetBSD.org (Postfix) with ESMTP id D8A8663B8C2
	for <gnats-bugs@gnats.NetBSD.org>; Thu,  4 Oct 2007 21:56:43 +0000 (UTC)
Message-Id: <20071004215641.E3CEA36BBF@skolem.unix.fryenet>
Date: Thu,  4 Oct 2007 14:56:41 -0700 (PDT)
From: agrier@poofygoof.com
Reply-To: agrier@poofygoof.com
To: gnats-bugs@NetBSD.org
Subject: threaded program stopped in debugger cannot be continued
X-Send-Pr-Version: 3.95

>Number:         37061
>Category:       toolchain
>Synopsis:       threaded program stopped in debugger cannot be continued
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    toolchain-manager
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Oct 04 22:00:00 +0000 2007
>Closed-Date:    Tue Oct 14 16:02:44 +0000 2014
>Last-Modified:  Tue Oct 14 16:02:44 +0000 2014
>Originator:     Aaron J. Grier agrier@poofygoof.com
>Release:        NetBSD 3.1_STABLE
>Organization:
  Aaron J. Grier  |   Frye Electronics, Tigard, OR   |  aaron@frye.com
>Environment:
System: NetBSD skolem.unix.fryenet 3.1_STABLE NetBSD 3.1_STABLE (ADVANTECH.3) #1: Fri Sep 21 15:39:22 PDT 2007 aaron@orthanc.unix.fryenet:/var/obj/ADVANTECH.3 i386
Architecture: i386
Machine: i386

ADVANTECH is GENERIC with extra isa serial ports enabled

$ gdb --version
GNU gdb 5.3nb1
Copyright 2002 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386--netbsdelf".

>Description:

on occation (roughly 20% of the time) a threaded application I am
debugging cannot be continued from the debugger after being paused to
insert breakpoints.  gdb gives the error "nbsd_thread_fetch_registers:
td_thr_getregs: thread can not answer request" and I am unable to switch
threads with the "thread" command, and "continue" fails.  at this point
the only thing I can do is quit the debugger and start over.

>How-To-Repeat:

 [invoke threaded program via gdb.  press ^T]
Program received signal SIGINFO, Information request.
 [Switching to LWP 5]
0x08101f7c in nanosleep ()
(gdb) info thread
  8 LWP 2  0x08101fd0 in msgrcv ()
  7 LWP 6  0x08101fd0 in msgrcv ()
  6 LWP 4  0x08101f7c in nanosleep ()
  5 LWP 7  0x08101f7c in nanosleep ()
  4 LWP 3  0x08101f7c in nanosleep ()
* 3 LWP 5  0x08101f7c in nanosleep ()
  2 Thread 1 ()  nbsd_thread_fetch_registers: td_thr_getregs: thread can not answer request

(gdb) break nb_soundio.c:1440
Breakpoint 2 at 0x80f9895: file lib/io/nb_soundio.c, line 1440.
(gdb) c
Continuing.
nbsd_thread_fetch_registers: td_thr_getregs: thread can not answer request

(gdb) c
Continuing.
nbsd_thread_fetch_registers: td_thr_getregs: thread can not answer request

(gdb) thread 8
nbsd_thread_fetch_registers: td_thr_getregs: thread can not answer request

(gdb) [HELP!]

>Fix:

get nbsd_thread_fetch_registers() and td_thr_getregs() in NetBSD's gdb
support code to "do the right thing" (whatever that is).

I would use NetBSD-4 or even -current, but under similar debugging
situations I get hit by kern/37004 which causes a panic.  given the
choice between restarting my debugging session and restarting the
computer, I chose the less painful option.

I have not tried a newer version of gdb under NetBSD-3.

>Release-Note:

>Audit-Trail:
From: Nick Hudson <nick.hudson@dsl.pipex.com>
To: gnats-bugs@netbsd.org
Cc: toolchain-manager@netbsd.org, gnats-admin@netbsd.org,
	netbsd-bugs@netbsd.org
Subject: Re: toolchain/37061: threaded program stopped in debugger cannot be continued
Date: Fri, 5 Oct 2007 12:58:07 +0100

 On Thursday 04 October 2007 23:00:01 aaron@frye.com wrote:
 [...]
 > $ gdb --version
 > GNU gdb 5.3nb1
 [...]
 > I would use NetBSD-4 or even -current, but under similar debugging
 > situations I get hit by kern/37004 which causes a panic.  given the
 > choice between restarting my debugging session and restarting the
 > computer, I chose the less painful option.

 Can you test the wrstuden-fixsa branch?

 I can provide tarballs if required.

 Thanks,
 Nick

From: "Aaron J. Grier" <aaron@frye.com>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: toolchain/37061: threaded program stopped in debugger cannot be continued
Date: Fri, 5 Oct 2007 10:14:55 -0700

 On Fri, Oct 05, 2007 at 12:00:05PM +0000, Nick Hudson wrote:
 >  Can you test the wrstuden-fixsa branch?

 Mindaugas also wrote to me:
 > > FYI, it was fixed in -current:
 > > http://mail-index.netbsd.org/source-changes/2007/10/03/0008.html

 I'm building current now, and will try that first.  if it doesn't work,
 I'll try the wrstuden-fixsa branch.

 thanks for your quick replies on this.

 -- 
   Aaron J. Grier  |   Frye Electronics, Tigard, OR   |  aaron@frye.com

From: Nick Hudson <nick.hudson@dsl.pipex.com>
To: gnats-bugs@netbsd.org
Cc: toolchain-manager@netbsd.org, gnats-admin@netbsd.org,
	netbsd-bugs@netbsd.org, aaron@frye.com
Subject: Re: toolchain/37061: threaded program stopped in debugger cannot be continued
Date: Fri, 5 Oct 2007 18:33:17 +0100

 On Friday 05 October 2007 18:15:10 Aaron J. Grier wrote:
 > The following reply was made to PR toolchain/37061; it has been noted by
 > GNATS.
 >
 > From: "Aaron J. Grier" <aaron@frye.com>
 > To: gnats-bugs@NetBSD.org
 > Cc:
 > Subject: Re: toolchain/37061: threaded program stopped in debugger cannot
 > be continued Date: Fri, 5 Oct 2007 10:14:55 -0700
 >
 >  On Fri, Oct 05, 2007 at 12:00:05PM +0000, Nick Hudson wrote:
 >  >  Can you test the wrstuden-fixsa branch?
 >
 >  Mindaugas also wrote to me:
 >  > > FYI, it was fixed in -current:
 >  > > http://mail-index.netbsd.org/source-changes/2007/10/03/0008.html
 >
 >  I'm building current now, and will try that first.  if it doesn't work,
 >  I'll try the wrstuden-fixsa branch.

 ptrace in -current is quite broken for LWPs - there's another PR somewhere. 
 It'll still crash your box, I believe.

 Also, gdb in -current has no support for threads (yet). I have some code, but 
 I've got sidetracked.

 Nick

[wiz 20100620] Updated email address of submitter.

State-Changed-From-To: open->feedback
State-Changed-By: wiz@NetBSD.org
State-Changed-When: Sun, 20 Jun 2010 11:17:09 +0000
State-Changed-Why:
NetBSD-current has much improved support for debugging threaded programs.
Could you please try again and report if you still see this problem?


State-Changed-From-To: feedback->open
State-Changed-By: wiz@NetBSD.org
State-Changed-When: Tue, 22 Jun 2010 08:44:25 +0000
State-Changed-Why:
skrll@ says "not yet, it isn't"
should be soon, though


State-Changed-From-To: open->feedback
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Sun, 13 Jul 2014 03:23:07 +0000
State-Changed-Why:
Is this working now?


From: "Aaron J. Grier" <agrier@poofygoof.com>
To: gnats-bugs@gnats.netbsd.org
Cc: 
Subject: Re: toolchain/37061
Date: Tue, 19 Aug 2014 22:57:48 -0700

 stopping and continuing threaded applications is working for trivial
 test cases (spawning multiple pthreads that sleep in a loop) under
 NetBSD-6.

 I no longer have access to the source code used when filing this PR, so
 unless I run into the issue again, consider it closed.

 -- 
   Aaron J. Grier | "Not your ordinary poofy goof." | agrier@poofygoof.com

State-Changed-From-To: feedback->closed
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Tue, 14 Oct 2014 16:02:44 +0000
State-Changed-Why:
Confirmed fixed, thanks.


>Unformatted:
 >X-Originator:     Aaron J. Grier aaron@frye.com

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-2014 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.