From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22446 invoked by alias); 17 Dec 2008 19:14:53 -0000 Received: (qmail 22437 invoked by uid 22791); 17 Dec 2008 19:14:52 -0000 X-SWARE-Spam-Status: No, hits=-1.4 required=5.0 tests=AWL,BAYES_00,MSGID_FROM_MTA_HEADER,SPF_SOFTFAIL X-Spam-Check-By: sourceware.org Received: from mtagate8.de.ibm.com (HELO mtagate8.de.ibm.com) (195.212.29.157) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 17 Dec 2008 19:14:09 +0000 Received: from d12nrmr1607.megacenter.de.ibm.com (d12nrmr1607.megacenter.de.ibm.com [9.149.167.49]) by mtagate8.de.ibm.com (8.13.8/8.13.8) with ESMTP id mBHJE6Nx498432 for ; Wed, 17 Dec 2008 19:14:06 GMT Received: from d12av02.megacenter.de.ibm.com (d12av02.megacenter.de.ibm.com [9.149.165.228]) by d12nrmr1607.megacenter.de.ibm.com (8.13.8/8.13.8/NCO v9.1) with ESMTP id mBHJE6OK3379264 for ; Wed, 17 Dec 2008 20:14:06 +0100 Received: from d12av02.megacenter.de.ibm.com (loopback [127.0.0.1]) by d12av02.megacenter.de.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id mBHJE6Ta002961 for ; Wed, 17 Dec 2008 20:14:06 +0100 Received: from tuxmaker.boeblingen.de.ibm.com (tuxmaker.boeblingen.de.ibm.com [9.152.85.9]) by d12av02.megacenter.de.ibm.com (8.12.11.20060308/8.12.11) with SMTP id mBHJE61T002958; Wed, 17 Dec 2008 20:14:06 +0100 Message-Id: <200812171914.mBHJE61T002958@d12av02.megacenter.de.ibm.com> Received: by tuxmaker.boeblingen.de.ibm.com (sSMTP sendmail emulation); Wed, 17 Dec 2008 20:14:05 +0100 Subject: Re: [RFA] Fix hand called function when another thread has hit a bp. To: dje@google.com (Doug Evans) Date: Wed, 17 Dec 2008 19:14:00 -0000 From: "Ulrich Weigand" Cc: gdb-patches@sourceware.org In-Reply-To: from "Doug Evans" at Dec 15, 2008 03:14:58 PM MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2008-12/txt/msg00316.txt.bz2 Doug Evans wrote: > > The problem arises when scheduler locking is switched on. Actually, > > I think there are really two problems. First of all, after we've > > switched back and single-stepped over an already-hit breakpoint via > > the prepare_to_proceed logic, we'll continue only a single thread > > if scheduler-locking is on -- and that is the wrong thread. The > > prepare_to_proceed logic only explicitly switches *back* to the > > user-selected thread if the user was *stepping* (that's the > > deferred_step_ptid logic). For scheduler-locking, we should probably > > switch back always ... > > If scheduler locking is on, why is there any switching at all? If > scheduler-locking is on and I switch threads I'd want gdb to defer > single-stepping the other thread over its breakpoint until the point > when I make that other thread runnable. > > Also, I think removing the notion of one previously stopped thread and > generalizing it to not caring, i.e. checking the status of every > stopped thread before resuming will simplify things and fix a few bugs > along the way. IOW, make deferred_ptid go away. That may indeed be the best solution. The simplest implementation might be to simply remember in a per-thread flag the fact that the last time this thread stopped, we reported a breakpoint at stop_pc (which would have to be made per-thread as well, but we'd already decided this should happen anyway). This information could then be consulted the next time the thread is made runnable again. > > The second problem is more a problem of definition: even if the > > first problem above were fixed, we've have to single-step the other > > thread at least once to get over the breakpoint. This would seem > > to violate the definition of scheduler locking if interpreted > > absolutely strictly. Now you could argue that as the user should > > never be aware of that single step, it doesn't really matter. > > I'm not sure how we necessarily have a violation of the definition of > scheduler locking. This is just saying the same you said in other words: "If scheduler- locking is on and I switch threads I'd want gdb to defer single- stepping the other thread over its breakpoint until the point when I make that other thread runnable." I.e. "definition of scheduler locking" meaning: no other thread but the one selected by the user runs, ever. Today, this is not true, in the case of single-stepping over a breakpoint in another thread. Bye, Ulrich -- Dr. Ulrich Weigand GNU Toolchain for Linux on System z and Cell BE Ulrich.Weigand@de.ibm.com