Skip to content

Commit 56ecb8f

Browse files
committed
Enable better runtime failure messages
The implementation was done quite a while ago. Now, that we have support in lldb (swiftlang/llvm-project#773), we can enable it by default in the compiler. LLDB now shows the runtime failure reason, for example: * thread #1, queue = 'com.apple.main-thread', stop reason = Swift runtime failure: arithmetic overflow frame #1: 0x0000000100000f0d a.out`testit(a=127) at trap_message.swift:4 1 2 @inline(never) 3 func testit(_ a: Int8) -> Int8 { -> 4 return a + 1 5 } 6 For details, see #25978 rdar://problem/51278690
1 parent c435646 commit 56ecb8f

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

lib/IRGen/IRGenFunction.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ using namespace swift;
3333
using namespace irgen;
3434

3535
static llvm::cl::opt<bool> EnableTrapDebugInfo(
36-
"enable-trap-debug-info", llvm::cl::Hidden,
36+
"enable-trap-debug-info", llvm::cl::init(true), llvm::cl::Hidden,
3737
llvm::cl::desc("Generate failure-message functions in the debug info"));
3838

3939
IRGenFunction::IRGenFunction(IRGenModule &IGM, llvm::Function *Fn,

test/DebugInfo/linetable-codeview.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %swiftc_driver %s -g -debug-info-format=codeview -Xllvm -enable-trap-debug-info -emit-ir -o - | %FileCheck %s
1+
// RUN: %swiftc_driver %s -g -debug-info-format=codeview -emit-ir -o - | %FileCheck %s
22
// REQUIRES: optimized_stdlib
33

44
func markUsed<T>(_ t: T) {}

test/IRGen/condfail_message.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
// RUN: %target-swift-frontend -primary-file %s -g -Xllvm -enable-trap-debug-info -emit-ir | %FileCheck %s
2-
// RUN: %target-swift-frontend -primary-file %s -g -Xllvm -enable-trap-debug-info -O -emit-ir | %FileCheck %s
1+
// RUN: %target-swift-frontend -primary-file %s -g -emit-ir | %FileCheck %s
2+
// RUN: %target-swift-frontend -primary-file %s -g -O -emit-ir | %FileCheck %s
33
// REQUIRES: optimized_stdlib
44

55
// CHECK-LABEL: define hidden swiftcc i8 @"$s16condfail_message6testitys4Int8VADF"(i8 %0)

0 commit comments

Comments
 (0)