From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20748 invoked by alias); 21 Nov 2001 12:10:16 -0000 Mailing-List: contact gdb-patches-help@sourceware.cygnus.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 20216 invoked from network); 21 Nov 2001 12:09:54 -0000 Received: from unknown (HELO mail.science.uva.nl) (146.50.4.51) by sourceware.cygnus.com with SMTP; 21 Nov 2001 12:09:54 -0000 Received: from soliton.wins.uva.nl [146.50.20.20] by mail.science.uva.nl with ESMTP (sendmail 8.11.6/config 11.19). id fALC75905100; Wed, 21 Nov 2001 13:07:05 +0100 (MET) Received: from localhost by soliton.wins.uva.nl (sendmail 8.11.6/config 11.15). id fALC7FB05467; Wed, 21 Nov 2001 13:07:15 +0100 (MET) X-Organisation: Faculty of Science, University of Amsterdam, The Netherlands X-URL: http://www.science.uva.nl/ To: Kevin Buettner Cc: gdb-patches@sources.redhat.com Subject: Re: [PATCH RFA] lin-lwp.c: Mark main thread as stopped when attaching References: <1011119195735.ZM16446@ocotillo.lan> From: Mark Kettenis Date: Thu, 08 Nov 2001 13:04:00 -0000 In-Reply-To: Kevin Buettner's message of Mon, 19 Nov 2001 12:57:35 -0700 Message-ID: X-Mailer: Gnus v5.5/Emacs 20.2 X-SW-Source: 2001-11/txt/msg00166.txt.bz2 Kevin Buettner writes: > The patch below marks the main pid as stopped when attaching. If it > is not marked as such, then it is not (re)started when continuing if > the user first changes the current thread. > > The practical effects of this problem may be demonstrated on a > Linux/x86 sytem as follows: > > 1) Start the linux-dp program and make note of the process id of the > main thread. > 2) Debug the linux-dp program and attach to PID representing the > main thread. > 3) Do ``info threads'' and pick out a thread other than the main > one. > 4) Use GDB's ``thread'' command to switch to this thread. > 5) Continue the program. > 6) Attempt to interrupt the program with Ctrl-C. It will be impossible > to do so. (Examining the threads from another shell with the > ``ps'' command is also instructive at this stage.) Ah yes, the initial attach doesn't go through the lin_lwp layer. When the libthreads_db stuff is detected and lin_lwp_attach_lwp is called for all threads the main thread isn't marked as stopped. > Jim Blandy deserves credit for arriving at the above procedure for > reproducing this problem. > > The patch below fixes this bug. Okay to commit? Could you change the comment to say that we *assume* that the thread is stopped and therefore mark it as such? Otherwise OK. Mark