From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id cdBZIssbJmK/BwAAWB0awg (envelope-from ) for ; Mon, 07 Mar 2022 09:50:51 -0500 Received: by simark.ca (Postfix, from userid 112) id 7BE021F3CA; Mon, 7 Mar 2022 09:50:51 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from 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 RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id B24121EA69 for ; Mon, 7 Mar 2022 09:50:50 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 0B4093858428 for ; Mon, 7 Mar 2022 14:50:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0B4093858428 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1646664650; bh=4oU3swpK55/m2gfZjuNO5cps++qfdC2yYN24S4bUBzo=; h=To:Subject:References:Date:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=UGTciGc+ZeqCqR4Ktr1lz7+u6SQFlPdiiN6N0Tyhmd+eOu+CxPkHvVEL1xM55xr1n e1npzGePw64YvzsvL8SkmK5ni7ahXgfrmWzMQCVNhCyfyizRtY5bY4pdg1OhH8+kgo MmVies7DNye/HelitWLykJEDKNO1u86de1RkAgC4= Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 04DF13858C2C for ; Mon, 7 Mar 2022 14:49:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 04DF13858C2C Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-336-RGBj5D10MOOFT-idO8ADlA-1; Mon, 07 Mar 2022 09:49:54 -0500 X-MC-Unique: RGBj5D10MOOFT-idO8ADlA-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id EC50E1006AA5; Mon, 7 Mar 2022 14:49:52 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.39.192.88]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6A74383588; Mon, 7 Mar 2022 14:49:39 +0000 (UTC) To: Stefan Hajnoczi via Gdb Subject: Re: How to backtrace an separate stack? References: Date: Mon, 07 Mar 2022 15:49:37 +0100 In-Reply-To: (Stefan Hajnoczi via Gdb's message of "Thu, 3 Mar 2022 11:22:32 +0000") Message-ID: <87sfrtakce.fsf@oldenburg.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-BeenThere: gdb@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Florian Weimer via Gdb Reply-To: Florian Weimer Cc: pedro@palves.net, tom@tromey.com, qemu-devel@nongnu.org, Stefan Hajnoczi , "Dr. David Alan Gilbert" Errors-To: gdb-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb" * Stefan Hajnoczi via Gdb: > The QEMU emulator uses coroutines with separate stacks. It can be > challenging to debug coroutines that have yielded because GDB is not > aware of them (no thread is currently executing them). > > QEMU has a GDB Python script that helps. It "creates" a stack frame for > a given coroutine by temporarily setting register values and then using > the "bt" command. This works on a live process under ptrace control but > not for coredumps where registers can't be set. > > Here is the script (or see the bottom of this email for an inline copy > of the relevant code): > https://gitlab.com/qemu-project/qemu/-/blob/master/scripts/qemugdb/coroutine.py > > I hoped that "select-frame address ADDRESS" could be used instead so > this would work on coredumps too. Unfortunately "select-frame" only > searches stack frames that GDB is already aware of, so it cannot be used > to backtrace coroutine stacks. > > Is there a way to backtrace a stack at an arbitrary address in GDB? I'm a bit surprised by this. Conceptually, why would GDB need to know about stack boundaries? Is there some heuristic to detect broken frames? Thanks, Florian