Skip to content

Commit deb06c8

Browse files
committed
[Backtracing][Linux] Add missing CrashInfo.h header.
This was added to a later PR, but not to this one, though we need it here. rdar://110261430
1 parent 2dcaa6f commit deb06c8

File tree

1 file changed

+70
-0
lines changed

1 file changed

+70
-0
lines changed

include/swift/Runtime/CrashInfo.h

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
//===--- CrashInfo.h - Swift Backtracing Crash Information ------*- C++ -*-===//
2+
//
3+
// This source file is part of the Swift.org open source project
4+
//
5+
// Copyright (c) 2023 Apple Inc. and the Swift project authors
6+
// Licensed under Apache License v2.0 with Runtime Library Exception
7+
//
8+
// See https://swift.org/LICENSE.txt for license information
9+
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
10+
//
11+
//===----------------------------------------------------------------------===//
12+
//
13+
// Defines the CrashInfo type that holds information about why the program
14+
// crashed.
15+
//
16+
//===----------------------------------------------------------------------===//
17+
18+
#ifndef SWIFT_CRASHINFO_H
19+
#define SWIFT_CRASHINFO_H
20+
21+
#include <inttypes.h>
22+
23+
#ifdef __cplusplus
24+
namespace swift {
25+
namespace runtime {
26+
namespace backtrace {
27+
extern "C" {
28+
#endif
29+
30+
struct CrashInfo {
31+
uint64_t crashing_thread;
32+
uint64_t signal;
33+
uint64_t fault_address;
34+
35+
#ifdef __APPLE__
36+
uint64_t mctx;
37+
#elif defined(__linux__)
38+
uint64_t thread_list;
39+
#endif
40+
};
41+
42+
#ifdef __linux__
43+
44+
struct memserver_req {
45+
uint64_t addr;
46+
uint64_t len;
47+
};
48+
49+
struct memserver_resp {
50+
uint64_t addr;
51+
int64_t len;
52+
/* Then len bytes of data */
53+
};
54+
55+
struct thread {
56+
uint64_t next;
57+
int64_t tid;
58+
uint64_t uctx;
59+
};
60+
61+
#endif
62+
63+
#ifdef __cplusplus
64+
} // extern "C"
65+
} // namespace backtrace
66+
} // namespace runtime
67+
} // namespace swift
68+
#endif
69+
70+
#endif // SWIFT_CRASHINFO_H

0 commit comments

Comments
 (0)