From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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) From: Florian Weimer To: Stefan Hajnoczi via Gdb Cc: Stefan Hajnoczi , tom@tromey.com, qemu-devel@nongnu.org, pedro@palves.net, "Dr. David Alan Gilbert" 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-Spam-Status: No, score=-5.9 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org 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: , X-List-Received-Date: Mon, 07 Mar 2022 14:49:59 -0000 * 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