Index: llvm/test/tools/llvm-dwarfdump/X86/output.s =================================================================== --- /dev/null +++ llvm/test/tools/llvm-dwarfdump/X86/output.s @@ -0,0 +1,21 @@ +# RUN: rm -f %t1.txt %t2.txt %t3.txt +# RUN: llvm-mc %S/brief.s -filetype obj -triple x86_64-apple-darwin -o %t.o + +# RUN: llvm-dwarfdump -o=- %t.o | FileCheck %s + +# RUN: llvm-dwarfdump -o=%t1.txt %t.o +# RUN: FileCheck %s --input-file %t1.txt + +# RUN: touch %t2.txt +# RUN: llvm-dwarfdump -o=%t2.txt %t.o +# RUN: FileCheck %s --input-file %t2.txt + +# RUN: touch %t3.txt +# RUN: chmod 444 %t3.txt +# RUN: not llvm-dwarfdump -o=%t3.txt %t.o 2>&1 | FileCheck %s --check-prefix=ERROR1 -DFILE=%t3.txt + +# RUN: not llvm-dwarfdump -o= %t.o 2>&1 | FileCheck %s --check-prefix=ERROR2 + +# CHECK: DW_TAG_compile_unit +# ERROR1: unable to open output file [[FILE]]: {{[pP]}}ermission denied +# ERROR2: unable to open output file : {{[nN]}}o such file or directory Index: llvm/test/tools/llvm-dwarfdump/X86/parent_recurse_depth.s =================================================================== --- /dev/null +++ llvm/test/tools/llvm-dwarfdump/X86/parent_recurse_depth.s @@ -0,0 +1,65 @@ +# RUN: yaml2obj %s -o %t.o +# RUN: llvm-dwarfdump --debug-info=0x00000020 -p -parent-recurse-depth 0 %t.o | FileCheck %s --check-prefix=ALL +# RUN: llvm-dwarfdump --debug-info=0x00000020 -p -parent-recurse-depth 1 %t.o | FileCheck %s --check-prefix=ONE +# RUN: llvm-dwarfdump --debug-info=0x00000020 -p -parent-recurse-depth 2 %t.o | FileCheck %s --check-prefix=TWO +# RUN: llvm-dwarfdump --debug-info=0x00000020 -p -parent-recurse-depth 3 %t.o | FileCheck %s --check-prefix=ALL + +# ALL: by_hand +# ALL: main +# ALL: test +# ALL: int + +# ONE-NOT: by_hand +# ONE-NOT: main +# ONE: test +# ONE: int + +# TWO-NOT: by_hand +# TWO: main +# TWO: test +# TWO: int + +--- !ELF +FileHeader: + Class: ELFCLASS64 + Data: ELFDATA2LSB + Type: ET_EXEC + Machine: EM_X86_64 +DWARF: + debug_abbrev: + - Table: + - Tag: DW_TAG_compile_unit + Children: DW_CHILDREN_yes + Attributes: + - Attribute: DW_AT_producer + Form: DW_FORM_string + - Tag: DW_TAG_subprogram + Children: DW_CHILDREN_yes + Attributes: + - Attribute: DW_AT_name + Form: DW_FORM_string + - Tag: DW_TAG_namespace + Children: DW_CHILDREN_yes + Attributes: + - Attribute: DW_AT_name + Form: DW_FORM_string + - Tag: DW_TAG_base_type + Children: DW_CHILDREN_no + Attributes: + - Attribute: DW_AT_name + Form: DW_FORM_string + debug_info: + - Version: 4 + Entries: + - AbbrCode: 1 + Values: + - CStr: by_hand + - AbbrCode: 2 + Values: + - CStr: main + - AbbrCode: 3 + Values: + - CStr: test + - AbbrCode: 4 + Values: + - CStr: int Index: llvm/test/tools/llvm-dwarfdump/X86/quiet.s =================================================================== --- /dev/null +++ llvm/test/tools/llvm-dwarfdump/X86/quiet.s @@ -0,0 +1,10 @@ +# RUN: llvm-mc %S/brief.s -filetype obj -triple x86_64-apple-darwin -o %t.o +# RUN: llvm-dwarfdump --verify %t.o | FileCheck %s +# RUN: llvm-dwarfdump --verify --quiet %t.o | FileCheck %s --check-prefix=QUIET --allow-empty + +# RUN: llvm-mc %S/empty-CU.s -filetype obj -triple x86_64-apple-darwin -o %t-error.o +# RUN: not llvm-dwarfdump --verify %t-error.o | FileCheck %s +# RUN: not llvm-dwarfdump --verify --quiet %t-error.o | FileCheck %s --check-prefix=QUIET --allow-empty + +# CHECK: {{.}} +# QUIET-NOT: {{.}} Index: llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp =================================================================== --- llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp +++ llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp @@ -635,7 +635,7 @@ std::error_code EC; ToolOutputFile OutputFile(OutputFilename, EC, sys::fs::OF_TextWithCRLF); - error("Unable to open output file" + OutputFilename, EC); + error("unable to open output file " + OutputFilename, EC); // Don't remove output file if we exit with an error. OutputFile.keep();