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]]: permission denied +# ERROR2: Unable to open output file : no 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,69 @@ +# RUN: llvm-mc %s -filetype obj -triple x86_64-pc-linux -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 + +.section .debug_abbrev,"",@progbits +.Lsection_abbrev: + .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 0 # EOM(1) + .byte 0 # EOM(2) + .byte 2 # Abbreviation Code + .byte 46 # DW_TAG_subprogram + .byte 1 # DW_CHILDREN_yes + .byte 3 # DW_AT_name + .byte 8 # DW_FORM_string + .byte 0 # EOM(1) + .byte 0 # EOM(2) + .byte 3 # Abbreviation Code + .byte 39 # DW_TAG_namespace + .byte 1 # DW_CHILDREN_yes + .byte 3 # DW_AT_name + .byte 8 # DW_FORM_string + .byte 0 # EOM(1) + .byte 0 # EOM(2) + .byte 4 # Abbreviation Code + .byte 39 # DW_TAG_base_type + .byte 0 # DW_CHILDREN_no + .byte 3 # DW_AT_name + .byte 8 # DW_FORM_string + .byte 0 # EOM(1) + .byte 0 # EOM(2) + .byte 0 # EOM(3) + +.section .debug_info,"",@progbits + .long .Lcu_end0-.Lcu_start0 # Length of Unit +.Lcu_start0: + .short 4 # DWARF version number + .long Lsection_abbrev # Offset Into Abbrev. Section + .byte 8 # Address Size (in bytes) + .byte 1 # Abbrev DW_TAG_compile_unit + .asciz "by_hand" # DW_AT_producer + .byte 2 # Abbrev [2] DW_TAG_subprogram + .asciz "main" # DW_AT_name + .byte 3 # Abbrev [3] DW_TAG_namespace + .asciz "test" # DW_AT_name + .byte 4 # Abbrev [4] DW_TAG_base_type + .asciz "int" # DW_AT_name + .byte 0 # End Of Children Mark +.Lcu_end0: 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();