From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 124742 invoked by alias); 19 Nov 2019 14:20:25 -0000 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 Received: (qmail 124723 invoked by uid 89); 19 Nov 2019 14:20:24 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-6.4 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,SPF_HELO_PASS autolearn=ham version=3.3.1 spammy=breakpoints, HX-HELO:sk:gateway, findings, HX-Spam-Relays-External:sk:gateway X-HELO: gateway33.websitewelcome.com Received: from gateway33.websitewelcome.com (HELO gateway33.websitewelcome.com) (192.185.145.216) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 19 Nov 2019 14:20:22 +0000 Received: from cm11.websitewelcome.com (cm11.websitewelcome.com [100.42.49.5]) by gateway33.websitewelcome.com (Postfix) with ESMTP id 45F78DD5E7 for ; Tue, 19 Nov 2019 08:20:21 -0600 (CST) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id X4MfithtRiJ43X4MfiQ5ed; Tue, 19 Nov 2019 08:20:21 -0600 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=YwIv7HZOq9liSYM8odb7I2NAMffUqDHFIz05LGLNNLo=; b=vIjYf5LS15wGLqr/GzpmqRxFOA UrrntHrPkwb0AqHlQwslvJDCBQlC80by/l7e2mSiOu0E+NKNQ04gAexSRXcrSD1EEjPkYGc6C9wDZ HMKr8FNSD9qss++sSyz6sGNtM; Received: from 174-29-59-178.hlrn.qwest.net ([174.29.59.178]:56438 helo=murgatroyd) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92) (envelope-from ) id 1iX4Me-003pKr-Pd; Tue, 19 Nov 2019 07:20:20 -0700 From: Tom Tromey To: Pedro Alves Cc: tromey@sourceware.org, gdb-patches@sourceware.org, "Tom Tromey \(Code Review\)" Subject: Re: [review] Handle pending stops from the Windows kernel References: <94963d2c-961d-e48b-4e24-ad69472114d6@redhat.com> Date: Tue, 19 Nov 2019 14:20:00 -0000 In-Reply-To: <94963d2c-961d-e48b-4e24-ad69472114d6@redhat.com> (Pedro Alves's message of "Thu, 14 Nov 2019 20:27:32 +0000") Message-ID: <87eey4x80s.fsf@tromey.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-SW-Source: 2019-11/txt/msg00589.txt.bz2 >>>>> "Pedro" == Pedro Alves writes: >> + else if (desired_stop_thread_id != -1 && desired_stop_thread_id != thread_id) >> + { >> + /* Pending stop. See the comment by the definition of >> + "pending_stops" for details on why this is needed. */ >> + DEBUG_EVENTS (("get_windows_debug_event - " >> + "unexpected stop in 0x%x (expecting 0x%x)\n", >> + thread_id, desired_stop_thread_id)); >> + >> + pending_stops.push_back ({thread_id, *ourstatus, current_event}); Pedro> I think you should unwind the PC here, not only when returning the pending Pedro> event to GDB core. Consider the case of two threads hitting a breakpoint Pedro> at the same time. When that happens, and do you "info threads", you want to Pedro> see the PC of all threads pointing at a valid instruction. If you don't Pedro> unwind the PC of pending breakpoints, then the threads with pending breakpoints Pedro> will have their PC offset by one. I think I tried this, but I can try again. >> + if (software_breakpoint_inserted_here_p (regcache->aspace (), pc)) Pedro> Why is software_breakpoint_inserted_here_p needed? Offsetting the PC did not work without this. I tried to document my findings here: https://sourceware.org/ml/gdb-patches/2019-10/msg00338.html IIRC what happened is that gdb would sometimes resume the inferior with wrong PC, causing it to crash. However, I don't really recall, since it was a long time ago now. I guess I'll re-do the experiments. Tom