From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20105 invoked by alias); 4 Jun 2002 15:54:56 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 20041 invoked from network); 4 Jun 2002 15:54:50 -0000 Received: from unknown (HELO touchme.toronto.redhat.com) (216.138.202.10) by sources.redhat.com with SMTP; 4 Jun 2002 15:54:50 -0000 Received: from tooth.toronto.redhat.com (unknown [172.16.14.29]) by touchme.toronto.redhat.com (Postfix) with ESMTP id C0316B8013; Tue, 4 Jun 2002 11:54:49 -0400 (EDT) Received: (from liams@localhost) by tooth.toronto.redhat.com (8.11.6/8.11.6) id g54FsnL02034; Tue, 4 Jun 2002 11:54:49 -0400 X-Authentication-Warning: tooth.toronto.redhat.com: liams set sender to liams@redhat.com using -f Date: Tue, 04 Jun 2002 08:54:00 -0000 From: Liam Stewart To: gdb-patches@sources.redhat.com Cc: Mark Kettenis Subject: Re: [PATCH] detaching and threaded linux apps Message-ID: <20020604115449.A24548@redhat.com> Mail-Followup-To: gdb-patches@sources.redhat.com, Mark Kettenis References: <20020603143634.A12472@redhat.com> <86ptz89ghs.fsf@elgar.kettenis.dyndns.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5.1i In-Reply-To: <86ptz89ghs.fsf@elgar.kettenis.dyndns.org>; from kettenis@chello.nl on Mon, Jun 03, 2002 at 11:53:03PM +0200 X-SW-Source: 2002-06/txt/msg00062.txt.bz2 On Mon, Jun 03, 2002 at 11:53:03PM +0200, Mark Kettenis wrote: > > The fact that thread_db_detach and lin_lwp_detach don't unpush their > targect vector is intentional. The target vector is installed as a > result of loading the thread library, not (necessarily) as a result of > attaching to a threaded application. Therefore is should only be > uninstalled if the thread library is unloaded. The right wat of > fixing this would be to prevent the assertion being triggered if > num_lwps == 0. Explicitly checking for this condition and displaying > an error message in lin_lwp_detach() might be sufficient. Ok. I see exactly what's going on now. Returning from lin_lwp_detach when there are no lwps works as expected. I don't think that displaying an error message is neccessary - the behaviour of detach remains consistent. Liam -- Liam Stewart :: Red Hat Canada, Ltd. :: liams@redhat.com 2002-06-04 Liam Stewart * lin-lwp.c (lin_lwp_detach): Don't attempt to detach if there * are no lwps. Index: lin-lwp.c =================================================================== RCS file: /cvs/src/src/gdb/lin-lwp.c,v retrieving revision 1.34 diff -c -p -r1.34 lin-lwp.c *** lin-lwp.c 31 Mar 2002 15:10:38 -0000 1.34 --- lin-lwp.c 4 Jun 2002 15:32:03 -0000 *************** detach_callback (struct lwp_info *lp, vo *** 482,487 **** --- 482,490 ---- static void lin_lwp_detach (char *args, int from_tty) { + if (num_lwps == 0) + return; + iterate_over_lwps (detach_callback, NULL); /* Only the initial process should be left right now. */