[Dwarf-discuss] Coroutines
Kyle Huey
khuey@pernos.co
Wed Feb 28 18:16:43 GMT 2024
On Wed, Feb 28, 2024 at 10:02 AM Adrian Prantl <aprantl@apple.com> wrote:
>
>
>
> On Feb 27, 2024, at 1:53 PM, Kyle Huey via Dwarf-discuss <dwarf-discuss@lists.dwarfstd.org> wrote:
>
> Put another way (forgive my pseudo code), if you have
>
> function silly_print() {
> delay = rand();
> // Point 1
> async_sleep(delay).await;
> // Point 2
> printf("Hello" );
> }
>
> function do_stuff() {
> runtime.async_dispatch(silly_print());
> runtime.async_dispatch(silly_print());
> }
>
> When stepping from point 1 to point 2, the breakpoint on the post-await funclet at point 2 has to be conditional on being on the async_context being the same async_context the debugger was using at point 1, right? And then you have to be able to determine what the "same async_context" is.
>
>
>
> LLDB implements this in a custom stepping plan that creates a conditional breakpoint where two async contexts are compared: First, there's the active async context at the time of the step. Next, the active async context at the time the breakpoint is hit. If the two async contexts are equal, then the breakpoint is discarded and the step has completed.
>
> -- adrian
Right, that makes sense. What is "are equal" here? Just a pointer comparison?
- Kyle
More information about the Dwarf-discuss
mailing list