From 095ea503ddc00db82a67f940f5ad7ecbf349a4fc Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Thu, 11 Aug 2022 22:40:30 -0700 Subject: [PATCH] [MCDwarf][test] Improve debug-prefix-map.s (cherry picked from commit d561907f27d721558e4372990ca52a8284b7aafc) --- llvm/test/MC/ELF/debug-prefix-map.s | 56 ++++++++++++++++++++--------- 1 file changed, 40 insertions(+), 16 deletions(-) diff --git a/llvm/test/MC/ELF/debug-prefix-map.s b/llvm/test/MC/ELF/debug-prefix-map.s index 9fe4c9bf176e87..7f47632e730d82 100644 --- a/llvm/test/MC/ELF/debug-prefix-map.s +++ b/llvm/test/MC/ELF/debug-prefix-map.s @@ -1,25 +1,49 @@ -// RUN: mkdir -p %t.foo -// RUN: cp %s %t.foo/src.s -// RUN: cd %t.foo +# RUN: rm -rf %t.foo && mkdir %t.foo && cd %t.foo +# RUN: cp %s %t.foo/src.s -// RUN: llvm-mc -triple=x86_64-linux-unknown -g src.s -filetype=obj -o out.o -// RUN: llvm-dwarfdump -v -debug-info out.o | FileCheck --check-prefix=NO_MAP %s +# RUN: llvm-mc -triple=x86_64 -g -dwarf-version=4 src.s -filetype=obj -o nomap.4.o +# RUN: llvm-dwarfdump -v -debug-info -debug-line nomap.4.o | FileCheck --check-prefix=NO_MAP_V4 %s +# RUN: llvm-mc -triple=x86_64 -g -dwarf-version=5 src.s -filetype=obj -o nomap.5.o +# RUN: llvm-dwarfdump -v -debug-info -debug-line nomap.5.o | FileCheck --check-prefix=NO_MAP_V5 %s -// RUN: llvm-mc -triple=x86_64-linux-unknown -g src.s -filetype=obj -o out.o -fdebug-prefix-map=%t.foo=src_root -// RUN: llvm-dwarfdump -v -debug-info out.o | FileCheck --check-prefix=MAP --implicit-check-not ".foo" %s +# RUN: llvm-mc -triple=x86_64 -g -dwarf-version=4 src.s -filetype=obj -o map.4.o -fdebug-prefix-map=%t.foo=src_root +# RUN: llvm-dwarfdump -v -debug-info -debug-line map.4.o | FileCheck --check-prefix=MAP_V4 %s +# RUN: llvm-mc -triple=x86_64 -g -dwarf-version=5 src.s -filetype=obj -o map.5.o -fdebug-prefix-map=%t.foo=src_root +# RUN: llvm-dwarfdump -v -debug-info -debug-line map.5.o | FileCheck --check-prefix=MAP_V5 %s -// RUN: llvm-mc -triple=x86_64-linux-unknown -g %t.foo/src.s -filetype=obj -o out.o -fdebug-prefix-map=%t.foo=/src_root -// RUN: llvm-dwarfdump -v -debug-info out.o | FileCheck --check-prefix=MAP_ABS --implicit-check-not ".foo" %s +# RUN: llvm-mc -triple=x86_64 -g -dwarf-version=4 %t.foo/src.s -filetype=obj -o mapabs.4.o -fdebug-prefix-map=%t.foo=/src_root +# RUN: llvm-dwarfdump -v -debug-info -debug-line mapabs.4.o | FileCheck --check-prefix=MAPABS_V4 %s +# RUN: llvm-mc -triple=x86_64 -g -dwarf-version=5 %t.foo/src.s -filetype=obj -o mapabs.5.o -fdebug-prefix-map=%t.foo=/src_root +# RUN: llvm-dwarfdump -v -debug-info -debug-line mapabs.5.o | FileCheck --check-prefix=MAPABS_V5 %s f: nop -// NO_MAP: DW_AT_comp_dir [DW_FORM_string] ("{{.*}}.foo") +# NO_MAP_V4: DW_AT_comp_dir [DW_FORM_string] ("{{.*}}.foo") +# NO_MAP_V4: file_names[ 1]: +# NO_MAP_V4-NEXT: name: "src.s" -// MAP: DW_AT_name [DW_FORM_string] ("src.s") -// MAP: DW_AT_comp_dir [DW_FORM_string] ("src_root") -// MAP: DW_AT_decl_file [DW_FORM_data4] ("src_root{{(/|\\)+}}src.s") +# NO_MAP_V5: DW_AT_comp_dir [DW_FORM_string] ("{{.*}}.foo") +# NO_MAP_V5: include_directories[ 0] = .debug_line_str[0x00000000] = "{{.*}}.foo" -// MAP_ABS: DW_AT_name [DW_FORM_string] ("src.s") -// MAP_ABS: DW_AT_comp_dir [DW_FORM_string] ("{{(/|\\)+}}src_root") -// MAP_ABS: DW_AT_decl_file [DW_FORM_data4] ("{{(/|\\)+}}src_root{{(/|\\)+}}src.s") +# MAP_V4: DW_AT_name [DW_FORM_string] ("src.s") +# MAP_V4: DW_AT_comp_dir [DW_FORM_string] ("src_root") +# MAP_V4: DW_AT_decl_file [DW_FORM_data4] ("src_root{{(/|\\)+}}src.s") +# MAP_V4-NOT: .foo + +## FIXME DW_AT_decl_file and include_directories are not mapped +# MAP_V5: DW_AT_name [DW_FORM_string] ("src.s") +# MAP_V5: DW_AT_comp_dir [DW_FORM_string] ("src_root") +# MAP_V5: DW_AT_decl_file [DW_FORM_data4] ("{{.*}}.foo{{(/|\\)+}}src.s") +# MAP_V5: include_directories[ 0] = .debug_line_str[0x00000000] = "{{.*}}.foo" + +# MAPABS_V4: DW_AT_name [DW_FORM_string] ("src.s") +# MAPABS_V4: DW_AT_comp_dir [DW_FORM_string] ("{{(/|\\)+}}src_root") +# MAPABS_V4: DW_AT_decl_file [DW_FORM_data4] ("{{(/|\\)+}}src_root{{(/|\\)+}}src.s") +# MAPABS_V4-NOT: .foo + +## FIXME DW_AT_decl_file and include_directories are not mapped +# MAPABS_V5: DW_AT_name [DW_FORM_string] ("src.s") +# MAPABS_V5: DW_AT_comp_dir [DW_FORM_string] ("{{(/|\\)+}}src_root") +# MAPABS_V5: DW_AT_decl_file [DW_FORM_data4] ("{{.*}}.foo{{(/|\\)+}}src.s") +# MAPABS_V5: include_directories[ 0] = .debug_line_str[0x00000000] = "{{.*}}.foo"