Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[DebugInfo] Add support for DWARF5 call site-related attributes
DWARF v5 introduces DW_AT_call_all_calls, a subprogram attribute which indicates that all calls (both regular and tail) within the subprogram have call site entries. The information within these call site entries can be used by a debugger to populate backtraces with synthetic tail call frames. Tail calling frames go missing in backtraces because the frame of the caller is reused by the callee. Call site entries allow a debugger to reconstruct a sequence of (tail) calls which led from one function to another. This improves backtrace quality. There are limitations: tail recursion isn't handled, variables within synthetic frames may not survive to be inspected, etc. This approach is not novel, see: https://gcc.gnu.org/wiki/summit2010?action=AttachFile&do=get&target=jelinek.pdf This patch adds an IR-level flag (DIFlagAllCallsDescribed) which lowers to DW_AT_call_all_calls. It adds the minimal amount of DWARF generation support needed to emit standards-compliant call site entries. For easier deployment, when the debugger tuning is LLDB, the DWARF requirement is adjusted to v4. Testing: Apart from check-{llvm, clang}, I built a stage2 RelWithDebInfo clang binary. Its dSYM passed verification and grew by 1.4% compared to the baseline. 151,879 call site entries were added. rdar://42001377 Differential Revision: https://reviews.llvm.org/D49887 llvm-svn: 343883
- Loading branch information
Showing
16 changed files
with
814 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
// Test that call site debug info is (un)supported in various configurations. | ||
|
||
// Supported: DWARF5, -O1, standalone DI | ||
// RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple %s -o - \ | ||
// RUN: -O1 -disable-llvm-passes \ | ||
// RUN: -debug-info-kind=standalone -dwarf-version=5 \ | ||
// RUN: | FileCheck %s -check-prefix=HAS-ATTR \ | ||
// RUN: -implicit-check-not=DISubprogram -implicit-check-not=DIFlagAllCallsDescribed | ||
|
||
// Supported: DWARF4 + LLDB tuning, -O1, limited DI | ||
// RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple %s -o - \ | ||
// RUN: -O1 -disable-llvm-passes \ | ||
// RUN: -debugger-tuning=lldb \ | ||
// RUN: -debug-info-kind=standalone -dwarf-version=4 \ | ||
// RUN: | FileCheck %s -check-prefix=HAS-ATTR \ | ||
// RUN: -implicit-check-not=DISubprogram -implicit-check-not=DIFlagAllCallsDescribed | ||
|
||
// Supported: DWARF4 + LLDB tuning, -O1, line-tables only DI | ||
// RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple %s -o - \ | ||
// RUN: -O1 -disable-llvm-passes \ | ||
// RUN: -debugger-tuning=lldb \ | ||
// RUN: -debug-info-kind=line-tables-only -dwarf-version=4 \ | ||
// RUN: | FileCheck %s -check-prefix=LINE-TABLES-ONLY | ||
|
||
// Unsupported: -O0 | ||
// RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple %s -o - \ | ||
// RUN: -O0 \ | ||
// RUN: -debug-info-kind=standalone -dwarf-version=5 \ | ||
// RUN: | FileCheck %s -check-prefix=NO-ATTR | ||
|
||
// Unsupported: DWARF4 | ||
// RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple %s -o - \ | ||
// RUN: -O1 -disable-llvm-passes \ | ||
// RUN: -debug-info-kind=standalone -dwarf-version=4 \ | ||
// RUN: | FileCheck %s -check-prefix=NO-ATTR | ||
|
||
// NO-ATTR-NOT: FlagAllCallsDescribed | ||
|
||
// HAS-ATTR-DAG: DISubprogram(name: "declaration2", {{.*}}, isDefinition: true, {{.*}}, flags: DIFlagPrototyped | DIFlagAllCallsDescribed | ||
// HAS-ATTR-DAG: DISubprogram(name: "struct1", {{.*}}, isDefinition: false, {{.*}}, flags: DIFlagPrototyped | ||
// HAS-ATTR-DAG: DISubprogram(name: "struct1", {{.*}}, isDefinition: true, {{.*}}, flags: DIFlagPrototyped | DIFlagAllCallsDescribed | ||
// HAS-ATTR-DAG: DISubprogram(name: "method1", {{.*}}, isDefinition: true, {{.*}}, flags: DIFlagPrototyped | DIFlagAllCallsDescribed | ||
// HAS-ATTR-DAG: DISubprogram(name: "force_irgen", {{.*}}, isDefinition: true, {{.*}}, flags: DIFlagPrototyped | DIFlagAllCallsDescribed | ||
|
||
// LINE-TABLES-ONLY: DISubprogram(name: "force_irgen", {{.*}}, isDefinition: true, {{.*}}, flags: DIFlagPrototyped | DIFlagAllCallsDescribed | ||
|
||
void declaration1(); | ||
|
||
void declaration2(); | ||
|
||
void declaration2() {} | ||
|
||
struct struct1 { | ||
struct1() {} | ||
void method1() {} | ||
}; | ||
|
||
void __attribute__((optnone)) force_irgen() { | ||
declaration1(); | ||
struct1().method1(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.