Skip to content

Commit 2ff56f1

Browse files
committed
[LLDB] Don't ignore artificial variables and members for coroutines
* always populate all fields for the generated coroutine frame type; * make the artificial variables `__promise`, `__coro_frame` visible, so that they are present in the `frame var` command;
1 parent fbc6520 commit 2ff56f1

File tree

4 files changed

+13
-2
lines changed

4 files changed

+13
-2
lines changed

lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,10 @@ CPPLanguageRuntime::CPPLanguageRuntime(Process *process)
4141
: LanguageRuntime(process) {}
4242

4343
bool CPPLanguageRuntime::IsAllowedRuntimeValue(ConstString name) {
44-
return name == g_this;
44+
// FIXME: use a list when the list grows more.
45+
return name == g_this ||
46+
name == ConstString("__promise") ||
47+
name == ConstString("__coro_frame");
4548
}
4649

4750
bool CPPLanguageRuntime::GetObjectDescription(Stream &str,

lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3061,7 +3061,8 @@ void DWARFASTParserClang::ParseSingleMember(
30613061
// artificial member with (unnamed bitfield) padding.
30623062
// FIXME: This check should verify that this is indeed an artificial member
30633063
// we are supposed to ignore.
3064-
if (attrs.is_artificial) {
3064+
if (attrs.is_artificial &&
3065+
!TypeSystemClang::IsCoroutineFrameType(class_clang_type)) {
30653066
last_field_info.SetIsArtificial(true);
30663067
return;
30673068
}

lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -771,6 +771,10 @@ TypeSystemClang *TypeSystemClang::GetASTContext(clang::ASTContext *ast) {
771771
return clang_ast;
772772
}
773773

774+
bool TypeSystemClang::IsCoroutineFrameType(const CompilerType &Type) {
775+
return Type.GetTypeName().GetStringRef().ends_with(".coro_frame_ty");
776+
}
777+
774778
clang::MangleContext *TypeSystemClang::getMangleContext() {
775779
if (m_mangle_ctx_up == nullptr)
776780
m_mangle_ctx_up.reset(getASTContext().createMangleContext());

lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,9 @@ class TypeSystemClang : public TypeSystem {
154154

155155
static TypeSystemClang *GetASTContext(clang::ASTContext *ast_ctx);
156156

157+
// Returns true if the given type is a coroutine frame debug type.
158+
static bool IsCoroutineFrameType(const CompilerType &Type);
159+
157160
/// Returns the display name of this TypeSystemClang that indicates what
158161
/// purpose it serves in LLDB. Used for example in logs.
159162
llvm::StringRef getDisplayName() const { return m_display_name; }

0 commit comments

Comments
 (0)