diff options
Diffstat (limited to 'lldb/test/Shell/SymbolFile')
10 files changed, 216 insertions, 64 deletions
diff --git a/lldb/test/Shell/SymbolFile/DWARF/deterministic-build.cpp b/lldb/test/Shell/SymbolFile/DWARF/deterministic-build.cpp index 9e79f23db2b7..0c86107fc963 100644 --- a/lldb/test/Shell/SymbolFile/DWARF/deterministic-build.cpp +++ b/lldb/test/Shell/SymbolFile/DWARF/deterministic-build.cpp @@ -3,9 +3,8 @@ // requires the ld64 linker, which clang invokes by default. // REQUIRES: system-darwin // RUN: %clang_host %s -g -c -o %t.o -// RUN: ZERO_AR_DATE=1 %clang_host %t.o -g -o %t -// RUN: %lldb %t -o "breakpoint set -f %s -l 11" -o run -o exit | FileCheck %s +// RUN: env ZERO_AR_DATE=1 %clang_host %t.o -g -o %t +// RUN: %lldb %t -o "breakpoint set -f %s -l 10" -o run -o exit | FileCheck %s // CHECK: stop reason = breakpoint - int main() { return 0; } diff --git a/lldb/test/Shell/SymbolFile/DWARF/dwo-missing-error.test b/lldb/test/Shell/SymbolFile/DWARF/dwo-missing-error.test index 2805bbb5df7d..72315e828474 100644 --- a/lldb/test/Shell/SymbolFile/DWARF/dwo-missing-error.test +++ b/lldb/test/Shell/SymbolFile/DWARF/dwo-missing-error.test @@ -11,12 +11,12 @@ # "a.out-dwo-missing-error.dwo". # RUN: rm -rf %t.compdir/ # RUN: mkdir -p %t.compdir/a/b/ -# RUN: cd %t.compdir/a/b/ +# RUN: pushd %t.compdir/a/b/ # RUN: %clang_host %S/Inputs/dwo-missing-error.c -glldb -gdwarf-5 \ # RUN: -gsplit-dwarf -fdebug-prefix-map=%t.compdir=. -o a.out # RUN: rm *.dwo # RUN: %lldb a.out -s %s -o exit 2>&1 | FileCheck %s -# RUN: cd - +# RUN: popd # Test the error message with an absolute DW_AT_comp_dir and DW_AT_dwo_name. # RUN: rm -rf %t.compdir/ diff --git a/lldb/test/Shell/SymbolFile/DWARF/dwo-static-data-member-access.test b/lldb/test/Shell/SymbolFile/DWARF/dwo-static-data-member-access.test index 6e4deae7b9a0..40d5e90097eb 100644 --- a/lldb/test/Shell/SymbolFile/DWARF/dwo-static-data-member-access.test +++ b/lldb/test/Shell/SymbolFile/DWARF/dwo-static-data-member-access.test @@ -4,6 +4,9 @@ # a DW_TAG_variable DIE, whose parent DIE is only # a forward declaration. +# UNSUPPORTED: system-darwin +# UNSUPPORTED: system-windows + # RUN: %clangxx_host %S/Inputs/dwo-static-data-member.cpp \ # RUN: -g -gdwarf-5 -gsplit-dwarf -flimit-debug-info -o %t # RUN: %lldb %t -s %s -o exit 2>&1 | FileCheck %s diff --git a/lldb/test/Shell/SymbolFile/DWARF/objcxx-forward-decls.test b/lldb/test/Shell/SymbolFile/DWARF/objcxx-forward-decls.test new file mode 100644 index 000000000000..30109c2943c9 --- /dev/null +++ b/lldb/test/Shell/SymbolFile/DWARF/objcxx-forward-decls.test @@ -0,0 +1,70 @@ +# REQUIRES: system-darwin + +# In this test we have two CUs with conflicting forward declaration +# depending on the CU language (one is C++ and the other is Objective-C++). +# We are then stopped in the C++ CU and try to print the type, at which +# point LLDB will try to make it into an Clang AST node. If LLDB were to +# interpret the type as C++ instead of Objective-C, we'd violate Clang +# invariants and crash. +# +# RUN: split-file %s %t +# RUN: %clangxx_host -c -g -x objective-c++ %t/request.m -o %t/request_objc.o +# RUN: %clangxx_host -c -g %t/main.cpp -o %t/main.o +# RUN: %clangxx_host %t/main.o %t/request_objc.o -framework Foundation -o %t/a.out +# +# RUN: %lldb %t/a.out \ +# RUN: -o "breakpoint set -p return -X main" \ +# RUN: -o run \ +# RUN: -o "frame variable r" \ +# RUN: -o exit | FileCheck %s +# +# RUN: dsymutil %t/a.out +# +# RUN: %lldb %t/a.out \ +# RUN: -o "breakpoint set -p return -X main" \ +# RUN: -o run \ +# RUN: -o "frame variable r" \ +# RUN: -o exit | FileCheck %s --check-prefix=CHECK-DSYM + +# CHECK: (lldb) frame variable r +# CHECK-NEXT: (Request) ::r = (m_request = "Hello, World!") + +# CHECK-DSYM: (lldb) frame variable r +# CHECK-DSYM-NEXT: (Request) ::r = (m_request = "Hello, World!") + +#--- lib.h +#ifndef LIB_H_IN +#define LIB_H_IN + +#ifdef __OBJC__ +@class NSString; +#else +class NSString; +#endif + +struct Request { + NSString * m_request = nullptr; +}; + +#endif // _H_IN + +#--- main.cpp +#include "lib.h" + +void process(Request *); + +Request r; + +int main() { + process(&r); + return 0; +} + +#--- request.m +#import <Foundation/Foundation.h> + +#include "lib.h" + +void process(Request * r) { + r->m_request = @"Hello, World!"; +} diff --git a/lldb/test/Shell/SymbolFile/NativePDB/Inputs/incomplete-tag-type.cpp b/lldb/test/Shell/SymbolFile/NativePDB/Inputs/incomplete-tag-type.cpp index c93033890544..d08f49d1014b 100644 --- a/lldb/test/Shell/SymbolFile/NativePDB/Inputs/incomplete-tag-type.cpp +++ b/lldb/test/Shell/SymbolFile/NativePDB/Inputs/incomplete-tag-type.cpp @@ -13,3 +13,8 @@ struct E { E(); }; E::E() = default; + +struct I { + I(); +}; +I::I() = default; diff --git a/lldb/test/Shell/SymbolFile/NativePDB/incomplete-tag-type.cpp b/lldb/test/Shell/SymbolFile/NativePDB/incomplete-tag-type.cpp deleted file mode 100644 index 7bc7e618667f..000000000000 --- a/lldb/test/Shell/SymbolFile/NativePDB/incomplete-tag-type.cpp +++ /dev/null @@ -1,45 +0,0 @@ -// clang-format off -// REQUIRES: lld, x86 - -// RUN: %clang_cl --target=x86_64-windows-msvc -c /Fo%t1.obj -- %p/Inputs/incomplete-tag-type.cpp -// RUN: %clang_cl --target=x86_64-windows-msvc /O1 /Z7 -c /Fo%t2.obj -- %s -// RUN: lld-link /debug:full /nodefaultlib /entry:main %t1.obj %t2.obj /out:%t.exe /pdb:%t.pdb -// RUN: %lldb -f %t.exe -o \ -// RUN: "settings set interpreter.stop-command-source-on-error false" \ -// RUN: -o "expression b" -o "expression d" -o "expression static_e_ref" -o "exit" 2>&1 | FileCheck %s - -// CHECK: (lldb) expression b -// CHECK: (B) $0 = {} -// CHECK: (lldb) expression d -// CHECK: (D) $1 = {} -// CHECK: (lldb) expression static_e_ref -// CHECK: error:{{.*}}incomplete type 'E' where a complete type is required - -// Complete base class. -struct A { int x; A(); }; -struct B : A {}; -B b; - -// Complete data member. -struct C { - C(); -}; - -struct D { - C c; -}; -D d; - -// Incomplete static data member should return error. -struct E { - E(); -}; - -struct F { - static E static_e; -}; - -E F::static_e = E(); -E& static_e_ref = F::static_e; - -int main(){} diff --git a/lldb/test/Shell/SymbolFile/NativePDB/incomplete-tag-type.test b/lldb/test/Shell/SymbolFile/NativePDB/incomplete-tag-type.test new file mode 100644 index 000000000000..f30866ccdd6f --- /dev/null +++ b/lldb/test/Shell/SymbolFile/NativePDB/incomplete-tag-type.test @@ -0,0 +1,109 @@ +# REQUIRES: lld, x86 + +# RUN: split-file %s %t + +# RUN: %clang_cl --target=x86_64-windows-msvc -c /Fo%t1.obj -- %p/Inputs/incomplete-tag-type.cpp +# RUN: %clang_cl --target=x86_64-windows-msvc /O1 /Z7 -c /Fo%t2.obj -- %t/main.cpp +# RUN: lld-link /debug:full /nodefaultlib /entry:main %t1.obj %t2.obj /out:%t.exe /pdb:%t.pdb + +# RUN: %lldb -f %t.exe -s %t/target-var.input 2>&1 | FileCheck %s --check-prefix=TARGET-VAR +# RUN: %lldb -f %t.exe -s %t/expr.input 2>&1 | FileCheck %s --check-prefix=EXPR + +#--- main.cpp + +// Complete base class. +struct A { int x; A(); }; +struct B : A {}; +B b; + +// Complete data member. +struct C { + C(); +}; + +struct D { + C c; +}; +D d; + +// Incomplete static data member should return error. +struct E { + E(); +}; + +struct F { + static E static_e; +}; + +E F::static_e = E(); +E& static_e_ref = F::static_e; + +struct G { + int foo = 1; +}; +struct H { + G g[2]; +}; +H h; + +struct I { + I(); +}; +struct J { + I i[2]; +}; +J j; + + +int main(){} + +#--- target-var.input + +target variable b +target variable d +target variable h +target variable j +target variable static_e_ref +exit + +#--- expr.input + +settings set interpreter.stop-command-source-on-error false +expression b +expression d +expression h +expression j +expression static_e_ref +exit + +# TARGET-VAR: (lldb) target variable b +# TARGET-VAR-NEXT: (B) b = (A = <incomplete type>) +# TARGET-VAR-NEXT: (lldb) target variable d +# TARGET-VAR-NEXT: (D) d = {} +# TARGET-VAR-NEXT: (lldb) target variable h +# TARGET-VAR-NEXT: (H) h = { +# TARGET-VAR-NEXT: g = { +# TARGET-VAR-NEXT: [0] = (foo = 1) +# TARGET-VAR-NEXT: [1] = (foo = 1) +# TARGET-VAR-NEXT: } +# TARGET-VAR-NEXT: } +# TARGET-VAR-NEXT: (lldb) target variable j +# TARGET-VAR-NEXT: (J) j = {} +# TARGET-VAR-NEXT: (lldb) target variable static_e_ref +# TARGET-VAR-NEXT: (E &) static_e_ref = 0x{{.*}} <incomplete type "E"> + +# EXPR: (lldb) expression b +# EXPR-NEXT: (B) $0 = {} +# EXPR-NEXT: (lldb) expression d +# EXPR-NEXT: (D) $1 = {} +# EXPR-NEXT: (lldb) expression h +# EXPR-NEXT: (H) $2 = { +# EXPR-NEXT: g = { +# EXPR-NEXT: [0] = (foo = 1) +# EXPR-NEXT: [1] = (foo = 1) +# EXPR-NEXT: } +# EXPR-NEXT: } +# EXPR-NEXT: (lldb) expression j +# EXPR-NEXT: (J) $3 = {} +# EXPR-NEXT: (lldb) expression static_e_ref +# EXPR: error:{{.*}}incomplete type 'E' where a complete type is required diff --git a/lldb/test/Shell/SymbolFile/PDB/expressions.test b/lldb/test/Shell/SymbolFile/PDB/expressions.test index 1932be74ca87..33b02e2d6796 100644 --- a/lldb/test/Shell/SymbolFile/PDB/expressions.test +++ b/lldb/test/Shell/SymbolFile/PDB/expressions.test @@ -1,6 +1,7 @@ REQUIRES: target-windows, msvc RUN: %build --compiler=msvc --nodefaultlib --output=%t.exe %S/Inputs/ExpressionsTest.cpp -RUN: not %lldb -b -s %S/Inputs/ExpressionsTest0.script -s %S/Inputs/ExpressionsTest1.script -s %S/Inputs/ExpressionsTest2.script -- %t.exe 2>&1 | FileCheck %s +RUN: env LLDB_USE_NATIVE_PDB_READER=0 not %lldb -b -s %S/Inputs/ExpressionsTest0.script -s %S/Inputs/ExpressionsTest1.script -s %S/Inputs/ExpressionsTest2.script -- %t.exe 2>&1 | FileCheck %s +RUN: env LLDB_USE_NATIVE_PDB_READER=1 not %lldb -b -s %S/Inputs/ExpressionsTest0.script -s %S/Inputs/ExpressionsTest1.script -s %S/Inputs/ExpressionsTest2.script -- %t.exe 2>&1 | FileCheck %s // Check the variable value through `expression` CHECK: (lldb) expression result diff --git a/lldb/test/Shell/SymbolFile/PDB/variables.test b/lldb/test/Shell/SymbolFile/PDB/variables.test index 9ee10f75c7e3..970d714c29c3 100644 --- a/lldb/test/Shell/SymbolFile/PDB/variables.test +++ b/lldb/test/Shell/SymbolFile/PDB/variables.test @@ -2,15 +2,27 @@ REQUIRES: system-windows, msvc RUN: mkdir -p %t.dir RUN: %build --compiler=clang-cl --mode=compile --arch=64 --nodefaultlib --output=%t.dir/VariablesTest.cpp.obj %S/Inputs/VariablesTest.cpp RUN: %build --compiler=msvc --mode=link --arch=64 --nodefaultlib --output=%t.dir/VariablesTest.cpp.exe %t.dir/VariablesTest.cpp.obj -RUN: lldb-test symbols %t.dir/VariablesTest.cpp.exe > %t.dir/VariablesTest.out -RUN: FileCheck --check-prefix=GLOBALS --input-file=%t.dir/VariablesTest.out %s -RUN: FileCheck --check-prefix=FUNC-F --input-file=%t.dir/VariablesTest.out %s -RUN: FileCheck --check-prefix=FUNC-MAIN --input-file=%t.dir/VariablesTest.out %s -RUN: FileCheck --check-prefix=FUNC-CONSTRUCTOR --input-file=%t.dir/VariablesTest.out %s -RUN: FileCheck --check-prefix=FUNC-MEMBER --input-file=%t.dir/VariablesTest.out %s +# Note: The native plugin creates a location list for variables that's only valid for the function. +# The DIA plugin creates a location expression that's always valid. This causes DIA to output +# one line per variable where the native plugin would output two (the second would contain the +# location information). This removes the second line from the output of the native plugin. +# It's done in both cases, because LLDB might not be compiled with the DIA SDK in which case +# the native plugin is always used. +RUN: env LLDB_USE_NATIVE_PDB_READER=0 lldb-test symbols %t.dir/VariablesTest.cpp.exe | sed '/^ \+\[0x/d' > %t.dir/VariablesTest.DIA.out +RUN: env LLDB_USE_NATIVE_PDB_READER=1 lldb-test symbols %t.dir/VariablesTest.cpp.exe | sed '/^ \+\[0x/d' > %t.dir/VariablesTest.Native.out +RUN: FileCheck --check-prefix=GLOBALS --input-file=%t.dir/VariablesTest.DIA.out %s +RUN: FileCheck --check-prefix=GLOBALS --input-file=%t.dir/VariablesTest.Native.out %s +RUN: FileCheck --check-prefix=FUNC-F --input-file=%t.dir/VariablesTest.DIA.out %s +RUN: FileCheck --check-prefix=FUNC-F --input-file=%t.dir/VariablesTest.Native.out %s +RUN: FileCheck --check-prefix=FUNC-MAIN --input-file=%t.dir/VariablesTest.DIA.out %s +RUN: FileCheck --check-prefix=FUNC-MAIN --input-file=%t.dir/VariablesTest.Native.out %s +RUN: FileCheck --check-prefix=FUNC-CONSTRUCTOR --input-file=%t.dir/VariablesTest.DIA.out %s +RUN: FileCheck --check-prefix=FUNC-CONSTRUCTOR --input-file=%t.dir/VariablesTest.Native.out %s +RUN: FileCheck --check-prefix=FUNC-MEMBER --input-file=%t.dir/VariablesTest.DIA.out %s +RUN: FileCheck --check-prefix=FUNC-MEMBER --input-file=%t.dir/VariablesTest.Native.out %s GLOBALS: Module [[MOD:.*]] -GLOBALS: SymbolFile pdb ([[MOD]]) +GLOBALS: SymbolFile {{(native-)?}}pdb ([[MOD]]) GLOBALS: CompileUnit{{.*}}, language = "c++", file = '{{.*}}\VariablesTest.cpp' GLOBALS-DAG: Variable{{.*}}, name = "g_IntVar" GLOBALS-SAME: scope = global, location = {{.*}}, external @@ -30,7 +42,7 @@ GLOBALS-DAG: Variable{{.*}}, name = "g_Const" GLOBALS-SAME: scope = ??? (2) GLOBALS: Function -FUNC-F: Function{{.*}}, mangled = ?f@@YAHHH@Z +FUNC-F: Function{{.*}}, {{mangled = \?f@@YAHHH@Z|demangled = f}} FUNC-F-NEXT: Block FUNC-F-NEXT: Variable{{.*}}, name = "var_arg1" FUNC-F-SAME: scope = parameter @@ -39,7 +51,7 @@ FUNC-F-SAME: scope = parameter FUNC-F-NEXT: Variable{{.*}}, name = "same_name_var" FUNC-F-SAME: scope = local -FUNC-MAIN: Function{{.*}}, mangled = main +FUNC-MAIN: Function{{.*}}, {{(de)?}}mangled = main FUNC-MAIN-NEXT: Block FUNC-MAIN-NEXT: Variable{{.*}}, name = "same_name_var" FUNC-MAIN-SAME: scope = local @@ -52,11 +64,10 @@ FUNC-MAIN-SAME: scope = local FUNC-MAIN-NEXT: Variable{{.*}}, name = "a" FUNC-MAIN-SAME: scope = local -FUNC-CONSTRUCTOR: Function{{.*}}, {{(de)?}}mangled = {{.*}}{{(Class::)?}}Class{{.*}} +FUNC-CONSTRUCTOR: Function{{.*}}, {{(de)?}}mangled = {{.*}}Class::Class{{.*}} FUNC-CONSTRUCTOR-NEXT: Block FUNC-CONSTRUCTOR-NEXT: Variable{{.*}}, name = "this" FUNC-CONSTRUCTOR-SAME: scope = parameter -FUNC-CONSTRUCTOR-SAME: artificial FUNC-CONSTRUCTOR-NEXT: Variable{{.*}}, name = "a" FUNC-CONSTRUCTOR-SAME: scope = parameter @@ -64,4 +75,3 @@ FUNC-MEMBER: Function{{.*}}, {{(de)?}}mangled = {{.*}}{{(Class::)?}}Func{{. FUNC-MEMBER-NEXT: Block FUNC-MEMBER-NEXT: Variable{{.*}}, name = "this" FUNC-MEMBER-SAME: scope = parameter -FUNC-MEMBER-SAME: artificial diff --git a/lldb/test/Shell/SymbolFile/add-dsym.test b/lldb/test/Shell/SymbolFile/add-dsym.test index 52d1a1363fee..9695ddc297aa 100644 --- a/lldb/test/Shell/SymbolFile/add-dsym.test +++ b/lldb/test/Shell/SymbolFile/add-dsym.test @@ -4,5 +4,5 @@ # HELP: Syntax: add-dsym <cmd-options> <filename> # RUN: yaml2obj %S/Inputs/a.yaml -o %t.out -# RUN: LLDB_APPLE_DSYMFORUUID_EXECUTABLE=%S/Inputs/dsymforuuid.sh %lldb %t.out -o 'add-dsym -u 41945CA4-5D9D-3CDE-82B4-37E4C09750B5' 2>&1 | FileCheck %s +# RUN: env LLDB_APPLE_DSYMFORUUID_EXECUTABLE=%S/Inputs/dsymforuuid.sh %lldb %t.out -o 'add-dsym -u 41945CA4-5D9D-3CDE-82B4-37E4C09750B5' 2>&1 | FileCheck %s # CHECK: UUID information was not found |
