1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 11:13:28 +01:00

[DWARF][EntryValues] Emit GNU extensions in the case of DWARF 4 + SCE

Emit DWARF 5 call-site symbols even though DWARF 4 is set,
only in the case of LLDB tuning.

This patch addresses PR46643.

Differential Revision: https://reviews.llvm.org/D83463
This commit is contained in:
Djordje Todorovic 2020-07-24 14:32:25 +02:00 committed by Djordje Todorovic
parent 5622d0e657
commit a300c4e233
2 changed files with 40 additions and 35 deletions

View File

@ -990,7 +990,7 @@ void DwarfCompileUnit::constructAbstractSubprogramScopeDIE(
} }
bool DwarfCompileUnit::useGNUAnalogForDwarf5Feature() const { bool DwarfCompileUnit::useGNUAnalogForDwarf5Feature() const {
return DD->getDwarfVersion() == 4 && DD->tuneForGDB(); return DD->getDwarfVersion() == 4 && !DD->tuneForLLDB();
} }
dwarf::Tag DwarfCompileUnit::getDwarf5OrGNUTag(dwarf::Tag Tag) const { dwarf::Tag DwarfCompileUnit::getDwarf5OrGNUTag(dwarf::Tag Tag) const {

View File

@ -1,48 +1,54 @@
# Test the call site encoding in DWARF5 vs GNU extensions. ## Test the call site encoding in DWARF5 vs GNU extensions.
#
# === DWARF4, tune for gdb === ## === DWARF4, tune for gdb ===
# RUN: llc -emit-call-site-info -dwarf-version 4 -debugger-tune=gdb -filetype=obj \ # RUN: llc -emit-call-site-info -dwarf-version 4 -debugger-tune=gdb -filetype=obj \
# RUN: -mtriple=x86_64-unknown-unknown -start-after=machineverifier -o - %s \ # RUN: -mtriple=x86_64-unknown-unknown -start-after=machineverifier -o - %s \
# RUN: | llvm-dwarfdump - | FileCheck %s -check-prefixes=CHECK-GNU -implicit-check-not=DW_AT_call # RUN: | llvm-dwarfdump - | FileCheck %s -check-prefixes=CHECK-GNU -implicit-check-not=DW_AT_call
#
# === DWARF5, tune for gdb === # === DWARF5, tune for gdb ===
# RUN: llc -dwarf-version 5 -debugger-tune=gdb -emit-call-site-info -filetype=obj \ # RUN: llc -dwarf-version 5 -debugger-tune=gdb -emit-call-site-info -filetype=obj \
# RUN: -mtriple=x86_64-unknown-unknown -start-after=machineverifier -o - %s \ # RUN: -mtriple=x86_64-unknown-unknown -start-after=machineverifier -o - %s \
# RUN: | llvm-dwarfdump - | FileCheck %s -check-prefixes=CHECK-DWARF5 -implicit-check-not=DW_AT_call # RUN: | llvm-dwarfdump - | FileCheck %s -check-prefixes=CHECK-DWARF5 -implicit-check-not=DW_AT_call
#
# === DWARF4, tune for lldb === ## === DWARF4, tune for lldb ===
# RUN: llc -dwarf-version 4 -debugger-tune=lldb -emit-call-site-info -filetype=obj \ # RUN: llc -dwarf-version 4 -debugger-tune=lldb -emit-call-site-info -filetype=obj \
# RUN: -mtriple=x86_64-unknown-unknown -start-after=machineverifier -o - %s \ # RUN: -mtriple=x86_64-unknown-unknown -start-after=machineverifier -o - %s \
# RUN: | llvm-dwarfdump - | FileCheck %s -check-prefixes=CHECK-DWARF5 -implicit-check-not=DW_AT_call # RUN: | llvm-dwarfdump - | FileCheck %s -check-prefixes=CHECK-DWARF5 -implicit-check-not=DW_AT_call
#
# === DWARF5, tune for lldb === ## === DWARF5, tune for lldb ===
# RUN: llc -dwarf-version 5 -debugger-tune=lldb -emit-call-site-info -filetype=obj \ # RUN: llc -dwarf-version 5 -debugger-tune=lldb -emit-call-site-info -filetype=obj \
# RUN: -mtriple=x86_64-unknown-unknown -start-after=machineverifier -o - %s \ # RUN: -mtriple=x86_64-unknown-unknown -start-after=machineverifier -o - %s \
# RUN: | llvm-dwarfdump - | FileCheck %s -check-prefixes=CHECK-DWARF5 -implicit-check-not=DW_AT_call # RUN: | llvm-dwarfdump - | FileCheck %s -check-prefixes=CHECK-DWARF5 -implicit-check-not=DW_AT_call
#
## === DWARF4, tune for sce ===
# RUN: llc -emit-call-site-info -dwarf-version 4 -filetype=obj -debugger-tune=sce \
# RUN: -debug-entry-values -mtriple=x86_64-unknown-unknown \
# RUN: -start-after=machineverifier -o - %s | llvm-dwarfdump - | FileCheck %s -check-prefixes=CHECK-GNU
## === DWARF5, tune for sce ===
# RUN: llc -emit-call-site-info -dwarf-version 5 -filetype=obj -debugger-tune=sce \ # RUN: llc -emit-call-site-info -dwarf-version 5 -filetype=obj -debugger-tune=sce \
# RUN: -debug-entry-values -mtriple=x86_64-unknown-unknown \ # RUN: -debug-entry-values -mtriple=x86_64-unknown-unknown \
# RUN: -start-after=machineverifier -o - %s | llvm-dwarfdump - | FileCheck %s -check-prefixes=CHECK-DWARF5 # RUN: -start-after=machineverifier -o - %s | llvm-dwarfdump - | FileCheck %s -check-prefixes=CHECK-DWARF5
#
# This is based on the following reproducer: ## This is based on the following reproducer:
# ##
# extern void fn(); ## extern void fn();
# extern void fn2(int x); ## extern void fn2(int x);
# extern int fn3(); ## extern int fn3();
# ##
# int fn1(int (*fn4) ()) { ## int fn1(int (*fn4) ()) {
# fn(); ## fn();
# fn2(5); ## fn2(5);
# ##
# int x = (*fn4)(); ## int x = (*fn4)();
# if (!x) ## if (!x)
# return fn3(); ## return fn3();
# else ## else
# return -1; ## return -1;
# } ## }
#
# Check GNU extensions: ## Check GNU extensions:
#
# CHECK-GNU: DW_TAG_subprogram # CHECK-GNU: DW_TAG_subprogram
# CHECK-GNU: DW_AT_GNU_all_call_sites (true) # CHECK-GNU: DW_AT_GNU_all_call_sites (true)
# CHECK-GNU: DW_TAG_GNU_call_site # CHECK-GNU: DW_TAG_GNU_call_site
@ -58,10 +64,9 @@
# CHECK-GNU-NEXT: DW_AT_abstract_origin # CHECK-GNU-NEXT: DW_AT_abstract_origin
# CHECK-GNU-NEXT: DW_AT_GNU_tail_call # CHECK-GNU-NEXT: DW_AT_GNU_tail_call
# CHECK-GNU-NEXT: DW_AT_low_pc # CHECK-GNU-NEXT: DW_AT_low_pc
#
# ## Check DWARF 5:
# Check DWARF 5:
#
# CHECK-DWARF5: DW_TAG_subprogram # CHECK-DWARF5: DW_TAG_subprogram
# CHECK-DWARF5: DW_AT_call_all_calls (true) # CHECK-DWARF5: DW_AT_call_all_calls (true)
# CHECK-DWARF5: DW_TAG_call_site # CHECK-DWARF5: DW_TAG_call_site
@ -80,7 +85,7 @@
# CHECK-DWARF5-NEXT: DW_AT_call_origin # CHECK-DWARF5-NEXT: DW_AT_call_origin
# CHECK-DWARF5-NEXT: DW_AT_call_tail_call # CHECK-DWARF5-NEXT: DW_AT_call_tail_call
# CHECK-DWARF5-NEXT: DW_AT_call_pc # CHECK-DWARF5-NEXT: DW_AT_call_pc
#
--- | --- |
; ModuleID = 'call-site-attrs.c' ; ModuleID = 'call-site-attrs.c'
source_filename = "call-site-attrs.c" source_filename = "call-site-attrs.c"