[Lldb-commits] [lldb] [lldb][DWARFASTParserClang] GetClangDeclForDIE: don't create VarDecl for static data members (PR #77155)

David Blaikie via lldb-commits lldb-commits at lists.llvm.org
Fri Jan 5 17:56:46 PST 2024


================
@@ -0,0 +1,23 @@
+# UNSUPPORTED: system-darwin, system-windows
+
+# In DWARFv5, C++ static data members are represented
+# as DW_TAG_variable. We make sure LLDB's expression
+# evaluator doesn't crash when trying to parse such
+# a DW_TAG_variable DIE, whose parent DIE is only
+# a forward declaration.
+
+# RUN: %clangxx_host %S/Inputs/dwo-static-data-member.cpp \
+# RUN:   -g -gdwarf-5 -gsplit-dwarf -o %t
+# RUN: %lldb %t -s %s -o exit 2>&1 | FileCheck %s
+
+breakpoint set -n main
+process launch
+
+# CHECK: Process {{.*}} stopped
+
+# There is no definition for NoCtor anywhere
+# in the debug-info, so LLDB can't evaluate
+# this expression.
+expression NoCtor::i
+# CHECK-LABEL: expression NoCtor::i
+# CHECK:       use of undeclared identifier 'NoCtor'
----------------
dwblaikie wrote:

(totally side note: Pity about how this fails
(a) gdb can evaluate this, so it's a bug/limitation in lldb (though it sounds like lldb-eval maybe can handle this, hopefully, and possibly without the need for a running process either)
(b) `NoCtor` isn't undeclared - it's declared but not defined, but even saying that wouldn't be quite accurate/wouldn't explain why it can't be evaluated by the debugger, since the info for the `i` member is present

But that's just me rambling/not relevant to this bug/regression/immediate issue)

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


More information about the lldb-commits mailing list