Skip to content

Commit 6e784af

Browse files
authored
[docs][coroutines] Update gdb debugger script (#162145)
In "Debugging C++ Coroutines", we provide a gdb script to aid with debugging C++ coroutines in gdb. This commit updates said script to make it easier to use and more robust. The commit contains the following user-facing changes: * `show-coro-frame` was replaced by a pretty-printer for `std::coroutine_handle`. This is much easier to use than a custom command since it works out-of-the-box with `p` and in my IDE's variable view (tested using VS-Code) * the new `get_coro_{frame,promise}` functions can be called from expressions to access nested members. Example: `p get_coro_promise(fib.coro_hdl)->current_state` * `async-bt` was replaced by a frame filter. This way, the builtin `bt` command directly shows all the async coroutine frames. Under the covers, the script became more robust: * For devirtualization, we now look up the `__coro_frame` variable in the resume function instead of relying on the `.coro_frame_ty` naming convention. Thereby, devirtualization works slightly better also on gcc-compiled binaries (however, there is still more work to be done). * We use the LLVM-generated `__coro_resume_<N>` labels to get the exact line at which a coroutine was suspended. * The continuation handle is now looked up by name instead of via dereferencing a calculated pointer. Thereby, the script should be simpler to adjust for various coroutine libraries without requiring pointer arithmetic hacks. Other sections of the documentation were adjusted accordingly to reflect the newly added features of the gdb script.
1 parent 69f9138 commit 6e784af

File tree

1 file changed

+271
-160
lines changed

1 file changed

+271
-160
lines changed

0 commit comments

Comments
 (0)