Files
clang-p2996/lldb/test/Shell/SymbolFile/NativePDB/global-ctor-dtor.cpp
Zequan Wu 0cfcd387f9 [lldb][NativePDB] Parse global variables. (#114303)
This doesn't parse S_CONSTANT case yet, because I found that the global
variable `std::strong_ordering::equal` is a S_CONSTANT and has type of
LF_STRUCTURE which is not currently handled when creating dwarf
expression for the variable. Left a TODO for it to finish later.

This makes `lldb/test/Shell/SymbolFile/PDB/ast-restore.test` and
`lldb/test/Shell/SymbolFile/PDB/calling-conventions-x86.test` pass on
windows with native pdb plugin only.
2024-11-01 14:15:54 -04:00

32 lines
841 B
C++

// clang-format off
// REQUIRES: lld, x86
// Global ctor and dtor should be globals decls.
// RUN: %clang_cl --target=x86_64-windows-msvc -Od -Z7 -GS- -fno-addrsig -c /Fo%t.obj -- %s
// RUN: lld-link -debug:full -nodefaultlib -entry:main %t.obj -out:%t.exe -pdb:%t.pdb -force
// RUN: lldb-test symbols --dump-ast %t.exe | FileCheck %s
struct A {
~A() {};
};
struct B {
static A glob;
};
A B::glob = A();
int main() {
return 0;
}
// CHECK: struct A {
// CHECK-NEXT: ~A();
// CHECK-NEXT: };
// CHECK-NEXT: A B::glob;
// CHECK-NEXT: static void B::`dynamic initializer for 'glob'();
// CHECK-NEXT: static void B::`dynamic atexit destructor for 'glob'();
// CHECK-NEXT: int main();
// CHECK-NEXT: static void _GLOBAL__sub_I_global_ctor_dtor.cpp();
// CHECK-NEXT: struct B {
// CHECK-NEXT: static A glob;
// CHECK-NEXT: };