From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id w5VdKi9NrWUbDgMAWB0awg (envelope-from ) for ; Sun, 21 Jan 2024 11:58:23 -0500 Authentication-Results: simark.ca; dkim=fail reason="signature verification failed" (768-bit key; unprotected) header.d=tromey.com header.i=@tromey.com header.a=rsa-sha256 header.s=default header.b=pEWVzMnJ; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 9EB621E0C3; Sun, 21 Jan 2024 11:58:23 -0500 (EST) Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 6BFB61E092 for ; Sun, 21 Jan 2024 11:58:21 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D12B9385840B for ; Sun, 21 Jan 2024 16:58:20 +0000 (GMT) Received: from omta40.uswest2.a.cloudfilter.net (omta40.uswest2.a.cloudfilter.net [35.89.44.39]) by sourceware.org (Postfix) with ESMTPS id AE2D73858D32 for ; Sun, 21 Jan 2024 16:57:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org AE2D73858D32 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tromey.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tromey.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org AE2D73858D32 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=35.89.44.39 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705856274; cv=none; b=leFKc9NT3JCcp7f5kahzM8PkJTM6FE+LquejPdy4zlBcMdC/FBrqImZI0Cckgp+XdbOeO4wdSjNJs+0KxJgealD8rU2D2FfJJi0JHCuLf34y2atmOGxeGAn/anmpIXcyxiT+nTKci4KVOkd2OHEJ/eHhU//HsSAaVPniy2+WyR4= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705856274; c=relaxed/simple; bh=Hw/2XJwla/riRrqgC2EE7cfTGwokVhdd+IT6giX8Da4=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=X3miShqBVA/fblIIXkgo6k1LQbatw8Gp9pJack7nQQHC7kcg92t98qo+5Mv8F9gYrJmCeKHMac1HX7N9QE/6YVH+TOj7nvdXnACFjUfA5I+lDU8gC0FTjqQwd5ceAtmhoyGikWYw5MzQJaVI83KjEdjko275F457BLrwo1WDNok= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from eig-obgw-5009a.ext.cloudfilter.net ([10.0.29.176]) by cmsmtp with ESMTPS id R3Sdritow80oiRb8prLInu; Sun, 21 Jan 2024 16:57:51 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id Rb8orxbyEV9xYRb8orxUEJ; Sun, 21 Jan 2024 16:57:50 +0000 X-Authority-Analysis: v=2.4 cv=NfP1akP4 c=1 sm=1 tr=0 ts=65ad4d0e a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=dEuoMetlWLkA:10 a=Qbun_eYptAEA:10 a=pGLkceISAAAA:8 a=912P9ZkfjOM_J2hzDFsA:9 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=CeW8nSgDvk39PSxnsAH/u2ocFWgbeIuE/cNq6Ew0MVs=; b=pEWVzMnJ9Nl3QKZ14h9kub7oC4 S7/UC12j9kE4JDOy+DYIiQfhW6BNVaGUlGyJ/Hht7/G0HCqIyuzoUVANlfLydnMyHzd2IsHmFEX6k b4U0mWdN3rGLotdY8XLEWyrXU; Received: from 97-122-68-157.hlrn.qwest.net ([97.122.68.157]:49948 helo=prentzel) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96.2) (envelope-from ) id 1rRb8n-002WU4-2R; Sun, 21 Jan 2024 09:57:49 -0700 From: Tom Tromey To: Andrey Turkin Cc: Tom Tromey , Andrey Turkin via Gdb Subject: Re: "previous frame inner to this frame" error when unwinding fibers References: <874jgp7ksd.fsf@tromey.com> <87plzceio4.fsf@tromey.com> <87msu3dqp4.fsf@tromey.com> <87edfedozl.fsf@tromey.com> X-Attribution: Tom Date: Sun, 21 Jan 2024 09:57:48 -0700 In-Reply-To: (Andrey Turkin's message of "Thu, 4 Jan 2024 13:00:59 +0300") Message-ID: <878r4ivd2r.fsf@tromey.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box5379.bluehost.com X-AntiAbuse: Original Domain - sourceware.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 97.122.68.157 X-Source-L: No X-Exim-ID: 1rRb8n-002WU4-2R X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-122-68-157.hlrn.qwest.net (prentzel) [97.122.68.157]:49948 X-Source-Auth: tom+tromey.com X-Email-Count: 2 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfB7VAp8vi2pNhhls4xBD94WerHIRD17AfTbwQ6YuFNcdAOCSP7rHg4J03ioc2R8BwfWc2OBk2yYduyoyW6qUdb7ySfrQgnjrgFgybJa1vIvM/4FhY6yQ hTRzYSSzzQfv3Ne1SoaILF3AzitL5mDJZIkFrs3dARaZFXcrwUwKvOojzfmPVb4Ze51pSWXCD8/xOw== X-Spam-Status: No, score=-3016.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, JMQ_SPF_NEUTRAL, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb" >>>>> "Andrey" == Andrey Turkin writes: Andrey> Re stopping the unwind for green threads - callback makes sense I Andrey> think; I guess most users would want to chop off some useless tail Andrey> there. But also custom unwinders might want to have some clean way to Andrey> do the same for whatever reason. I currently just do Andrey> create_unwind_info() without filling any registers; that works but Andrey> results in an ugly error message. For unwinders I think we could add a more principled way to signal the end of the stack. Andrey> Re inner-than thing - this is orthogonal to green threads. This is Andrey> something that happens because of unwinder stitching together Andrey> different stacks; it doesn't have to be due to green threads. In fact, Andrey> with the green threads support it might not be necessary to do the Andrey> stiching; we might get away with doing several bts for the threads we Andrey> want shown together, or something like a custom command to switch Andrey> between callee/caller contexts etc. But anyway, if this is to be Andrey> implemented, it seems to me this belongs to the unwinders domain. I see what you mean, though stitching together stacks from different threads is maybe a questionable procedure in gdb. One issue is that the frame cache is global -- not per-thread. So, switching threads will flush it and cause it to be repopulated. As long as the inferior doesn't run, this will be "invisible" to the user, though it may show up as a performance problem. It'd be nice to fix this but there's some tricky business involving vfork IIRC. I think there's a bug open about it. Also when stitching together stacks, I wonder about the semantics of things like "finish". But... maybe as long as selecting a frame also selects its underlying thread, it could kinda work. Andrey> Re PoC implementation on GH - I tried it out. Thank you. Andrey> There was an obvious bug (see attached patch), I applied this to my branch. Andrey> I can switch to it etc, but the registers don't get fetched Andrey> and bt, info frame etc shows information of a native thread with id 1 I am not sure but I suspect this was this problem in a few methods in green_thread_target -- they checked the green thread's ptid, but they should have checked if the green thread has an underlying thread. The idea here is that when a green thread is currently running on a native thread, registers should simply come from that; but if the green thread is inactive, then the Python code should be used. I made this change on my branch & pushed it again, in case you want to give it another try. Tom