File: exception_stack_trace.d

package info (click to toggle)
ldc 1%3A1.40.0-5
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 63,308 kB
  • sloc: cpp: 85,368; ansic: 21,877; makefile: 1,705; sh: 1,018; asm: 584; objc: 135; exp: 48; python: 12
file content (38 lines) | stat: -rw-r--r-- 937 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// RUN: %ldc -g -frame-pointer=all -link-defaultlib-debug %s -of=%t%exe
// RUN: %t%exe | FileCheck %s

void bar()
{
    throw new Exception("lala");
}

void foo()
{
    bar();
}

void main()
{
    try
    {
        foo();
    }
    catch (Exception e)
    {
        import core.stdc.stdio;
        auto s = e.toString();
        printf("%.*s\n", s.length, s.ptr);
    }
}

// CHECK:      object.Exception@{{.*}}exception_stack_trace.d(6): lala
// CHECK-NEXT: ----------------
/* Hiding all frames up to and including the first _d_throw_exception()
 * one doesn't work reliably on all platforms, so don't enforce
 * CHECK-*NEXT* for the bar() frame.
 * On Win32, the bar() frame is missing altogether.
 * So be very generous and only check for 2 consecutive lines containing
 * 'exception_stack_trace' each (in function name and/or source file).
 */
// CHECK:      exception_stack_trace{{.*$}}
// CHECK-NEXT: exception_stack_trace{{.*$}}