[PATCH] D127623: [Debug] [Coroutine] Adjust the scope and name for coroutine frame

Pedro Alves via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 17 08:08:53 PDT 2022


palves added a comment.

In D127623#3583060 <https://reviews.llvm.org/D127623#3583060>, @dblaikie wrote:

> In D127623#3580865 <https://reviews.llvm.org/D127623#3580865>, @ChuanqiXu wrote:
>
>> Oh, this one might be problematic. Now the debugger complains for the following command:
>>
>>     (gdb) # 0x418eb0 is the address of a coroutine frame
>>     (gdb )p (_ZL9coro_taski.coro_frame_ty)*0x418eb0
>>   Attempt to extract a component of a value that is not a structure.
>>
>> It looks like the debugger treat `_ZL9coro_taski.coro_frame_ty` as a function name to me.
>
> oh, `_ZL9coro_taski` is a function name - but because you were appending "__coro_frame_ty" to the end of it you were breaking the mangling and causing the consumer to no longer recognize it as a function?

This is no different from any other vendor extension in the mangled name (those separated by "."), like clones.  GDB is seeing the dot, and thinking
that you're trying to access a struct field called "coro_frame_ty", and then complains that _ZL9coro_task isn't a structure.   You can use single quotes
around the linkage name to disambiguate.  For example, using the program gdb's gdb.cp/cold-clone.exp testcase, we see the same:

(gdb) p _ZL3barv.cold
Attempt to extract a component of a value that is not a structure.
(gdb) p '_ZL3barv.cold'
$1 = {<text variable, no debug info>} 0x555555555065 <bar() [clone .cold]>
(gdb)

I think "." is right separator for appending vendor extensions to the linkage name.  It's what the Itanium spec specifies.  Suffixes other than "." will lead to more complicated code, I think.  E.g., for HIP externalized symbols, LLVM already uses "." .  Dealing with "." in that case in gdb/libiberty was easy.  Dealing with a suffix like __foo is harder (dot separator is part of the grammar), and it is potentially doing to slow down demangling.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D127623/new/

https://reviews.llvm.org/D127623



More information about the llvm-commits mailing list