mirror of
https://github.com/apple/swift.git
synced 2026-10-22 19:15:50 +02:00
```
test/Backtracing/CrashOpt.test:21:15: error: OPTIMIZED: expected string not found in input
// OPTIMIZED: 0 [inlined] 0x{{[0-9a-f]+}} level5() in CrashOpt.exe at {{.*[\\/]}}Crash.swift:20:15
<stdin>:11:1: note: possible intended match here
0 [inlined] 0x00000001040614ec level5() + 8 in CrashOpt.exe at SOURCE_DIR/test/Backtracing/Inputs/Crash.swift:20:15
1 [inlined] 0x00000001040614ec level4() + 8 in CrashOpt.exe at SOURCE_DIR/test/Backtracing/Inputs/Crash.swift:14:3
5 [inlined] 0x00000001040614ec static Crash.main() + 8 in CrashOpt.exe at SOURCE_DIR/test/Backtracing/Inputs/Crash.swift:26:5
```
`SelectionDAG::getConstant` now stamps non-target constant nodes with the
debug location of their point of creation, so the `mov w8, #4` and
`mov w9, #42` that materialize the operands of `ptr.pointee = 42` are no
longer attributed to line 0; they join the `str` in the line table and in
the `DW_TAG_inlined_subroutine` range for `level5()`. That range now
starts 8 bytes before the faulting store, which CoreSymbolication reports
as `+ 8`. The backtrace is still correct: the faulting instruction is
still `str x9, [x8]` with x8 == 4, and the whole inline chain is intact.
Only the offset moved, so allow an optional one. It has to stay optional
rather than required, because the DWARF reader used off Darwin reports
inlined frames with offset 0, which the backtracer prints bare.
See https://github.com/llvm/llvm-project/commit/1230cfda2b3096eb360c785d57a551fddf3fd9ee (https://github.com/llvm/llvm-project/pull/192669).
Assisted-by: Claude Code
38 lines
2.0 KiB
Plaintext
38 lines
2.0 KiB
Plaintext
// RUN: %empty-directory(%t)
|
||
// RUN: %target-build-swift %S/Inputs/Crash.swift -parse-as-library -O %swift-debug-flags -o %t/CrashOpt.exe
|
||
// RUN: %target-codesign %t/CrashOpt.exe
|
||
|
||
// RUN: env %env-SWIFT_BACKTRACE=enable=yes,cache=no %target-run %t/CrashOpt.exe %t/CrashOpt.exe.dSYM > %t/Optimized.out 2>&1 || true
|
||
// RUN: %FileCheck %s --ignore-case --check-prefix OPTIMIZED < %t/Optimized.out
|
||
|
||
// UNSUPPORTED: use_os_stdlib
|
||
// UNSUPPORTED: back_deployment_runtime
|
||
// UNSUPPORTED: asan
|
||
// REQUIRES: executable_test
|
||
// REQUIRES: backtracing
|
||
// REQUIRES: OS=macosx || OS=linux-gnu
|
||
// XFAIL: swift_test_mode_optimize_none_with_opaque_values
|
||
|
||
|
||
// OPTIMIZED: *** Program crashed: {{(Bad pointer dereference|Access violation)}} at 0x{{0+}}4 ***
|
||
|
||
// OPTIMIZED: Thread 0 {{(".*" )?}}crashed:
|
||
|
||
// The symbol offsets below are optional: an inlined frame is reported relative
|
||
// to the start of the enclosing inline range, which need not begin exactly at
|
||
// the faulting instruction.
|
||
|
||
// OPTIMIZED: 0 [inlined] 0x{{[0-9a-f]+}} level5(){{( \+ [0-9]+)?}} in CrashOpt.exe at {{.*[\\/]}}Crash.swift:20:15
|
||
// OPTIMIZED-NEXT: 1 [inlined] 0x{{[0-9a-f]+}} level4(){{( \+ [0-9]+)?}} in CrashOpt.exe at {{.*[\\/]}}Crash.swift:14:3
|
||
// OPTIMIZED-NEXT: 2 [inlined] 0x{{[0-9a-f]+}} level3(){{( \+ [0-9]+)?}} in CrashOpt.exe at {{.*[\\/]}}Crash.swift:10:3
|
||
// OPTIMIZED-NEXT: 3 [inlined] 0x{{[0-9a-f]+}} level2(){{( \+ [0-9]+)?}} in CrashOpt.exe at {{.*[\\/]}}Crash.swift:6:3
|
||
// OPTIMIZED-NEXT: 4 [inlined] 0x{{[0-9a-f]+}} level1(){{( \+ [0-9]+)?}} in CrashOpt.exe at {{.*[\\/]}}Crash.swift:2:3
|
||
// OPTIMIZED-NEXT: 5 [inlined] 0x{{[0-9a-f]+}} static Crash.main(){{( \+ [0-9]+)?}} in CrashOpt.exe at {{.*[\\/]}}Crash.swift:26:5
|
||
// OPTIMIZED: {{6|7}} [system] 0x{{[0-9a-f]+}} main + {{[0-9]+}} in CrashOpt.exe at {{.*}}
|
||
|
||
// OPTIMIZED: Registers:
|
||
|
||
// OPTIMIZED: Images ({{[0-9]+}} omitted):
|
||
|
||
// OPTIMIZED: {{0x[0-9a-f]+}}–{{0x[0-9a-f]+}}{{ +}}{{([0-9a-f]+|<no build ID>)}}{{ +}}CrashOpt.exe{{ +}}{{.*[\\/]}}CrashOpt.exe
|