From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id IDv0CxRLd2VU/B0AWB0awg (envelope-from ) for ; Mon, 11 Dec 2023 12:47:00 -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=N4Su19Sz; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 235D01E0C3; Mon, 11 Dec 2023 12:47:00 -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 117131E0AC for ; Mon, 11 Dec 2023 12:46:58 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 5066938582AD for ; Mon, 11 Dec 2023 17:46:57 +0000 (GMT) Received: from omta38.uswest2.a.cloudfilter.net (omta38.uswest2.a.cloudfilter.net [35.89.44.37]) by sourceware.org (Postfix) with ESMTPS id 51C753858C2B for ; Mon, 11 Dec 2023 17:46:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 51C753858C2B 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 51C753858C2B Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=35.89.44.37 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702316800; cv=none; b=NM5axQY9g9DJnq1iDAgHY1UFw63hMlkXRbPComphNlHgPbZZY2GCRlyJh5yk6Mt+Hik0MsNVaNB4kXdbPrT2oHTww5bv8H77BFyfhTuG5yM2lAQxFKOqyi/KhZ/RzfRWFs17PZcfDa4kc7zaa5uCM2bH95APxpJ+T9Jue8uSb/c= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702316800; c=relaxed/simple; bh=aXY5+gAjrMBuJriIaRLXAXpj1dR9hNiHXuqo2P5JRrs=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=GDGhF4uGBtl+eOOabtkgWiQdxyNU1n9glrhxno4/Utdj74ZI9EZqWLgzQIa0ImZNlZasMjFl8V8SnPUdxf93b8Gon7DgXmUl7LvRyRiQCa5aDmBW/89LqXnO8b9P/GVpCs7ezoH0unilPdynTs3ww+N6LxQ0r4OY82o7+Ey9BY8= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from eig-obgw-6001a.ext.cloudfilter.net ([10.0.30.140]) by cmsmtp with ESMTPS id Ci2wrU2crVly7CkMXreckR; Mon, 11 Dec 2023 17:46:37 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id CkMXrSC74b8QnCkMXrrhqn; Mon, 11 Dec 2023 17:46:37 +0000 X-Authority-Analysis: v=2.4 cv=IuQNzZzg c=1 sm=1 tr=0 ts=65774afd a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=OWjo9vPv0XrRhIrVQ50Ab3nP57M=:19 a=dLZJa+xiwSxG16/P+YVxDGlgEgI=:19 a=e2cXIFwxEfEA:10 a=Qbun_eYptAEA:10 a=CCpqsmhAAAAA:8 a=iOfeo9oMDBMqDCQxmrcA:9 a=ul9cdbp4aOFLsgKbc677:22 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=Q7yQnrBgc1711Ub38FwnqjT1TyzEp1lKqEflc5FM/V4=; b=N4Su19SzXIfosFQDxji7f9rP+c E441NmxHqUedCvd3eN8wzxj7F4kNp2AhOSD+6tawMbHEN6S0Fyk62SJhghc6KcCNOD9Jxv/3VBaqF slcr22FPDXuwqxJit+owJ9nYJ; Received: from 71-211-161-25.hlrn.qwest.net ([71.211.161.25]:60210 helo=murgatroyd) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96.2) (envelope-from ) id 1rCkMW-001SNT-1v; Mon, 11 Dec 2023 10:46:36 -0700 From: Tom Tromey To: Andrey Turkin via Gdb Cc: Tom Tromey , Andrey Turkin Subject: Re: "previous frame inner to this frame" error when unwinding fibers References: <874jgp7ksd.fsf@tromey.com> X-Attribution: Tom Date: Mon, 11 Dec 2023 10:46:35 -0700 In-Reply-To: (Andrey Turkin via Gdb's message of "Mon, 11 Dec 2023 10:44:54 +0300") Message-ID: <87plzceio4.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: 71.211.161.25 X-Source-L: No X-Exim-ID: 1rCkMW-001SNT-1v X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 71-211-161-25.hlrn.qwest.net (murgatroyd) [71.211.161.25]:60210 X-Source-Auth: tom+tromey.com X-Email-Count: 1 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfOGomwNen4Ep5W/UYVRad0IHQMgGMf7FzmfbWeV3rU8Qmp0KRGyHbLS0HQxZqoSfV6xhL7Y6EduvtNIUACsaAZexTyBiQJZPYRpRKRr53KdJwNgmCIku FaSibQZtcgD/fUgfBtYkNElmLcdqmc3nDArPRK2dUgJDCxto0zEY63lbzzJJxz4HHvs0+5itgjmovg== X-Spam-Status: No, score=-3017.0 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> One possible solution that comes to my mind is to allow unwinders to Andrey> specify the type of the frame (ideally that would be the frame being Andrey> unwinded, i.e. one from PendingFrame; UnwindInfo I think is all about Andrey> the next frame though). This would be enough to solve this issue since Andrey> the inner-frame checking code only works with normal caller-callee Andrey> pairs. Not sure which type it would be; sigtrap is the one most Andrey> closely resembling it I think but not quite it. SIGTRAMP_FRAME has some special handling in stack.c, so stack traces would be formatted differently. I guess we could introduce a new constant if we wanted to go this route. Andrey> PS: One other thing that is needed for the fiber/coroutine use case is Andrey> an ability to perform backtraces from a random starting point. Andrey> Backtrace through the switch point is what's needed for active Andrey> asymmetric coroutines like generators and such; however it would be Andrey> nice to be able to see the current stack of suspended asymmetric Andrey> coroutines, or to see the state of symmetric coroutines. A while ago I wrote some initial support for "green threads" by extending the Python API. See this thread: https://inbox.sourceware.org/gdb/YiCk+NNtAGQPhyK5@stefanha-x1.localdomain/ Your situation sounds somewhat similar -- the basic idea is to model user-space threads, letting Python code replace the sentinel frame. Then, unlike with 'select-frame', backtraces will work ok. However maybe your case isn't really identical to this. Like, do coroutines store registers? Maybe some more abstract approach is needed. Tom