diff options
Diffstat (limited to 'lldb/test/Shell')
21 files changed, 646 insertions, 38 deletions
diff --git a/lldb/test/Shell/Expr/Inputs/objc-cast.cpp b/lldb/test/Shell/Expr/Inputs/objc-cast.cpp new file mode 100644 index 000000000000..76e8197013aa --- /dev/null +++ b/lldb/test/Shell/Expr/Inputs/objc-cast.cpp @@ -0,0 +1 @@ +int main() { return 0; } diff --git a/lldb/test/Shell/Expr/TestObjCIDCast.test b/lldb/test/Shell/Expr/TestObjCIDCast.test new file mode 100644 index 000000000000..0611171da09e --- /dev/null +++ b/lldb/test/Shell/Expr/TestObjCIDCast.test @@ -0,0 +1,9 @@ +// UNSUPPORTED: system-linux, system-windows +// +// RUN: %clangxx_host %p/Inputs/objc-cast.cpp -g -o %t +// RUN: %lldb %t \ +// RUN: -o "b main" -o run -o "expression --language objc -- *(id)0x1" \ +// RUN: 2>&1 | FileCheck %s + +// CHECK: (lldb) expression --language objc -- *(id)0x1 +// CHECK: error: Couldn't apply expression side effects : Couldn't dematerialize a result variable: couldn't read its memory diff --git a/lldb/test/Shell/Expr/TestObjCInCXXContext.test b/lldb/test/Shell/Expr/TestObjCInCXXContext.test new file mode 100644 index 000000000000..8537799bdeb6 --- /dev/null +++ b/lldb/test/Shell/Expr/TestObjCInCXXContext.test @@ -0,0 +1,21 @@ +// UNSUPPORTED: system-linux, system-windows + +// Tests that we don't consult the the Objective-C runtime +// plugin when in a purely C++ context. +// +// RUN: %clangxx_host %p/Inputs/objc-cast.cpp -g -o %t +// RUN: %lldb %t \ +// RUN: -o "b main" -o run \ +// RUN: -o "expression --language objective-c -- NSString * a; a" \ +// RUN: -o "expression --language objective-c++ -- NSString * b; b" \ +// RUN: -o "expression NSString" \ +// RUN: 2>&1 | FileCheck %s + +// CHECK: (lldb) expression --language objective-c -- NSString * a; a +// CHECK-NEXT: (NSString *){{.*}}= nil + +// CHECK: (lldb) expression --language objective-c++ -- NSString * b; b +// CHECK-NEXT: (NSString *){{.*}}= nil + +// CHECK: (lldb) expression NSString +// CHECK-NEXT: error:{{.*}} use of undeclared identifier 'NSString' diff --git a/lldb/test/Shell/Process/UnsupportedLanguage.test b/lldb/test/Shell/Process/UnsupportedLanguage.test index 8cf0c048e366..d7e6e5de7751 100644 --- a/lldb/test/Shell/Process/UnsupportedLanguage.test +++ b/lldb/test/Shell/Process/UnsupportedLanguage.test @@ -1,8 +1,17 @@ -Test warnings. +Test unsupported language warning + REQUIRES: shell + RUN: %clang_host %S/Inputs/true.c -std=c99 -g -c -S -emit-llvm -o - \ RUN: | sed -e 's/DW_LANG_C99/DW_LANG_Mips_Assembler/g' >%t.ll RUN: %clang_host %t.ll -g -o %t.exe -RUN: %lldb -o "b main" -o r -o q -b %t.exe 2>&1 | FileCheck %s +RUN: %lldb -o "b main" -o r -o q -b %t.exe 2>&1 | FileCheck %s --check-prefix ASM + +ASM-NOT: This version of LLDB has no plugin for the language "assembler" + +RUN: %clang_host %S/Inputs/true.c -std=c99 -g -c -S -emit-llvm -o - \ +RUN: | sed -e 's/DW_LANG_C99/DW_LANG_Cobol74/g' >%t.ll +RUN: %clang_host %t.ll -g -o %t.exe +RUN: %lldb -o "b main" -o r -o q -b %t.exe 2>&1 | FileCheck %s --check-prefix COBOL -CHECK: This version of LLDB has no plugin for the language "assembler" +COBOL: This version of LLDB has no plugin for the language "cobol74" diff --git a/lldb/test/Shell/SymbolFile/DWARF/clang-gmodules-type-lookup.c b/lldb/test/Shell/SymbolFile/DWARF/clang-gmodules-type-lookup.c index f42a5d3907df..a8da692e57b1 100644 --- a/lldb/test/Shell/SymbolFile/DWARF/clang-gmodules-type-lookup.c +++ b/lldb/test/Shell/SymbolFile/DWARF/clang-gmodules-type-lookup.c @@ -7,7 +7,7 @@ // RUN: %clangxx_host -g -gmodules -fmodules -std=c99 -x c -include-pch %t.pch %s -c -o %t.o // RUN: %clangxx_host %t.o -o %t.exe // RUN: lldb-test symbols -dump-clang-ast -find type --language=C99 \ -// RUN: -compiler-context 'AnyModule:*,Struct:TypeFromPCH' %t.exe | FileCheck %s +// RUN: -compiler-context 'AnyModule:*,ClassOrStruct:TypeFromPCH' %t.exe | FileCheck %s anchor_t anchor; diff --git a/lldb/test/Shell/SymbolFile/DWARF/x86/DW_AT_data_bit_offset-DW_OP_stack_value.s b/lldb/test/Shell/SymbolFile/DWARF/x86/DW_AT_data_bit_offset-DW_OP_stack_value.s index 074da09bc61e..f82dd19466e6 100644 --- a/lldb/test/Shell/SymbolFile/DWARF/x86/DW_AT_data_bit_offset-DW_OP_stack_value.s +++ b/lldb/test/Shell/SymbolFile/DWARF/x86/DW_AT_data_bit_offset-DW_OP_stack_value.s @@ -51,7 +51,7 @@ # # DW_AT_location (DW_OP_constu 0x64a40101, DW_OP_stack_value) # -# to work-around a seperate bug. +# to work-around a separate bug. .zerofill __DATA,__bss,__type_anchor,4,2 ## @_type_anchor .zerofill __DATA,__bss,_ug.0,1,2 ## @ug.0 diff --git a/lldb/test/Shell/SymbolFile/DWARF/x86/apple-index-is-used.cpp b/lldb/test/Shell/SymbolFile/DWARF/x86/apple-index-is-used.cpp index 00440531e99f..5bcb2cbcbbe2 100644 --- a/lldb/test/Shell/SymbolFile/DWARF/x86/apple-index-is-used.cpp +++ b/lldb/test/Shell/SymbolFile/DWARF/x86/apple-index-is-used.cpp @@ -1,5 +1,5 @@ // Test that we use the apple indexes. -// RUN: %clang %s -g -c -o %t --target=x86_64-apple-macosx +// RUN: %clang %s -g -c -o %t --target=x86_64-apple-macosx -gdwarf-4 // RUN: lldb-test symbols %t | FileCheck %s // CHECK: .apple_names index present diff --git a/lldb/test/Shell/SymbolFile/DWARF/x86/class-type-nullptr-deref.s b/lldb/test/Shell/SymbolFile/DWARF/x86/class-type-nullptr-deref.s index c7aea06bf909..4fbc1894c8c4 100644 --- a/lldb/test/Shell/SymbolFile/DWARF/x86/class-type-nullptr-deref.s +++ b/lldb/test/Shell/SymbolFile/DWARF/x86/class-type-nullptr-deref.s @@ -4,7 +4,7 @@ # RUN: llvm-mc --triple x86_64-pc-linux %s --filetype=obj -o %t # RUN: %lldb %t -o "target variable x" -o exit 2>&1 | FileCheck %s -# CHECK: 'Unable to determine byte size.' +# CHECK: Unable to determine byte size. # This tests a fix for a crash. If things are working we don't get a segfault. diff --git a/lldb/test/Shell/SymbolFile/DWARF/x86/compilercontext.ll b/lldb/test/Shell/SymbolFile/DWARF/x86/compilercontext.ll index 149f7efbbfbe..8fa45e955abf 100644 --- a/lldb/test/Shell/SymbolFile/DWARF/x86/compilercontext.ll +++ b/lldb/test/Shell/SymbolFile/DWARF/x86/compilercontext.ll @@ -1,19 +1,19 @@ ; Test finding types by CompilerContext. ; RUN: llc %s -filetype=obj -o %t.o ; RUN: lldb-test symbols %t.o -find=type --language=C99 \ -; RUN: -compiler-context="Module:CModule,Module:SubModule,Struct:FromSubmoduleX" \ +; RUN: -compiler-context="Module:CModule,Module:SubModule,ClassOrStruct:FromSubmoduleX" \ ; RUN: | FileCheck %s --check-prefix=NORESULTS ; RUN: lldb-test symbols %t.o -find=type --language=C++ \ -; RUN: -compiler-context="Module:CModule,Module:SubModule,Struct:FromSubmodule" \ +; RUN: -compiler-context="Module:CModule,Module:SubModule,ClassOrStruct:FromSubmodule" \ ; RUN: | FileCheck %s --check-prefix=NORESULTS ; RUN: lldb-test symbols %t.o -find=type --language=C99 \ -; RUN: -compiler-context="Module:CModule,Module:SubModule,Struct:FromSubmodule" \ +; RUN: -compiler-context="Module:CModule,Module:SubModule,ClassOrStruct:FromSubmodule" \ ; RUN: | FileCheck %s ; RUN: lldb-test symbols %t.o -find=type --language=C99 \ -; RUN: -compiler-context="Module:CModule,AnyModule:*,Struct:FromSubmodule" \ +; RUN: -compiler-context="Module:CModule,AnyModule:*,ClassOrStruct:FromSubmodule" \ ; RUN: | FileCheck %s ; RUN: lldb-test symbols %t.o -find=type --language=C99 \ -; RUN: -compiler-context="AnyModule:*,Struct:FromSubmodule" \ +; RUN: -compiler-context="AnyModule:*,ClassOrStruct:FromSubmodule" \ ; RUN: | FileCheck %s ; RUN: lldb-test symbols %t.o -find=type --language=C99 \ ; RUN: -compiler-context="Module:CModule,Module:SubModule,AnyType:FromSubmodule" \ diff --git a/lldb/test/Shell/SymbolFile/DWARF/x86/debug-names-signature.s b/lldb/test/Shell/SymbolFile/DWARF/x86/debug-names-signature.s new file mode 100644 index 000000000000..7b845a72bbed --- /dev/null +++ b/lldb/test/Shell/SymbolFile/DWARF/x86/debug-names-signature.s @@ -0,0 +1,265 @@ +## Test that we can correctly complete types even if the debug_names index +## contains entries referring to declaration dies (clang emitted entries like +## that until bd5c6367bd7). +## +## This test consists of two compile units and one type unit. CU1 has the +## definition of a variable, but only a forward-declaration of its type. When +## attempting to find a definition, the debug_names lookup will return the DIE +## in CU0, which is also a forward-declaration (with a reference to a type +## unit). LLDB needs to find the definition of the type within the type unit. + +# RUN: llvm-mc -triple=x86_64-pc-linux -filetype=obj %s > %t +# RUN: %lldb %t -o "target variable s" -o exit | FileCheck %s + +# CHECK: (lldb) target variable s +# CHECK-NEXT: (Struct) s = (member = 47) + + .data + .p2align 2, 0x0 + .long 0 +s: + .long 47 # 0x2f + + .section .debug_abbrev,"",@progbits + .byte 1 # Abbreviation Code + .byte 65 # DW_TAG_type_unit + .byte 1 # DW_CHILDREN_yes + .byte 19 # DW_AT_language + .byte 5 # DW_FORM_data2 + .byte 0 # EOM(1) + .byte 0 # EOM(2) + .byte 2 # Abbreviation Code + .byte 19 # DW_TAG_structure_type + .byte 1 # DW_CHILDREN_yes + .byte 54 # DW_AT_calling_convention + .byte 11 # DW_FORM_data1 + .byte 3 # DW_AT_name + .byte 14 # DW_FORM_strp + .byte 11 # DW_AT_byte_size + .byte 11 # DW_FORM_data1 + .byte 0 # EOM(1) + .byte 0 # EOM(2) + .byte 3 # Abbreviation Code + .byte 13 # DW_TAG_member + .byte 0 # DW_CHILDREN_no + .byte 3 # DW_AT_name + .byte 14 # DW_FORM_strp + .byte 73 # DW_AT_type + .byte 19 # DW_FORM_ref4 + .byte 56 # DW_AT_data_member_location + .byte 11 # DW_FORM_data1 + .byte 0 # EOM(1) + .byte 0 # EOM(2) + .byte 4 # Abbreviation Code + .byte 36 # DW_TAG_base_type + .byte 0 # DW_CHILDREN_no + .byte 3 # DW_AT_name + .byte 14 # DW_FORM_strp + .byte 62 # DW_AT_encoding + .byte 11 # DW_FORM_data1 + .byte 11 # DW_AT_byte_size + .byte 11 # DW_FORM_data1 + .byte 0 # EOM(1) + .byte 0 # EOM(2) + .byte 5 # Abbreviation Code + .byte 17 # DW_TAG_compile_unit + .byte 1 # DW_CHILDREN_yes + .byte 37 # DW_AT_producer + .byte 8 # DW_FORM_string + .byte 19 # DW_AT_language + .byte 5 # DW_FORM_data2 + .byte 0 # EOM(1) + .byte 0 # EOM(2) + .byte 6 # Abbreviation Code + .byte 52 # DW_TAG_variable + .byte 0 # DW_CHILDREN_no + .byte 3 # DW_AT_name + .byte 14 # DW_FORM_strp + .byte 73 # DW_AT_type + .byte 19 # DW_FORM_ref4 + .byte 2 # DW_AT_location + .byte 24 # DW_FORM_exprloc + .byte 0 # EOM(1) + .byte 0 # EOM(2) + .byte 7 # Abbreviation Code + .byte 19 # DW_TAG_structure_type + .byte 0 # DW_CHILDREN_no + .byte 60 # DW_AT_declaration + .byte 25 # DW_FORM_flag_present + .byte 105 # DW_AT_signature + .byte 32 # DW_FORM_ref_sig8 + .byte 0 # EOM(1) + .byte 0 # EOM(2) + .byte 8 # Abbreviation Code + .byte 19 # DW_TAG_structure_type + .byte 0 # DW_CHILDREN_no + .byte 3 # DW_AT_name + .byte 14 # DW_FORM_strp + .byte 60 # DW_AT_declaration + .byte 25 # DW_FORM_flag_present + .byte 0 # EOM(1) + .byte 0 # EOM(2) + .byte 0 # EOM(3) + + .section .debug_info,"",@progbits +.Ltu_begin0: + .long .Ldebug_info_end0-.Ldebug_info_start0 # Length of Unit +.Ldebug_info_start0: + .short 5 # DWARF version number + .byte 2 # DWARF Unit Type + .byte 8 # Address Size (in bytes) + .long .debug_abbrev # Offset Into Abbrev. Section + .quad 4878254330033667422 # Type Signature + .long .LStruct_def-.Ltu_begin0 # Type DIE Offset + .byte 1 # Abbrev [1] 0x18:0x20 DW_TAG_type_unit + .short 33 # DW_AT_language +.LStruct_def: + .byte 2 # Abbrev [2] 0x23:0x10 DW_TAG_structure_type + .byte 5 # DW_AT_calling_convention + .long .Linfo_string6 # DW_AT_name + .byte 4 # DW_AT_byte_size + .byte 3 # Abbrev [3] 0x29:0x9 DW_TAG_member + .long .Linfo_string4 # DW_AT_name + .long .Lint-.Ltu_begin0 # DW_AT_type + .byte 0 # DW_AT_data_member_location + .byte 0 # End Of Children Mark +.Lint: + .byte 4 # Abbrev [4] 0x33:0x4 DW_TAG_base_type + .long .Linfo_string5 # DW_AT_name + .byte 5 # DW_AT_encoding + .byte 4 # DW_AT_byte_size + .byte 0 # End Of Children Mark +.Ldebug_info_end0: + +.Lcu_begin0: + .long .Ldebug_info_end1-.Ldebug_info_start1 # Length of Unit +.Ldebug_info_start1: + .short 5 # DWARF version number + .byte 1 # DWARF Unit Type + .byte 8 # Address Size (in bytes) + .long .debug_abbrev # Offset Into Abbrev. Section + .byte 5 # Abbrev [5] 0xc:0x27 DW_TAG_compile_unit + .asciz "Hand-written DWARF" # DW_AT_producer + .short 33 # DW_AT_language +.Ls: + .byte 6 # Abbrev [6] 0x1e:0xb DW_TAG_variable + .long .Linfo_string3 # DW_AT_name + .long .LStruct_decl2-.Lcu_begin0 # DW_AT_type + .byte 9 # DW_AT_location + .byte 3 + .quad s +.LStruct_decl2: + .byte 8 # Abbrev [8] 0x29:0x9 DW_TAG_structure_type + .long .Linfo_string6 # DW_AT_name + # DW_AT_declaration + .byte 0 # End Of Children Mark +.Ldebug_info_end1: + +.Lcu_begin1: + .long .Ldebug_info_end2-.Ldebug_info_start2 # Length of Unit +.Ldebug_info_start2: + .short 5 # DWARF version number + .byte 1 # DWARF Unit Type + .byte 8 # Address Size (in bytes) + .long .debug_abbrev # Offset Into Abbrev. Section + .byte 5 # Abbrev [5] 0xc:0x27 DW_TAG_compile_unit + .asciz "Hand-written DWARF" # DW_AT_producer + .short 33 # DW_AT_language +.LStruct_decl: + .byte 7 # Abbrev [7] 0x29:0x9 DW_TAG_structure_type + # DW_AT_declaration + .quad 4878254330033667422 # DW_AT_signature + .byte 0 # End Of Children Mark +.Ldebug_info_end2: + + .section .debug_str,"MS",@progbits,1 +.Linfo_string3: + .asciz "s" # string offset=60 +.Linfo_string4: + .asciz "member" # string offset=62 +.Linfo_string5: + .asciz "int" # string offset=69 +.Linfo_string6: + .asciz "Struct" # string offset=73 + + .section .debug_names,"",@progbits + .long .Lnames_end0-.Lnames_start0 # Header: unit length +.Lnames_start0: + .short 5 # Header: version + .short 0 # Header: padding + .long 2 # Header: compilation unit count + .long 1 # Header: local type unit count + .long 0 # Header: foreign type unit count + .long 0 # Header: bucket count + .long 3 # Header: name count + .long .Lnames_abbrev_end0-.Lnames_abbrev_start0 # Header: abbreviation table size + .long 8 # Header: augmentation string size + .ascii "LLVM0700" # Header: augmentation string + .long .Lcu_begin0 # Compilation unit 0 + .long .Lcu_begin1 # Compilation unit 1 + .long .Ltu_begin0 # Type unit 0 + .long .Linfo_string6 # String in Bucket 0: Struct + .long .Linfo_string3 # String in Bucket 1: s + .long .Linfo_string5 # String in Bucket 2: int + .long .Lnames1-.Lnames_entries0 # Offset in Bucket 0 + .long .Lnames2-.Lnames_entries0 # Offset in Bucket 1 + .long .Lnames0-.Lnames_entries0 # Offset in Bucket 2 +.Lnames_abbrev_start0: + .byte 1 # Abbrev code + .byte 19 # DW_TAG_structure_type + .byte 2 # DW_IDX_type_unit + .byte 11 # DW_FORM_data1 + .byte 3 # DW_IDX_die_offset + .byte 19 # DW_FORM_ref4 + .byte 0 # End of abbrev + .byte 0 # End of abbrev + .byte 2 # Abbrev code + .byte 52 # DW_TAG_variable + .byte 1 # DW_IDX_compile_unit + .byte 11 # DW_FORM_data1 + .byte 3 # DW_IDX_die_offset + .byte 19 # DW_FORM_ref4 + .byte 0 # End of abbrev + .byte 0 # End of abbrev + .byte 3 # Abbrev code + .byte 36 # DW_TAG_base_type + .byte 2 # DW_IDX_type_unit + .byte 11 # DW_FORM_data1 + .byte 3 # DW_IDX_die_offset + .byte 19 # DW_FORM_ref4 + .byte 0 # End of abbrev + .byte 0 # End of abbrev + .byte 4 # Abbrev code + .byte 19 # DW_TAG_structure_type + .byte 1 # DW_IDX_compile_unit + .byte 11 # DW_FORM_data1 + .byte 3 # DW_IDX_die_offset + .byte 19 # DW_FORM_ref4 + .byte 0 # End of abbrev + .byte 0 # End of abbrev + .byte 0 # End of abbrev list +.Lnames_abbrev_end0: +.Lnames_entries0: +.Lnames1: + .byte 4 # Abbreviation code + .byte 1 # DW_IDX_compile_unit + .long .LStruct_decl-.Lcu_begin1 # DW_IDX_die_offset + .byte 1 # Abbreviation code + .byte 0 # DW_IDX_type_unit + .long .LStruct_def-.Ltu_begin0 # DW_IDX_die_offset + .byte 0 + # End of list: Struct +.Lnames2: + .byte 2 # Abbreviation code + .byte 0 # DW_IDX_compile_unit + .long .Ls-.Lcu_begin0 # DW_IDX_die_offset + .byte 0 + # End of list: s +.Lnames0: + .byte 3 # Abbreviation code + .byte 0 # DW_IDX_type_unit + .long .Lint-.Ltu_begin0 # DW_IDX_die_offset + .byte 0 + # End of list: int + .p2align 2, 0x0 +.Lnames_end0: diff --git a/lldb/test/Shell/SymbolFile/DWARF/x86/debug-names-static-constexpr-member.s b/lldb/test/Shell/SymbolFile/DWARF/x86/debug-names-static-constexpr-member.s new file mode 100644 index 000000000000..9cb534207c3d --- /dev/null +++ b/lldb/test/Shell/SymbolFile/DWARF/x86/debug-names-static-constexpr-member.s @@ -0,0 +1,169 @@ +## Check that lldb can locate a static constant variable when its declaration is +## referenced by a debug_names index. This is a non-conforming extension used by +## dsymutil. + +# RUN: llvm-mc -triple=x86_64-pc-linux -filetype=obj %s > %t +# RUN: %lldb %t -o "target variable Class::constant" \ +# RUN: -o "expr -l c++ -- Class::constant" -o exit | FileCheck %s + +# CHECK: (lldb) target variable Class::constant +# CHECK-NEXT: (const int) Class::constant = 47 +# CHECK: (lldb) expr -l c++ -- Class::constant +# CHECK-NEXT: (const int) $0 = 47 + + .section .debug_abbrev,"",@progbits + .byte 1 # Abbreviation Code + .byte 17 # DW_TAG_compile_unit + .byte 1 # DW_CHILDREN_yes + .byte 37 # DW_AT_producer + .byte 8 # DW_FORM_string + .byte 19 # DW_AT_language + .byte 5 # DW_FORM_data2 + .byte 0 # EOM(1) + .byte 0 # EOM(2) + .byte 3 # Abbreviation Code + .byte 2 # DW_TAG_class_type + .byte 1 # DW_CHILDREN_yes + .byte 54 # DW_AT_calling_convention + .byte 11 # DW_FORM_data1 + .byte 3 # DW_AT_name + .byte 14 # DW_FORM_strp + .byte 11 # DW_AT_byte_size + .byte 11 # DW_FORM_data1 + .byte 0 # EOM(1) + .byte 0 # EOM(2) + .byte 4 # Abbreviation Code + .byte 52 # DW_TAG_variable + .byte 0 # DW_CHILDREN_no + .byte 3 # DW_AT_name + .byte 14 # DW_FORM_strp + .byte 73 # DW_AT_type + .byte 19 # DW_FORM_ref4 + .byte 63 # DW_AT_external + .byte 25 # DW_FORM_flag_present + .byte 60 # DW_AT_declaration + .byte 25 # DW_FORM_flag_present + .byte 28 # DW_AT_const_value + .byte 13 # DW_FORM_sdata + .byte 0 # EOM(1) + .byte 0 # EOM(2) + .byte 5 # Abbreviation Code + .byte 38 # DW_TAG_const_type + .byte 0 # DW_CHILDREN_no + .byte 73 # DW_AT_type + .byte 19 # DW_FORM_ref4 + .byte 0 # EOM(1) + .byte 0 # EOM(2) + .byte 6 # Abbreviation Code + .byte 36 # DW_TAG_base_type + .byte 0 # DW_CHILDREN_no + .byte 3 # DW_AT_name + .byte 14 # DW_FORM_strp + .byte 62 # DW_AT_encoding + .byte 11 # DW_FORM_data1 + .byte 11 # DW_AT_byte_size + .byte 11 # DW_FORM_data1 + .byte 0 # EOM(1) + .byte 0 # EOM(2) + .byte 0 # EOM(3) + .section .debug_info,"",@progbits +.Lcu_begin0: + .long .Ldebug_info_end0-.Ldebug_info_start0 # Length of Unit +.Ldebug_info_start0: + .short 5 # DWARF version number + .byte 1 # DWARF Unit Type + .byte 8 # Address Size (in bytes) + .long .debug_abbrev # Offset Into Abbrev. Section + .byte 1 # Abbrev [1] 0xc:0x40 DW_TAG_compile_unit + .asciz "Hand-written DWARF" # DW_AT_producer + .short 33 # DW_AT_language +.LClass: + .byte 3 # Abbrev [3] 0x29:0x10 DW_TAG_class_type + .byte 5 # DW_AT_calling_convention + .long .Linfo_string4 # DW_AT_name + .byte 1 # DW_AT_byte_size +.Lvariable: + .byte 4 # Abbrev [4] 0x2f:0x9 DW_TAG_variable + .long .Linfo_string5 # DW_AT_name + .long .Lconst_int-.Lcu_begin0 # DW_AT_type + # DW_AT_external + # DW_AT_declaration + .byte 47 # DW_AT_const_value + .byte 0 # End Of Children Mark +.Lconst_int: + .byte 5 # Abbrev [5] 0x39:0x5 DW_TAG_const_type + .long .Lint-.Lcu_begin0 # DW_AT_type +.Lint: + .byte 6 # Abbrev [6] 0x3e:0x4 DW_TAG_base_type + .long .Linfo_string6 # DW_AT_name + .byte 5 # DW_AT_encoding + .byte 4 # DW_AT_byte_size + .byte 0 # End Of Children Mark +.Ldebug_info_end0: + + .section .debug_str,"MS",@progbits,1 +.Linfo_string4: + .asciz "Class" +.Linfo_string5: + .asciz "constant" +.Linfo_string6: + .asciz "int" + + .section .debug_names,"",@progbits + .long .Lnames_end0-.Lnames_start0 # Header: unit length +.Lnames_start0: + .short 5 # Header: version + .short 0 # Header: padding + .long 1 # Header: compilation unit count + .long 0 # Header: local type unit count + .long 0 # Header: foreign type unit count + .long 0 # Header: bucket count + .long 3 # Header: name count + .long .Lnames_abbrev_end0-.Lnames_abbrev_start0 # Header: abbreviation table size + .long 8 # Header: augmentation string size + .ascii "LLVM0700" # Header: augmentation string + .long .Lcu_begin0 # Compilation unit 0 + .long .Linfo_string4 # String: Class + .long .Linfo_string5 # String: constant + .long .Linfo_string6 # String: int + .long .Lnames0-.Lnames_entries0 + .long .Lnames3-.Lnames_entries0 + .long .Lnames1-.Lnames_entries0 +.Lnames_abbrev_start0: + .byte 1 # Abbrev code + .byte 2 # DW_TAG_class_type + .byte 3 # DW_IDX_die_offset + .byte 19 # DW_FORM_ref4 + .byte 0 # End of abbrev + .byte 0 # End of abbrev + .byte 2 # Abbrev code + .byte 52 # DW_TAG_variable + .byte 3 # DW_IDX_die_offset + .byte 19 # DW_FORM_ref4 + .byte 0 # End of abbrev + .byte 0 # End of abbrev + .byte 3 # Abbrev code + .byte 36 # DW_TAG_base_type + .byte 3 # DW_IDX_die_offset + .byte 19 # DW_FORM_ref4 + .byte 0 # End of abbrev + .byte 0 # End of abbrev + .byte 0 # End of abbrev list +.Lnames_abbrev_end0: +.Lnames_entries0: +.Lnames0: + .byte 1 # Abbreviation code + .long .LClass-.Lcu_begin0 # DW_IDX_die_offset + .byte 0 # DW_IDX_parent + # End of list: Class +.Lnames3: + .byte 2 # Abbreviation code + .long .Lvariable-.Lcu_begin0 # DW_IDX_die_offset + .byte 0 # DW_IDX_parent + # End of list: constant +.Lnames1: + .byte 3 # Abbreviation code + .long .Lint-.Lcu_begin0 # DW_IDX_die_offset + .byte 0 # DW_IDX_parent + # End of list: int +.Lnames_end0: diff --git a/lldb/test/Shell/SymbolFile/DWARF/x86/debug-types-signature-loop.s b/lldb/test/Shell/SymbolFile/DWARF/x86/debug-types-signature-loop.s index 64b835353ed4..64b22830e8f2 100644 --- a/lldb/test/Shell/SymbolFile/DWARF/x86/debug-types-signature-loop.s +++ b/lldb/test/Shell/SymbolFile/DWARF/x86/debug-types-signature-loop.s @@ -4,7 +4,7 @@ # RUN: ld.lld %t.o -o %t # RUN: %lldb %t -o "target variable e" -b | FileCheck %s -# CHECK: Error: 'Unable to determine byte size.' +# CHECK: error: Unable to determine byte size. .type e,@object # @e .section .rodata,"a",@progbits diff --git a/lldb/test/Shell/SymbolFile/DWARF/x86/dwp-foreign-type-units.cpp b/lldb/test/Shell/SymbolFile/DWARF/x86/dwp-foreign-type-units.cpp new file mode 100644 index 000000000000..8dd5a5472ed4 --- /dev/null +++ b/lldb/test/Shell/SymbolFile/DWARF/x86/dwp-foreign-type-units.cpp @@ -0,0 +1,118 @@ +// REQUIRES: lld + +// This test will make a type that will be compiled differently into two +// different .dwo files in a type unit with the same type hash, but with +// differing contents. Clang's type unit signature is based only on the mangled +// name of the type, regardless of the contents of the type, so that will help +// us test foreign type units in the .debug_names section of the main +// executable. When a DWP file is made, only one type unit will be kept and the +// type unit that is kept has the .dwo file name that it came from. When LLDB +// loads the foreign type units, it needs to verify that any entries from +// foreign type units come from the right .dwo file. We test this since the +// contents of type units are not always the same even though they have the +// same type hash. We don't want invalid accelerator table entries to come from +// one .dwo file and be used on a type unit from another since this could cause +// invalid lookups to happen. LLDB knows how to track down which .dwo file a +// type unit comes from by looking at the DW_AT_dwo_name attribute in the +// DW_TAG_type_unit. + +// RUN: %clang -target x86_64-pc-linux -gdwarf-5 -gsplit-dwarf \ +// RUN: -fdebug-types-section -gpubnames -c %s -o %t.main.o +// RUN: %clang -target x86_64-pc-linux -gdwarf-5 -gsplit-dwarf -DVARIANT \ +// RUN: -fdebug-types-section -gpubnames -c %s -o %t.foo.o +// RUN: ld.lld %t.main.o %t.foo.o -o %t + +// Check when have no .dwp file that we can find the types in both .dwo files. +// RUN: rm -f %t.dwp +// RUN: %lldb \ +// RUN: -o "type lookup IntegerType" \ +// RUN: -o "type lookup FloatType" \ +// RUN: -o "type lookup CustomType" \ +// RUN: -b %t | FileCheck %s --check-prefix=NODWP +// NODWP: (lldb) type lookup IntegerType +// NODWP-NEXT: int +// NODWP-NEXT: unsigned int +// NODWP: (lldb) type lookup FloatType +// NODWP-NEXT: double +// NODWP-NEXT: float +// NODWP: (lldb) type lookup CustomType +// NODWP-NEXT: struct CustomType { +// NODWP-NEXT: typedef int IntegerType; +// NODWP-NEXT: typedef double FloatType; +// NODWP-NEXT: CustomType::IntegerType x; +// NODWP-NEXT: CustomType::FloatType y; +// NODWP-NEXT: } +// NODWP-NEXT: struct CustomType { +// NODWP-NEXT: typedef unsigned int IntegerType; +// NODWP-NEXT: typedef float FloatType; +// NODWP-NEXT: CustomType::IntegerType x; +// NODWP-NEXT: CustomType::FloatType y; +// NODWP-NEXT: } + +// Check when we make the .dwp file with %t.main.dwo first so it will +// pick the type unit from %t.main.dwo. Verify we find only the types from +// %t.main.dwo's type unit. +// RUN: llvm-dwp %t.main.dwo %t.foo.dwo -o %t.dwp +// RUN: %lldb \ +// RUN: -o "type lookup IntegerType" \ +// RUN: -o "type lookup FloatType" \ +// RUN: -o "type lookup CustomType" \ +// RUN: -b %t | FileCheck %s --check-prefix=DWPMAIN +// DWPMAIN: (lldb) type lookup IntegerType +// DWPMAIN-NEXT: int +// DWPMAIN: (lldb) type lookup FloatType +// DWPMAIN-NEXT: double +// DWPMAIN: (lldb) type lookup CustomType +// DWPMAIN-NEXT: struct CustomType { +// DWPMAIN-NEXT: typedef int IntegerType; +// DWPMAIN-NEXT: typedef double FloatType; +// DWPMAIN-NEXT: CustomType::IntegerType x; +// DWPMAIN-NEXT: CustomType::FloatType y; +// DWPMAIN-NEXT: } + +// Next we check when we make the .dwp file with %t.foo.dwo first so it will +// pick the type unit from %t.main.dwo. Verify we find only the types from +// %t.main.dwo's type unit. +// RUN: llvm-dwp %t.foo.dwo %t.main.dwo -o %t.dwp +// RUN: %lldb \ +// RUN: -o "type lookup IntegerType" \ +// RUN: -o "type lookup FloatType" \ +// RUN: -o "type lookup CustomType" \ +// RUN: -b %t | FileCheck %s --check-prefix=DWPFOO + +// DWPFOO: (lldb) type lookup IntegerType +// DWPFOO-NEXT: unsigned int +// DWPFOO: (lldb) type lookup FloatType +// DWPFOO-NEXT: float +// DWPFOO: (lldb) type lookup CustomType +// DWPFOO-NEXT: struct CustomType { +// DWPFOO-NEXT: typedef unsigned int IntegerType; +// DWPFOO-NEXT: typedef float FloatType; +// DWPFOO-NEXT: CustomType::IntegerType x; +// DWPFOO-NEXT: CustomType::FloatType y; +// DWPFOO-NEXT: } + +struct CustomType { + // We switch the order of "FloatType" and "IntegerType" so that if we do + // end up reading the wrong accelerator table entry, that we would end up + // getting an invalid offset and not find anything, or the offset would have + // matched and we would find the wrong thing. +#ifdef VARIANT + typedef float FloatType; + typedef unsigned IntegerType; +#else + typedef int IntegerType; + typedef double FloatType; +#endif + IntegerType x; + FloatType y; +}; + +#ifdef VARIANT +int foo() { +#else +int main() { +#endif + CustomType c = {1, 2.0}; + return 0; +} diff --git a/lldb/test/Shell/SymbolFile/DWARF/x86/enum-declaration-uniqueness.cpp b/lldb/test/Shell/SymbolFile/DWARF/x86/enum-declaration-uniqueness.cpp new file mode 100644 index 000000000000..20322f1ccc37 --- /dev/null +++ b/lldb/test/Shell/SymbolFile/DWARF/x86/enum-declaration-uniqueness.cpp @@ -0,0 +1,32 @@ +// REQUIRES: lld +// +// RUN: %clangxx --target=x86_64-pc-linux -g -c -o %t_a.o %s -DFILE_A +// RUN: %clangxx --target=x86_64-pc-linux -g -c -o %t_b.o %s -DFILE_B +// RUN: ld.lld -o %t %t_a.o %t_b.o +// RUN: %lldb %t \ +// RUN: -o "target variable my_enum my_enum_ref" -o "image dump ast" \ +// RUN: -o exit | FileCheck %s + + +// CHECK: (lldb) target variable +// CHECK: (MyEnum) my_enum = MyEnum_A +// CHECK: (MyEnum &) my_enum_ref = +// CHECK-SAME: &::my_enum_ref = MyEnum_A + +// CHECK: (lldb) image dump ast +// CHECK: EnumDecl {{.*}} MyEnum +// CHECK-NEXT: EnumConstantDecl {{.*}} MyEnum_A 'MyEnum' +// CHECK-NOT: MyEnum + +enum MyEnum : int; + +extern MyEnum my_enum; + +#ifdef FILE_A +enum MyEnum : int { MyEnum_A }; + +MyEnum my_enum = MyEnum_A; +#endif +#ifdef FILE_B +MyEnum &my_enum_ref = my_enum; +#endif diff --git a/lldb/test/Shell/SymbolFile/DWARF/x86/find-basic-function.cpp b/lldb/test/Shell/SymbolFile/DWARF/x86/find-basic-function.cpp index b9a63525d071..c42f9fe0b8b5 100644 --- a/lldb/test/Shell/SymbolFile/DWARF/x86/find-basic-function.cpp +++ b/lldb/test/Shell/SymbolFile/DWARF/x86/find-basic-function.cpp @@ -34,7 +34,7 @@ // RUN: FileCheck --check-prefix=FULL-MANGLED-METHOD %s // RUN: lldb-test symbols --name=foo --context=context --find=function --function-flags=base %t | \ // RUN: FileCheck --check-prefix=CONTEXT %s -// RUN: lldb-test symbols --compiler-context=Struct:sbar,Function:foo -language=c++ -find=function -function-flags=method %t | \ +// RUN: lldb-test symbols --compiler-context=ClassOrStruct:sbar,Function:foo -language=c++ -find=function -function-flags=method %t | \ // RUN: FileCheck --check-prefix=COMPILER-CONTEXT %s // RUN: lldb-test symbols --name=not_there --find=function %t | \ // RUN: FileCheck --check-prefix=EMPTY %s diff --git a/lldb/test/Shell/SymbolFile/DWARF/x86/module-ownership.mm b/lldb/test/Shell/SymbolFile/DWARF/x86/module-ownership.mm index 4f39e2e5a9e1..2dec109a781c 100644 --- a/lldb/test/Shell/SymbolFile/DWARF/x86/module-ownership.mm +++ b/lldb/test/Shell/SymbolFile/DWARF/x86/module-ownership.mm @@ -17,7 +17,7 @@ Typedef t1; TopLevelStruct s1; // RUN: lldb-test symbols -dump-clang-ast -find type --language=ObjC++ \ -// RUN: -compiler-context 'Module:A,Struct:TopLevelStruct' %t.o \ +// RUN: -compiler-context 'Module:A,ClassOrStruct:TopLevelStruct' %t.o \ // RUN: | FileCheck %s --check-prefix=CHECK-TOPLEVELSTRUCT // CHECK-TOPLEVELSTRUCT: CXXRecordDecl {{.*}} imported in A struct TopLevelStruct // CHECK-TOPLEVELSTRUCT: -FieldDecl {{.*}} in A a 'int' @@ -45,7 +45,7 @@ Enum e1; SomeClass *obj1; // RUN: lldb-test symbols -dump-clang-ast -find type --language=ObjC++ \ -// RUN: -compiler-context 'Module:A,Struct:SomeClass' %t.o \ +// RUN: -compiler-context 'Module:A,ClassOrStruct:SomeClass' %t.o \ // RUN: | FileCheck %s --check-prefix=CHECK-OBJC // CHECK-OBJC: ObjCInterfaceDecl {{.*}} imported in A <undeserialized declarations> SomeClass // CHECK-OBJC-NEXT: |-ObjCIvarDecl diff --git a/lldb/test/Shell/SymbolFile/DWARF/x86/simple-template-names-context.cpp b/lldb/test/Shell/SymbolFile/DWARF/x86/simple-template-names-context.cpp index a8a4d3b8fbd5..8070b7a19abc 100644 --- a/lldb/test/Shell/SymbolFile/DWARF/x86/simple-template-names-context.cpp +++ b/lldb/test/Shell/SymbolFile/DWARF/x86/simple-template-names-context.cpp @@ -12,7 +12,7 @@ // CHECK: (lldb) target variable // CHECK-NEXT: (ReferencesBoth<'A'>) both_a = { // CHECK-NEXT: (Outer<'A'>::Inner *) a = 0x{{[0-9A-Fa-f]*}} {} -// CHECK-NEXT: (Outer<'A'>::Inner *) b = 0x{{[0-9A-Fa-f]*}} {} +// CHECK-NEXT: (Outer<'B'>::Inner *) b = 0x{{[0-9A-Fa-f]*}} {} // CHECK-NEXT: } // CHECK-NEXT: (ReferencesBoth<'B'>) both_b = { // CHECK-NEXT: (Outer<'A'>::Inner *) a = 0x{{[0-9A-Fa-f]*}} {} diff --git a/lldb/test/Shell/helper/build.py b/lldb/test/Shell/helper/build.py index d3c25bd944e9..b2b8146e88c7 100755 --- a/lldb/test/Shell/helper/build.py +++ b/lldb/test/Shell/helper/build.py @@ -441,9 +441,9 @@ class MsvcBuilder(Builder): if not subdirs: return None - from distutils.version import StrictVersion + from packaging import version - subdirs.sort(key=lambda x: StrictVersion(x)) + subdirs.sort(key=lambda x: version.parse(x)) if self.verbose: full_path = os.path.join(vcinstalldir, subdirs[-1]) @@ -517,11 +517,9 @@ class MsvcBuilder(Builder): if not sdk_versions: return (None, None) - # Windows SDK version numbers consist of 4 dotted components, so we - # have to use LooseVersion, as StrictVersion supports 3 or fewer. - from pkg_resources import packaging + from packaging import version - sdk_versions.sort(key=lambda x: packaging.version.parse(x), reverse=True) + sdk_versions.sort(key=lambda x: version.parse(x), reverse=True) option_value_name = "OptionId.DesktopCPP" + self.msvc_arch_str for v in sdk_versions: try: diff --git a/lldb/test/Shell/helper/toolchain.py b/lldb/test/Shell/helper/toolchain.py index 7b7be0664316..255955fc70d8 100644 --- a/lldb/test/Shell/helper/toolchain.py +++ b/lldb/test/Shell/helper/toolchain.py @@ -165,11 +165,6 @@ def use_support_substitutions(config): if config.cmake_sysroot: host_flags += ["--sysroot={}".format(config.cmake_sysroot)] - # Facebook T92898286 - if config.llvm_test_bolt: - host_flags += ["--post-link-optimize"] - # End Facebook T92898286 - host_flags = " ".join(host_flags) config.substitutions.append(("%clang_host", "%clang " + host_flags)) config.substitutions.append(("%clangxx_host", "%clangxx " + host_flags)) diff --git a/lldb/test/Shell/lit.cfg.py b/lldb/test/Shell/lit.cfg.py index e24f3fbb4d93..d764cfa20ea8 100644 --- a/lldb/test/Shell/lit.cfg.py +++ b/lldb/test/Shell/lit.cfg.py @@ -145,7 +145,7 @@ if config.lldb_enable_lua: if config.lldb_enable_lzma: config.available_features.add("lzma") -if shutil.which("xz") != None: +if shutil.which("xz") is not None: config.available_features.add("xz") if config.lldb_system_debugserver: diff --git a/lldb/test/Shell/lit.site.cfg.py.in b/lldb/test/Shell/lit.site.cfg.py.in index fe8323734b7d..b69e7bce1bc0 100644 --- a/lldb/test/Shell/lit.site.cfg.py.in +++ b/lldb/test/Shell/lit.site.cfg.py.in @@ -1,10 +1,5 @@ @LIT_SITE_CFG_IN_HEADER@ -#Facebook T92898286 -import lit.util -#End Facebook T92898286 - - config.llvm_src_root = "@LLVM_SOURCE_DIR@" config.llvm_obj_root = "@LLVM_BINARY_DIR@" config.llvm_tools_dir = lit_config.substitute("@LLVM_TOOLS_DIR@") @@ -36,10 +31,6 @@ config.llvm_use_sanitizer = "@LLVM_USE_SANITIZER@" config.lldb_module_cache = os.path.join("@LLDB_TEST_MODULE_CACHE_LLDB@", "lldb-shell") config.clang_module_cache = os.path.join("@LLDB_TEST_MODULE_CACHE_CLANG@", "lldb-shell") -# Facebook T92898286 -config.llvm_test_bolt = lit.util.pythonize_bool("@LLVM_TEST_BOLT@") -# End Facebook T92898286 - import lit.llvm lit.llvm.initialize(lit_config, config) |
