public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH 0/8] coroutines: Use DECL_VALUE_EXPRs to assist in debug [PR99215]
@ 2021-09-01 10:51 Iain Sandoe
  2021-09-01 10:52 ` [PATCH 1/8] coroutines : Use DECL_VALUE_EXPR instead of rewriting vars Iain Sandoe
  0 siblings, 1 reply; 28+ messages in thread
From: Iain Sandoe @ 2021-09-01 10:51 UTC (permalink / raw)
  To: GCC Patches

Hi,

As discussed with Jason at WG21 in Prague - last year, this amends the
way in which the coroutine frame copies of variables are represented in
the front end lowering.  Instead of an explicit pointer->field we now
apply a DECL_VALUE_EXPR to each instead (where that value is the
pointer->field).

Although this was initially targeted at improving the debug experience
in fact it simplifies and shortens the code, and makes subsequent bug-
fixes easier to implement.  Therefore, I'm posting this series first.

In addition to the change applied to local variables:

  - there is an implementation of a mechanism to make the original
    function arguments debug-visible.  These are actually copied into
    the frame by the ramp function, so we create proxy vars for them 
    and attach a DECL_VALUE_EXPR for the frame copy.

  - It is likely that someone debugging a coroutine will want to inspect
    parts of the implementation state (especially items such as the
    suspend index and the promise object).  Although these are not a
    direct part of the user's source code, we expose them as synthetic
    variables in the implementation name-space _Coro_xxxxxx.

  Patches to follow:
  coroutines: Use DECL_VALUE_EXPR instead of rewriting vars.
  coroutines: Add a helper for creating local vars.
  coroutines: Support for debugging implementation state.
  coroutines: Make some of the artificial names more debugger-friendly.
  coroutines: Define and populate accessors for debug state.
  coroutines: Convert implementation variables to debug-friendly form.
  coroutines: Make proxy vars for the function arg copies.
  coroutines: Make the continue handle visible to debug.

 gcc/cp/coroutines.cc | 701 +++++++++++++++++++------------------------
 1 file changed, 304 insertions(+), 397 deletions(-)

This has been tested quite a bit over some months on x86_64-darwin and
on x86_64, powerpc64-linux,
OK for master?
backports?

thanks,
Iain

***
I've tested with GDB and LLDB that we now have visibility of the coro
state, local variables and function parameters.  However the debug
experience is still a little "jumpy" in respect of stepping through the
code - this is because synthesized expressions default to using
'input_location' as their location - which is typically pointing to the
closing brace of the function.  So I think there is more that can
be done for PR99215, but it's a different kind of problem from the one
being solved with the DECL_VALUE_EXPRs.


^ permalink raw reply	[flat|nested] 28+ messages in thread

end of thread, other threads:[~2021-09-07 17:26 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-01 10:51 [PATCH 0/8] coroutines: Use DECL_VALUE_EXPRs to assist in debug [PR99215] Iain Sandoe
2021-09-01 10:52 ` [PATCH 1/8] coroutines : Use DECL_VALUE_EXPR instead of rewriting vars Iain Sandoe
2021-09-01 10:53   ` [PATCH 2/8] coroutines: Add a helper for creating local vars Iain Sandoe
2021-09-01 10:53     ` PATCH 3/8] coroutines: Support for debugging implementation state Iain Sandoe
2021-09-01 10:54       ` [PATCH 4/8] coroutines: Make some of the artificial names more debugger-friendly Iain Sandoe
2021-09-01 10:54         ` [PATCH 5/8] coroutines: Define and populate accessors for debug state Iain Sandoe
2021-09-01 10:55           ` [PATCH 6/8] coroutines: Convert implementation variables to debug-friendly form Iain Sandoe
2021-09-01 10:56             ` [PATCH 7/8] coroutines: Make proxy vars for the function arg copies Iain Sandoe
2021-09-01 10:56               ` [PATCH 8/8] coroutines: Make the continue handle visible to debug Iain Sandoe
2021-09-03 14:25                 ` Jason Merrill
2021-09-03 14:07               ` [PATCH 7/8] coroutines: Make proxy vars for the function arg copies Jason Merrill
2021-09-03 14:23                 ` Iain Sandoe
2021-09-05 19:50                   ` [PATCH 7/8 v2] " Iain Sandoe
2021-09-07 17:26                     ` Jason Merrill
2021-09-03 13:52             ` [PATCH 6/8] coroutines: Convert implementation variables to debug-friendly form Jason Merrill
2021-09-03 13:56               ` Iain Sandoe
2021-09-03 14:12                 ` Jason Merrill
2021-09-03 14:21                   ` Iain Sandoe
2021-09-05 19:47                     ` Iain Sandoe
2021-09-07 17:23                       ` Jason Merrill
2021-09-03 13:39           ` [PATCH 5/8] coroutines: Define and populate accessors for debug state Jason Merrill
2021-09-03 13:41             ` Iain Sandoe
2021-09-03 13:42             ` Iain Sandoe
2021-09-03 13:44               ` Jason Merrill
2021-09-03 13:35         ` [PATCH 4/8] coroutines: Make some of the artificial names more debugger-friendly Jason Merrill
2021-09-03 13:31       ` PATCH 3/8] coroutines: Support for debugging implementation state Jason Merrill
2021-09-02 21:52     ` [PATCH 2/8] coroutines: Add a helper for creating local vars Jason Merrill
2021-09-02 21:51   ` [PATCH 1/8] coroutines : Use DECL_VALUE_EXPR instead of rewriting vars Jason Merrill

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).