diff mbox series

[8/8] coroutines: Make the continue handle visible to debug.

Message ID E2CD4397-DE5D-46B6-8B15-AE17CF1411FB@sandoe.co.uk
State New
Headers show
Series PATCH 3/8] coroutines: Support for debugging implementation state. | expand

Commit Message

Iain Sandoe Sept. 1, 2021, 10:56 a.m. UTC
When we have a suspend method that returns a coroutine handle
we transfer (hopefully symmetrically, i.e. with a tailcall) to
that new coroutine instead of returning to our resumer.

This adds the variable to the outer block for the actor function
which means that '_Coro_actor_continue' is visible to debug.

Contributory to PR 99215.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>

gcc/cp/ChangeLog:

	* coroutines.cc (build_actor_fn): Make _Coro_actor_continue
	visible to debug.
---
 gcc/cp/coroutines.cc | 1 +
 1 file changed, 1 insertion(+)

--

Comments

Jason Merrill Sept. 3, 2021, 2:25 p.m. UTC | #1
On 9/1/21 6:56 AM, Iain Sandoe wrote:
> 
> When we have a suspend method that returns a coroutine handle
> we transfer (hopefully symmetrically, i.e. with a tailcall) to
> that new coroutine instead of returning to our resumer.
> 
> This adds the variable to the outer block for the actor function
> which means that '_Coro_actor_continue' is visible to debug.
> 
> Contributory to PR 99215.

OK.

> Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
> 
> gcc/cp/ChangeLog:
> 
> 	* coroutines.cc (build_actor_fn): Make _Coro_actor_continue
> 	visible to debug.
> ---
>   gcc/cp/coroutines.cc | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/gcc/cp/coroutines.cc b/gcc/cp/coroutines.cc
> index 395e5c488e5..b32c5dc5e55 100644
> --- a/gcc/cp/coroutines.cc
> +++ b/gcc/cp/coroutines.cc
> @@ -2148,6 +2148,7 @@ build_actor_fn (location_t loc, tree coro_frame_type, tree actor, tree fnbody,
>   						 NULL_TREE);
>     
>     BIND_EXPR_VARS (actor_bind) = continuation;
> +  BLOCK_VARS (top_block) = BIND_EXPR_VARS (actor_bind) ;
>   
>     /* Link in the block associated with the outer scope of the re-written
>        function body.  */
>
diff mbox series

Patch

diff --git a/gcc/cp/coroutines.cc b/gcc/cp/coroutines.cc
index 395e5c488e5..b32c5dc5e55 100644
--- a/gcc/cp/coroutines.cc
+++ b/gcc/cp/coroutines.cc
@@ -2148,6 +2148,7 @@  build_actor_fn (location_t loc, tree coro_frame_type, tree actor, tree fnbody,
 						 NULL_TREE);
   
   BIND_EXPR_VARS (actor_bind) = continuation;
+  BLOCK_VARS (top_block) = BIND_EXPR_VARS (actor_bind) ;
 
   /* Link in the block associated with the outer scope of the re-written
      function body.  */