Skip to content
Snippets Groups Projects
Commit 3e4ca896 authored by Iain Sandoe's avatar Iain Sandoe
Browse files

c++, coroutines: Make the resume index consistent for debug.


At present, we only update the resume index when we actually are
at the stage that the coroutine is considered suspended. This is
on the basis that it is UB to resume or destroy a coroutines that
is not suspended (and therefore we never need to access this value
otherwise).  However, it is possible that someone could set a debug
breakpoint on the resume which can be reached without suspending
if await_ready() returns true.  In that case, the debugger would
read an incorrect resume index.  Fixed by moving the update to
just before the test for ready.

gcc/cp/ChangeLog:

	* coroutines.cc (expand_one_await_expression): Update the
	resume index before checking if the coroutine is ready.

Signed-off-by: default avatarIain Sandoe <iain@sandoe.co.uk>
parent bd8c7e71
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment