gdb: simplify and future-proof looking up coroutine frame type

llvm recently updated [1] their coroutine debugging instructions.
They now recommend looking up the variable __coro_frame in the coroutine
function rather than constructing the name of the coroutine frame type
from the ramp function plus __coro_frame_ty.

Since the latter method no longer works with Clang 21 (I did not check
why), and since the former method is blessed as being more compatible,
switch to the recommended method. Since it works with both Clang 20 and
Clang 21, it future proofs the script.

[1] 6e784afcb5

Closes scylladb/scylladb#26590
This commit is contained in:
Avi Kivity
2025-10-16 20:20:59 +03:00
committed by Pavel Emelyanov
parent 1ab697693f
commit 87c0adb2fe

View File

@@ -6551,9 +6551,7 @@ class scylla_gdb_func_coro_frame(gdb.Function):
block = gdb.block_for_pc((ptr - 2).dereference())
# Look up the coroutine frame type.
# I don't understand why, but gdb has problems looking up the coro_frame_ty type if demangling is enabled.
with gdb.with_parameter("demangle-style", "none"):
coro_ty = gdb.lookup_type(f"{block.function.linkage_name}.coro_frame_ty").pointer()
coro_ty = block['__coro_frame'].type.pointer()
return (ptr - 2).cast(coro_ty)