Skip to content

Commit

Permalink
[MCDwarf][test] Improve debug-prefix-map.s
Browse files Browse the repository at this point in the history
(cherry picked from commit d561907)
  • Loading branch information
MaskRay authored and tru committed Aug 16, 2022
1 parent c439888 commit 095ea50
Showing 1 changed file with 40 additions and 16 deletions.
56 changes: 40 additions & 16 deletions llvm/test/MC/ELF/debug-prefix-map.s
Original file line number Diff line number Diff line change
@@ -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"

0 comments on commit 095ea50

Please sign in to comment.