[clang] [docs][coroutines] Update gdb debugger script (PR #162145)

Kazu Hirata via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 6 13:03:06 PDT 2025


================
@@ -756,6 +733,26 @@ should not be thought of as directly representing the variables in the C++
 source.
 
 
+Mapping suspension point indices to source code locations
+---------------------------------------------------------
+
+To aid in mapping a ``__coro_index`` back to a source code location, clang 21.0
+and newer emit special, compiler-generated labels for the suspension points.
+
+In gdb, we can use the ``info line`` command to get the source code location of
+the suspension point.
+
+::
+
+  (gdb) info line -function coro_task -label __coro_resume_2
+  Line 45 of "llvm-example.cpp" starts at address 0x1b1b <_ZL9coro_taski.resume+555> and ends at 0x1b46 <_ZL9coro_taski.resume+598>.
+  Line 45 of "llvm-example.cpp" starts at address 0x201b <_ZL9coro_taski.destroy+555> and ends at 0x2046 <_ZL9coro_taski.destroy+598>.
+  Line 45 of "llvm-example.cpp" starts at address 0x253b <_ZL9coro_taski.cleanup+555> and ends at 0x2566 <_ZL9coro_taski.cleanup+598>.
+
+LLDB does not support looking up labels, yet. That's also why LLDB's pretty-printer
----------------
kazutakahirata wrote:

`That's also why` is a bit conversational.  May I suggest this?

```suggestion
LLDB does not support looking up labels, yet. For this reason, LLDB's pretty-printer
```

https://github.com/llvm/llvm-project/pull/162145


More information about the cfe-commits mailing list