Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: Andrey Turkin <andrey.turkin@gmail.com>
Cc: Tom Tromey <tom@tromey.com>,  Andrey Turkin via Gdb <gdb@sourceware.org>
Subject: Re: "previous frame inner to this frame" error when unwinding fibers
Date: Thu, 21 Dec 2023 17:30:15 -0700	[thread overview]
Message-ID: <87msu3dqp4.fsf@tromey.com> (raw)
In-Reply-To: <CAA7-ZoqVBcRrRVkBUJ0TBOQV=ES-pDqkYvmDLnT_V0rdR9SPww@mail.gmail.com> (Andrey Turkin's message of "Wed, 20 Dec 2023 17:18:55 +0300")

Andrey> Stackful coroutines I've ever encountered are very close to
Andrey> cooperative green threads - minus an underlying scheduler - in their
Andrey> implementation (separate stack + ucontext to store ABI-saved
Andrey> registers); a mental model is a bit different. I like the idea you
Andrey> proposed in that thread, with a caveat that the green threads would be
Andrey> more ephemeral. E.g. if I want to see the state of a coroutine, I'd
Andrey> spin up a green thread for it, switch to it and do whatever I'd
Andrey> usually do with a thread of execution; and then when I'm done I'd
Andrey> switch over to another thread and wind the green thread down so it is
Andrey> no more (or maybe I'd cache those threads and destroy them in bulk
Andrey> upon debuggee resume). As long as there is a Python API to manage them
Andrey> and as long as their model is similar enough to the OS threads' API,
Andrey> I'm sure we'd be able to code whatever solution suits one's specific
Andrey> needs.

Yeah, the API on the branch is very simple.  You can create a
GreenThread object, and this object supplies a few details: basically
registers and the thread name.  There's a way to indicate that the
thread has exited as well.  (I didn't get around to implementing a way
for 'bt' in a green thread to know when it should terminate.)

So, things like "frame view" could be rewritten in these terms, with the
idea being that the new green thread would simply be marked as exited
when the user switched away from it.  Coroutines could do the same, I
think.

Tom

  reply	other threads:[~2023-12-22  0:30 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-08 17:50 Andrey Turkin via Gdb
2023-12-10 22:30 ` Tom Tromey
2023-12-11  7:44   ` Andrey Turkin via Gdb
2023-12-11 17:46     ` Tom Tromey
2023-12-20 14:18       ` Andrey Turkin via Gdb
2023-12-22  0:30         ` Tom Tromey [this message]
2023-12-22 19:19           ` Tom Tromey
2024-01-04 10:00             ` Andrey Turkin via Gdb
2024-01-21 16:57               ` Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87msu3dqp4.fsf@tromey.com \
    --to=tom@tromey.com \
    --cc=andrey.turkin@gmail.com \
    --cc=gdb@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox