libdatadog 35.0.0.1.0 → 36.0.0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (94) hide show
  1. checksums.yaml +4 -4
  2. data/lib/libdatadog/version.rb +1 -1
  3. data/vendor/{libdatadog-35.0.0/aarch64-linux-musl → libdatadog-36.0.0/aarch64-linux}/LICENSE-3rdparty.csv +1 -0
  4. data/vendor/{libdatadog-35.0.0 → libdatadog-36.0.0}/aarch64-linux/bin/libdatadog-crashtracking-receiver +0 -0
  5. data/vendor/{libdatadog-35.0.0/x86_64-linux-musl → libdatadog-36.0.0/aarch64-linux}/include/datadog/common.h +47 -0
  6. data/vendor/{libdatadog-35.0.0/arm64-darwin → libdatadog-36.0.0/aarch64-linux}/include/datadog/crashtracker.h +19 -0
  7. data/vendor/{libdatadog-35.0.0/aarch64-linux-musl → libdatadog-36.0.0/aarch64-linux}/include/datadog/data-pipeline.h +44 -2
  8. data/vendor/{libdatadog-35.0.0/aarch64-linux-musl → libdatadog-36.0.0/aarch64-linux}/include/datadog/profiling.h +18 -0
  9. data/vendor/libdatadog-36.0.0/aarch64-linux/include/datadog/shared-runtime.h +91 -0
  10. data/vendor/{libdatadog-35.0.0 → libdatadog-36.0.0}/aarch64-linux/lib/libdatadog_profiling.so +0 -0
  11. data/vendor/{libdatadog-35.0.0 → libdatadog-36.0.0}/aarch64-linux/lib/pkgconfig/datadog_profiling_with_rpath.pc +1 -1
  12. data/vendor/{libdatadog-35.0.0/aarch64-linux → libdatadog-36.0.0/aarch64-linux-musl}/LICENSE-3rdparty.csv +1 -0
  13. data/vendor/{libdatadog-35.0.0 → libdatadog-36.0.0}/aarch64-linux-musl/bin/libdatadog-crashtracking-receiver +0 -0
  14. data/vendor/{libdatadog-35.0.0/arm64-darwin → libdatadog-36.0.0/aarch64-linux-musl}/include/datadog/common.h +47 -0
  15. data/vendor/{libdatadog-35.0.0/aarch64-linux → libdatadog-36.0.0/aarch64-linux-musl}/include/datadog/crashtracker.h +19 -0
  16. data/vendor/{libdatadog-35.0.0/aarch64-linux → libdatadog-36.0.0/aarch64-linux-musl}/include/datadog/data-pipeline.h +44 -2
  17. data/vendor/{libdatadog-35.0.0/arm64-darwin → libdatadog-36.0.0/aarch64-linux-musl}/include/datadog/profiling.h +18 -0
  18. data/vendor/libdatadog-36.0.0/aarch64-linux-musl/include/datadog/shared-runtime.h +91 -0
  19. data/vendor/{libdatadog-35.0.0 → libdatadog-36.0.0}/aarch64-linux-musl/lib/libdatadog_profiling.so +0 -0
  20. data/vendor/{libdatadog-35.0.0 → libdatadog-36.0.0}/aarch64-linux-musl/lib/pkgconfig/datadog_profiling_with_rpath.pc +1 -1
  21. data/vendor/{libdatadog-35.0.0 → libdatadog-36.0.0}/arm64-darwin/LICENSE-3rdparty.csv +1 -0
  22. data/vendor/{libdatadog-35.0.0/aarch64-linux-musl → libdatadog-36.0.0/arm64-darwin}/include/datadog/common.h +47 -0
  23. data/vendor/{libdatadog-35.0.0/aarch64-linux-musl → libdatadog-36.0.0/arm64-darwin}/include/datadog/crashtracker.h +19 -0
  24. data/vendor/{libdatadog-35.0.0 → libdatadog-36.0.0}/arm64-darwin/include/datadog/data-pipeline.h +44 -2
  25. data/vendor/{libdatadog-35.0.0/aarch64-linux → libdatadog-36.0.0/arm64-darwin}/include/datadog/profiling.h +18 -0
  26. data/vendor/libdatadog-36.0.0/arm64-darwin/include/datadog/shared-runtime.h +91 -0
  27. data/vendor/{libdatadog-35.0.0 → libdatadog-36.0.0}/arm64-darwin/lib/libdatadog_profiling.dylib +0 -0
  28. data/vendor/{libdatadog-35.0.0 → libdatadog-36.0.0}/arm64-darwin/lib/pkgconfig/datadog_profiling_with_rpath.pc +1 -1
  29. data/vendor/libdatadog-36.0.0/x86_64-linux/LICENSE-3rdparty.csv +551 -0
  30. data/vendor/{libdatadog-35.0.0 → libdatadog-36.0.0}/x86_64-linux/bin/libdatadog-crashtracking-receiver +0 -0
  31. data/vendor/libdatadog-36.0.0/x86_64-linux/include/datadog/common.h +2947 -0
  32. data/vendor/libdatadog-36.0.0/x86_64-linux/include/datadog/crashtracker.h +1026 -0
  33. data/vendor/libdatadog-36.0.0/x86_64-linux/include/datadog/data-pipeline.h +391 -0
  34. data/vendor/libdatadog-36.0.0/x86_64-linux/include/datadog/profiling.h +1148 -0
  35. data/vendor/libdatadog-36.0.0/x86_64-linux/include/datadog/shared-runtime.h +91 -0
  36. data/vendor/{libdatadog-35.0.0 → libdatadog-36.0.0}/x86_64-linux/lib/libdatadog_profiling.so +0 -0
  37. data/vendor/libdatadog-36.0.0/x86_64-linux/lib/pkgconfig/datadog_profiling_with_rpath.pc +15 -0
  38. data/vendor/{libdatadog-35.0.0 → libdatadog-36.0.0}/x86_64-linux-musl/LICENSE-3rdparty.csv +1 -0
  39. data/vendor/{libdatadog-35.0.0 → libdatadog-36.0.0}/x86_64-linux-musl/bin/libdatadog-crashtracking-receiver +0 -0
  40. data/vendor/{libdatadog-35.0.0/aarch64-linux → libdatadog-36.0.0/x86_64-linux-musl}/include/datadog/common.h +47 -0
  41. data/vendor/{libdatadog-35.0.0 → libdatadog-36.0.0}/x86_64-linux-musl/include/datadog/crashtracker.h +19 -0
  42. data/vendor/{libdatadog-35.0.0 → libdatadog-36.0.0}/x86_64-linux-musl/include/datadog/data-pipeline.h +44 -2
  43. data/vendor/{libdatadog-35.0.0 → libdatadog-36.0.0}/x86_64-linux-musl/include/datadog/profiling.h +18 -0
  44. data/vendor/libdatadog-36.0.0/x86_64-linux-musl/include/datadog/shared-runtime.h +91 -0
  45. data/vendor/{libdatadog-35.0.0 → libdatadog-36.0.0}/x86_64-linux-musl/lib/libdatadog_profiling.so +0 -0
  46. data/vendor/{libdatadog-35.0.0 → libdatadog-36.0.0}/x86_64-linux-musl/lib/pkgconfig/datadog_profiling_with_rpath.pc +1 -1
  47. metadata +86 -81
  48. data/vendor/libdatadog-35.0.0/x86_64-linux/LICENSE-3rdparty.csv +0 -550
  49. data/vendor/libdatadog-35.0.0/x86_64-linux/include/datadog/common.h +0 -2900
  50. data/vendor/libdatadog-35.0.0/x86_64-linux/include/datadog/crashtracker.h +0 -1007
  51. data/vendor/libdatadog-35.0.0/x86_64-linux/include/datadog/data-pipeline.h +0 -349
  52. data/vendor/libdatadog-35.0.0/x86_64-linux/include/datadog/profiling.h +0 -1130
  53. data/vendor/libdatadog-35.0.0/x86_64-linux/lib/pkgconfig/datadog_profiling_with_rpath.pc +0 -15
  54. /data/vendor/{libdatadog-35.0.0 → libdatadog-36.0.0}/aarch64-linux/LICENSE +0 -0
  55. /data/vendor/{libdatadog-35.0.0 → libdatadog-36.0.0}/aarch64-linux/NOTICE +0 -0
  56. /data/vendor/{libdatadog-35.0.0 → libdatadog-36.0.0}/aarch64-linux/include/datadog/blazesym.h +0 -0
  57. /data/vendor/{libdatadog-35.0.0 → libdatadog-36.0.0}/aarch64-linux/include/datadog/ddsketch.h +0 -0
  58. /data/vendor/{libdatadog-35.0.0 → libdatadog-36.0.0}/aarch64-linux/include/datadog/ffe.h +0 -0
  59. /data/vendor/{libdatadog-35.0.0 → libdatadog-36.0.0}/aarch64-linux/include/datadog/library-config.h +0 -0
  60. /data/vendor/{libdatadog-35.0.0 → libdatadog-36.0.0}/aarch64-linux/include/datadog/log.h +0 -0
  61. /data/vendor/{libdatadog-35.0.0 → libdatadog-36.0.0}/aarch64-linux/include/datadog/telemetry.h +0 -0
  62. /data/vendor/{libdatadog-35.0.0 → libdatadog-36.0.0}/aarch64-linux-musl/LICENSE +0 -0
  63. /data/vendor/{libdatadog-35.0.0 → libdatadog-36.0.0}/aarch64-linux-musl/NOTICE +0 -0
  64. /data/vendor/{libdatadog-35.0.0 → libdatadog-36.0.0}/aarch64-linux-musl/include/datadog/blazesym.h +0 -0
  65. /data/vendor/{libdatadog-35.0.0 → libdatadog-36.0.0}/aarch64-linux-musl/include/datadog/ddsketch.h +0 -0
  66. /data/vendor/{libdatadog-35.0.0 → libdatadog-36.0.0}/aarch64-linux-musl/include/datadog/ffe.h +0 -0
  67. /data/vendor/{libdatadog-35.0.0 → libdatadog-36.0.0}/aarch64-linux-musl/include/datadog/library-config.h +0 -0
  68. /data/vendor/{libdatadog-35.0.0 → libdatadog-36.0.0}/aarch64-linux-musl/include/datadog/log.h +0 -0
  69. /data/vendor/{libdatadog-35.0.0 → libdatadog-36.0.0}/aarch64-linux-musl/include/datadog/telemetry.h +0 -0
  70. /data/vendor/{libdatadog-35.0.0 → libdatadog-36.0.0}/arm64-darwin/LICENSE +0 -0
  71. /data/vendor/{libdatadog-35.0.0 → libdatadog-36.0.0}/arm64-darwin/NOTICE +0 -0
  72. /data/vendor/{libdatadog-35.0.0 → libdatadog-36.0.0}/arm64-darwin/bin/libdatadog-crashtracking-receiver +0 -0
  73. /data/vendor/{libdatadog-35.0.0 → libdatadog-36.0.0}/arm64-darwin/include/datadog/blazesym.h +0 -0
  74. /data/vendor/{libdatadog-35.0.0 → libdatadog-36.0.0}/arm64-darwin/include/datadog/ddsketch.h +0 -0
  75. /data/vendor/{libdatadog-35.0.0 → libdatadog-36.0.0}/arm64-darwin/include/datadog/ffe.h +0 -0
  76. /data/vendor/{libdatadog-35.0.0 → libdatadog-36.0.0}/arm64-darwin/include/datadog/library-config.h +0 -0
  77. /data/vendor/{libdatadog-35.0.0 → libdatadog-36.0.0}/arm64-darwin/include/datadog/log.h +0 -0
  78. /data/vendor/{libdatadog-35.0.0 → libdatadog-36.0.0}/arm64-darwin/include/datadog/telemetry.h +0 -0
  79. /data/vendor/{libdatadog-35.0.0 → libdatadog-36.0.0}/x86_64-linux/LICENSE +0 -0
  80. /data/vendor/{libdatadog-35.0.0 → libdatadog-36.0.0}/x86_64-linux/NOTICE +0 -0
  81. /data/vendor/{libdatadog-35.0.0 → libdatadog-36.0.0}/x86_64-linux/include/datadog/blazesym.h +0 -0
  82. /data/vendor/{libdatadog-35.0.0 → libdatadog-36.0.0}/x86_64-linux/include/datadog/ddsketch.h +0 -0
  83. /data/vendor/{libdatadog-35.0.0 → libdatadog-36.0.0}/x86_64-linux/include/datadog/ffe.h +0 -0
  84. /data/vendor/{libdatadog-35.0.0 → libdatadog-36.0.0}/x86_64-linux/include/datadog/library-config.h +0 -0
  85. /data/vendor/{libdatadog-35.0.0 → libdatadog-36.0.0}/x86_64-linux/include/datadog/log.h +0 -0
  86. /data/vendor/{libdatadog-35.0.0 → libdatadog-36.0.0}/x86_64-linux/include/datadog/telemetry.h +0 -0
  87. /data/vendor/{libdatadog-35.0.0 → libdatadog-36.0.0}/x86_64-linux-musl/LICENSE +0 -0
  88. /data/vendor/{libdatadog-35.0.0 → libdatadog-36.0.0}/x86_64-linux-musl/NOTICE +0 -0
  89. /data/vendor/{libdatadog-35.0.0 → libdatadog-36.0.0}/x86_64-linux-musl/include/datadog/blazesym.h +0 -0
  90. /data/vendor/{libdatadog-35.0.0 → libdatadog-36.0.0}/x86_64-linux-musl/include/datadog/ddsketch.h +0 -0
  91. /data/vendor/{libdatadog-35.0.0 → libdatadog-36.0.0}/x86_64-linux-musl/include/datadog/ffe.h +0 -0
  92. /data/vendor/{libdatadog-35.0.0 → libdatadog-36.0.0}/x86_64-linux-musl/include/datadog/library-config.h +0 -0
  93. /data/vendor/{libdatadog-35.0.0 → libdatadog-36.0.0}/x86_64-linux-musl/include/datadog/log.h +0 -0
  94. /data/vendor/{libdatadog-35.0.0 → libdatadog-36.0.0}/x86_64-linux-musl/include/datadog/telemetry.h +0 -0
@@ -0,0 +1,1026 @@
1
+ // Copyright 2021-Present Datadog, Inc. https://www.datadoghq.com/
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+
5
+ #ifndef DDOG_CRASHTRACKER_H
6
+ #define DDOG_CRASHTRACKER_H
7
+
8
+ #pragma once
9
+
10
+ #include <stdbool.h>
11
+ #include <stddef.h>
12
+ #include <stdint.h>
13
+ #include "common.h"
14
+
15
+ #if defined(_WIN32) && defined(_CRASHTRACKING_COLLECTOR)
16
+ #include <werapi.h>
17
+ #include <windows.h>
18
+ #endif
19
+
20
+
21
+
22
+ #ifdef __cplusplus
23
+ extern "C" {
24
+ #endif // __cplusplus
25
+
26
+ /**
27
+ * Disables the crashtracker.
28
+ * Note that this does not restore the old signal handlers, but rather turns crash-tracking into a
29
+ * no-op, and then chains the old handlers. This means that handlers registered after the
30
+ * crashtracker will continue to work as expected.
31
+ *
32
+ * # Preconditions
33
+ * None
34
+ * # Safety
35
+ * None
36
+ * # Atomicity
37
+ * This function is atomic and idempotent. Calling it multiple times is allowed.
38
+ */
39
+ DDOG_CHECK_RETURN struct ddog_VoidResult ddog_crasht_disable(void);
40
+
41
+ /**
42
+ * Enables the crashtracker, if it had been previously disabled.
43
+ * If crashtracking has not been initialized, this function will have no effect.
44
+ *
45
+ * # Preconditions
46
+ * None
47
+ * # Safety
48
+ * None
49
+ * # Atomicity
50
+ * This function is atomic and idempotent. Calling it multiple times is allowed.
51
+ */
52
+ DDOG_CHECK_RETURN struct ddog_VoidResult ddog_crasht_enable(void);
53
+
54
+ /**
55
+ * Reinitialize the crash-tracking infrastructure after a fork.
56
+ * This should be one of the first things done after a fork, to minimize the
57
+ * chance that a crash occurs between the fork, and this call.
58
+ * In particular, reset the counters that track the profiler state machine.
59
+ * NOTE: An alternative design would be to have a 1:many sidecar listening on a
60
+ * socket instead of 1:1 receiver listening on a pipe, but the only real
61
+ * advantage would be to have fewer processes in `ps -a`.
62
+ *
63
+ * # Preconditions
64
+ * This function assumes that the crash-tracker has previously been
65
+ * initialized.
66
+ * # Safety
67
+ * Crash-tracking functions are not reentrant.
68
+ * No other crash-handler functions should be called concurrently.
69
+ * # Atomicity
70
+ * This function is not atomic. A crash during its execution may lead to
71
+ * unexpected crash-handling behaviour.
72
+ */
73
+ DDOG_CHECK_RETURN
74
+ struct ddog_VoidResult ddog_crasht_update_on_fork(struct ddog_crasht_Config config,
75
+ struct ddog_crasht_ReceiverConfig receiver_config,
76
+ struct ddog_crasht_Metadata metadata);
77
+
78
+ /**
79
+ * Initialize the crash-tracking infrastructure.
80
+ *
81
+ * # Preconditions
82
+ * None.
83
+ * # Safety
84
+ * Crash-tracking functions are not reentrant.
85
+ * No other crash-handler functions should be called concurrently.
86
+ * # Atomicity
87
+ * This function is not atomic. A crash during its execution may lead to
88
+ * unexpected crash-handling behaviour.
89
+ */
90
+ DDOG_CHECK_RETURN
91
+ struct ddog_VoidResult ddog_crasht_init(struct ddog_crasht_Config config,
92
+ struct ddog_crasht_ReceiverConfig receiver_config,
93
+ struct ddog_crasht_Metadata metadata);
94
+
95
+ /**
96
+ * Reconfigure the crashtracker and re-enables it.
97
+ * If the crashtracker has not been initialized, this function will have no effect.
98
+ *
99
+ * # Preconditions
100
+ * None.
101
+ * # Safety
102
+ * Crash-tracking functions are not reentrant.
103
+ * No other crash-handler functions should be called concurrently.
104
+ * # Atomicity
105
+ * This function is not atomic. A crash during its execution may lead to
106
+ * unexpected crash-handling behaviour.
107
+ */
108
+ DDOG_CHECK_RETURN
109
+ struct ddog_VoidResult ddog_crasht_reconfigure(struct ddog_crasht_Config config,
110
+ struct ddog_crasht_ReceiverConfig receiver_config,
111
+ struct ddog_crasht_Metadata metadata);
112
+
113
+ /**
114
+ * Initialize the crash-tracking infrastructure without launching the receiver.
115
+ *
116
+ * # Preconditions
117
+ * Requires `config` to be given with a `unix_socket_path`, which is normally optional.
118
+ * # Safety
119
+ * Crash-tracking functions are not reentrant.
120
+ * No other crash-handler functions should be called concurrently.
121
+ * # Atomicity
122
+ * This function is not atomic. A crash during its execution may lead to
123
+ * unexpected crash-handling behaviour.
124
+ */
125
+ DDOG_CHECK_RETURN
126
+ struct ddog_VoidResult ddog_crasht_init_without_receiver(struct ddog_crasht_Config config,
127
+ struct ddog_crasht_Metadata metadata);
128
+
129
+ /**
130
+ * Returns a list of signals suitable for use in a crashtracker config.
131
+ */
132
+ struct ddog_crasht_Slice_CInt ddog_crasht_default_signals(void);
133
+
134
+ /**
135
+ * Report an unhandled exception as a crash event.
136
+ *
137
+ * This function sends a crash report for an unhandled exception detected
138
+ * by the runtime. It is intended to be called when the process is in a
139
+ * terminal state due to an unhandled exception.
140
+ *
141
+ * # Parameters
142
+ * - `error_type`: Optional type/class of the exception (e.g. "NullPointerException"). Pass empty
143
+ * CharSlice for unknown.
144
+ * - `error_message`: Optional error message. Pass empty CharSlice for no message.
145
+ * - `runtime_stack`: Stack trace from the runtime. Consumed by this call.
146
+ *
147
+ * If the crash-tracker has not been initialized, this function is a no-op.
148
+ *
149
+ * # Side effects
150
+ * This function disables the signal-based crash handler before performing
151
+ * any work. This means that if the process receives a fatal signal (SIGSEGV)
152
+ * during or after this call, the crashtracker will not produce a
153
+ * second crash report. The previous signal handler (if any) will still be
154
+ * chained.
155
+ *
156
+ * # Failure mode
157
+ * If a fatal signal occurs while this function is in progress, the calling
158
+ * process is in an unrecoverable state; the crashtracker cannot report the
159
+ * secondary fault and the caller's own signal handler (if any) will execute
160
+ * in a potentially corrupted context. Callers should treat this function as a
161
+ * terminal operation and exit shortly after it returns.
162
+ *
163
+ * # Safety
164
+ * Crash-tracking functions are not reentrant.
165
+ * No other crash-handler functions should be called concurrently.
166
+ * The `runtime_stack` handle must be valid and will be consumed.
167
+ */
168
+ DDOG_CHECK_RETURN
169
+ struct ddog_VoidResult ddog_crasht_report_unhandled_exception(ddog_CharSlice error_type,
170
+ ddog_CharSlice error_message,
171
+ struct ddog_crasht_Handle_StackTrace *runtime_stack);
172
+
173
+ /**
174
+ * Register the expected PID of the socket-based crash receiver
175
+ *
176
+ * When `collect_all_threads` is enabled and the receiver is reached via a Unix
177
+ * socket, the crash handler will only grant ptrace permission if the socket
178
+ * peer's PID matches this registered value.
179
+ *
180
+ * Call this after establishing a trusted connection to the sidecar
181
+ *
182
+ * # Safety
183
+ * This function is safe to call from any thread at any time.
184
+ */
185
+ void ddog_crasht_set_expected_receiver_pid(int32_t pid);
186
+
187
+ /**
188
+ * Returns the currently registered expected receiver PID, or 0 if unset.
189
+ */
190
+ int32_t ddog_crasht_get_expected_receiver_pid(void);
191
+
192
+ /**
193
+ * Removes all existing additional tags
194
+ * Expected to be used after a fork, to reset the additional tags on the child
195
+ * ATOMICITY:
196
+ * This is NOT ATOMIC.
197
+ * Should only be used when no conflicting updates can occur,
198
+ * e.g. after a fork but before profiling ops start on the child.
199
+ * # Safety
200
+ * No safety concerns.
201
+ */
202
+ DDOG_CHECK_RETURN struct ddog_VoidResult ddog_crasht_clear_additional_tags(void);
203
+
204
+ /**
205
+ * Atomically registers a string as an additional tag.
206
+ * Useful for tracking what operations were occurring when a crash occurred.
207
+ * The set does not check for duplicates.
208
+ *
209
+ * Returns:
210
+ * Ok(handle) on success. The handle is needed to later remove the id;
211
+ * Err() on failure. The most likely cause of failure is that the underlying set is full.
212
+ *
213
+ * # Safety
214
+ * The string argument must be valid.
215
+ */
216
+ DDOG_CHECK_RETURN
217
+ struct ddog_crasht_Result_Usize ddog_crasht_insert_additional_tag(ddog_CharSlice s);
218
+
219
+ /**
220
+ * Atomically removes a completed SpanId.
221
+ * Useful for tracking what operations were occurring when a crash occurred.
222
+ * 0 is reserved for "NoId"
223
+ *
224
+ * Returns:
225
+ * `Ok` on success.
226
+ * `Err` on failure.
227
+ *
228
+ * # Safety
229
+ * No safety concerns.
230
+ */
231
+ DDOG_CHECK_RETURN struct ddog_VoidResult ddog_crasht_remove_additional_tag(uintptr_t idx);
232
+
233
+ /**
234
+ * Resets all counters to 0.
235
+ * Expected to be used after a fork, to reset the counters on the child
236
+ * ATOMICITY:
237
+ * This is NOT ATOMIC.
238
+ * Should only be used when no conflicting updates can occur,
239
+ * e.g. after a fork but before profiling ops start on the child.
240
+ * # Safety
241
+ * No safety concerns.
242
+ */
243
+ DDOG_CHECK_RETURN struct ddog_VoidResult ddog_crasht_reset_counters(void);
244
+
245
+ /**
246
+ * Atomically increments the count associated with `op`.
247
+ * Useful for tracking what operations were occuring when a crash occurred.
248
+ *
249
+ * # Safety
250
+ * No safety concerns.
251
+ */
252
+ DDOG_CHECK_RETURN struct ddog_VoidResult ddog_crasht_begin_op(enum ddog_crasht_OpTypes op);
253
+
254
+ /**
255
+ * Atomically decrements the count associated with `op`.
256
+ * Useful for tracking what operations were occuring when a crash occurred.
257
+ *
258
+ * # Safety
259
+ * No safety concerns.
260
+ */
261
+ DDOG_CHECK_RETURN struct ddog_VoidResult ddog_crasht_end_op(enum ddog_crasht_OpTypes op);
262
+
263
+ /**
264
+ * Resets all stored spans to 0.
265
+ * Expected to be used after a fork, to reset the spans on the child
266
+ * ATOMICITY:
267
+ * This is NOT ATOMIC.
268
+ * Should only be used when no conflicting updates can occur,
269
+ * e.g. after a fork but before profiling ops start on the child.
270
+ * # Safety
271
+ * No safety concerns.
272
+ */
273
+ DDOG_CHECK_RETURN struct ddog_VoidResult ddog_crasht_clear_span_ids(void);
274
+
275
+ /**
276
+ * Resets all stored traces to 0.
277
+ * Expected to be used after a fork, to reset the traces on the child
278
+ * ATOMICITY:
279
+ * This is NOT ATOMIC.
280
+ * Should only be used when no conflicting updates can occur,
281
+ * e.g. after a fork but before profiling ops start on the child.
282
+ * # Safety
283
+ * No safety concerns.
284
+ */
285
+ DDOG_CHECK_RETURN struct ddog_VoidResult ddog_crasht_clear_trace_ids(void);
286
+
287
+ /**
288
+ * Atomically registers an active traceId.
289
+ * Useful for tracking what operations were occurring when a crash occurred.
290
+ * 0 is reserved for "NoId"
291
+ * The set does not check for duplicates. Adding the same id twice is an error.
292
+ *
293
+ * Inputs:
294
+ * id<high/low>: the 128 bit id, broken into 2 64 bit chunks (see note)
295
+ *
296
+ * Returns:
297
+ * Ok(handle) on success. The handle is needed to later remove the id;
298
+ * Err() on failure. The most likely cause of failure is that the underlying set is full.
299
+ *
300
+ * Note: 128 bit ints in FFI were not stabilized until Rust 1.77
301
+ * https://blog.rust-lang.org/2024/03/30/i128-layout-update.html
302
+ * We're currently locked into 1.76.0, have to do an ugly workaround involving 2 64 bit ints
303
+ * until we can upgrade.
304
+ *
305
+ * # Safety
306
+ * No safety concerns.
307
+ */
308
+ DDOG_CHECK_RETURN
309
+ struct ddog_crasht_Result_Usize ddog_crasht_insert_trace_id(uint64_t id_high,
310
+ uint64_t id_low);
311
+
312
+ /**
313
+ * Atomically registers an active SpanId.
314
+ * Useful for tracking what operations were occurring when a crash occurred.
315
+ * 0 is reserved for "NoId".
316
+ * The set does not check for duplicates. Adding the same id twice is an error.
317
+ *
318
+ * Inputs:
319
+ * id<high/low>: the 128 bit id, broken into 2 64 bit chunks (see note)
320
+ *
321
+ * Returns:
322
+ * Ok(handle) on success. The handle is needed to later remove the id;
323
+ * Err() on failure. The most likely cause of failure is that the underlying set is full.
324
+ *
325
+ * Note: 128 bit ints in FFI were not stabilized until Rust 1.77
326
+ * https://blog.rust-lang.org/2024/03/30/i128-layout-update.html
327
+ * We're currently locked into 1.76.0, have to do an ugly workaround involving 2 64 bit ints
328
+ * until we can upgrade.
329
+ *
330
+ * # Safety
331
+ * No safety concerns.
332
+ */
333
+ DDOG_CHECK_RETURN
334
+ struct ddog_crasht_Result_Usize ddog_crasht_insert_span_id(uint64_t id_high,
335
+ uint64_t id_low);
336
+
337
+ /**
338
+ * Atomically removes a completed SpanId.
339
+ * Useful for tracking what operations were occurring when a crash occurred.
340
+ * 0 is reserved for "NoId"
341
+ *
342
+ * Inputs:
343
+ * id<high/low>: the 128 bit id, broken into 2 64 bit chunks (see note)
344
+ * idx: The handle for the id, from a previous successful call to `insert_span_id`.
345
+ * Attempting to remove the same element twice is an error.
346
+ * Returns:
347
+ * `Ok` on success.
348
+ * `Err` on failure. If `id` is not found at `idx`, `Err` will be returned and the set will not
349
+ * be modified.
350
+ *
351
+ * Note: 128 bit ints in FFI were not stabilized until Rust 1.77
352
+ * https://blog.rust-lang.org/2024/03/30/i128-layout-update.html
353
+ * We're currently locked into 1.76.0, have to do an ugly workaround involving 2 64 bit ints
354
+ * until we can upgrade.
355
+ *
356
+ * # Safety
357
+ * No safety concerns.
358
+ */
359
+ DDOG_CHECK_RETURN
360
+ struct ddog_VoidResult ddog_crasht_remove_span_id(uint64_t id_high,
361
+ uint64_t id_low,
362
+ uintptr_t idx);
363
+
364
+ /**
365
+ * Atomically removes a completed TraceId.
366
+ * Useful for tracking what operations were occurring when a crash occurred.
367
+ * 0 is reserved for "NoId"
368
+ *
369
+ * Inputs:
370
+ * id<high/low>: the 128 bit id, broken into 2 64 bit chunks (see note)
371
+ * idx: The handle for the id, from a previous successful call to `insert_span_id`.
372
+ * Attempting to remove the same element twice is an error.
373
+ * Returns:
374
+ * `Ok` on success.
375
+ * `Err` on failure. If `id` is not found at `idx`, `Err` will be returned and the set will not
376
+ * be modified.
377
+ *
378
+ * Note: 128 bit ints in FFI were not stabilized until Rust 1.77
379
+ * https://blog.rust-lang.org/2024/03/30/i128-layout-update.html
380
+ * We're currently locked into 1.76.0, have to do an ugly workaround involving 2 64 bit ints
381
+ * until we can upgrade.
382
+ *
383
+ * # Safety
384
+ * No safety concerns.
385
+ */
386
+ DDOG_CHECK_RETURN
387
+ struct ddog_VoidResult ddog_crasht_remove_trace_id(uint64_t id_high,
388
+ uint64_t id_low,
389
+ uintptr_t idx);
390
+
391
+ #if (defined(_CRASHTRACKING_COLLECTOR) && defined(_WIN32))
392
+ /**
393
+ * Initialize the crash-tracking infrastructure.
394
+ *
395
+ * # Preconditions
396
+ * None.
397
+ * # Safety
398
+ * Crash-tracking functions are not reentrant.
399
+ * No other crash-handler functions should be called concurrently.
400
+ * # Atomicity
401
+ * This function is not atomic. A crash during its execution may lead to
402
+ * unexpected crash-handling behaviour.
403
+ */
404
+ DDOG_CHECK_RETURN
405
+ bool ddog_crasht_init_windows(ddog_CharSlice module,
406
+ const struct ddog_Endpoint *endpoint,
407
+ struct ddog_crasht_Metadata metadata);
408
+ #endif
409
+
410
+ #if (defined(_CRASHTRACKING_COLLECTOR) && defined(_WIN32))
411
+ HRESULT OutOfProcessExceptionEventSignatureCallback(const void *_context,
412
+ const WER_RUNTIME_EXCEPTION_INFORMATION *_exception_information,
413
+ int32_t _index,
414
+ uint16_t *_name,
415
+ uint32_t *_name_size,
416
+ uint16_t *_value,
417
+ uint32_t *_value_size);
418
+ #endif
419
+
420
+ #if (defined(_CRASHTRACKING_COLLECTOR) && defined(_WIN32))
421
+ HRESULT OutOfProcessExceptionEventDebuggerLaunchCallback(const void *_context,
422
+ const WER_RUNTIME_EXCEPTION_INFORMATION *_exception_information,
423
+ BOOL *_is_custom_debugger,
424
+ uint16_t *_debugger_launch,
425
+ uint32_t *_debugger_launch_size,
426
+ BOOL *_is_debugger_auto_launch);
427
+ #endif
428
+
429
+ #if (defined(_CRASHTRACKING_COLLECTOR) && defined(_WIN32))
430
+ HRESULT OutOfProcessExceptionEventCallback(const void *context,
431
+ const WER_RUNTIME_EXCEPTION_INFORMATION *exception_information,
432
+ BOOL *_ownership_claimed,
433
+ uint16_t *_event_name,
434
+ uint32_t *_size,
435
+ uint32_t *_signature_count);
436
+ #endif
437
+
438
+ /**
439
+ * # Safety
440
+ * The `crash_info` can be null, but if non-null it must point to a Builder made by this module,
441
+ * which has not previously been dropped.
442
+ */
443
+ DDOG_CHECK_RETURN
444
+ struct ddog_VoidResult ddog_crasht_CrashInfo_demangle_names(struct ddog_crasht_Handle_CrashInfo *crash_info);
445
+
446
+ /**
447
+ * # Safety
448
+ * The `builder` can be null, but if non-null it must point to a Frame
449
+ * made by this module, which has not previously been dropped.
450
+ */
451
+ void ddog_crasht_CrashInfo_drop(struct ddog_crasht_Handle_CrashInfo *builder);
452
+
453
+ /**
454
+ * # Safety
455
+ * The `crash_info` can be null, but if non-null it must point to a Builder made by this module,
456
+ * which has not previously been dropped.
457
+ */
458
+ DDOG_CHECK_RETURN
459
+ struct ddog_VoidResult ddog_crasht_CrashInfo_normalize_ips(struct ddog_crasht_Handle_CrashInfo *crash_info,
460
+ uint32_t pid);
461
+
462
+ /**
463
+ * # Safety
464
+ * The `crash_info` can be null, but if non-null it must point to a Builder made by this module,
465
+ * which has not previously been dropped.
466
+ */
467
+ DDOG_CHECK_RETURN
468
+ struct ddog_VoidResult ddog_crasht_CrashInfo_resolve_names(struct ddog_crasht_Handle_CrashInfo *crash_info,
469
+ uint32_t pid);
470
+
471
+ /**
472
+ * # Safety
473
+ * The `crash_info` can be null, but if non-null it must point to a Builder made by this module,
474
+ * which has not previously been dropped.
475
+ * This function will:
476
+ */
477
+ DDOG_CHECK_RETURN
478
+ struct ddog_VoidResult ddog_crasht_CrashInfo_enrich_callstacks(struct ddog_crasht_Handle_CrashInfo *crash_info,
479
+ uint32_t pid);
480
+
481
+ /**
482
+ * # Safety
483
+ * The `crash_info` can be null, but if non-null it must point to a Builder made by this module,
484
+ * which has not previously been dropped.
485
+ * The CharSlice must be valid.
486
+ */
487
+ DDOG_CHECK_RETURN
488
+ struct ddog_VoidResult ddog_crasht_CrashInfo_upload_to_endpoint(struct ddog_crasht_Handle_CrashInfo *crash_info,
489
+ const struct ddog_Endpoint *endpoint);
490
+
491
+ /**
492
+ * Create a new CrashInfoBuilder, and returns an opaque reference to it.
493
+ * # Safety
494
+ * No safety issues.
495
+ */
496
+ DDOG_CHECK_RETURN
497
+ struct ddog_crasht_CrashInfoBuilder_NewResult ddog_crasht_CrashInfoBuilder_new(void);
498
+
499
+ /**
500
+ * # Safety
501
+ * The `builder` can be null, but if non-null it must point to a Frame
502
+ * made by this module, which has not previously been dropped.
503
+ */
504
+ void ddog_crasht_CrashInfoBuilder_drop(struct ddog_crasht_Handle_CrashInfoBuilder *builder);
505
+
506
+ /**
507
+ * # Safety
508
+ * The `builder` can be null, but if non-null it must point to a Builder made by this module,
509
+ * which has not previously been dropped.
510
+ */
511
+ DDOG_CHECK_RETURN
512
+ ddog_crasht_CrashInfo_NewResult ddog_crasht_CrashInfoBuilder_build(struct ddog_crasht_Handle_CrashInfoBuilder *builder);
513
+
514
+ /**
515
+ * # Safety
516
+ * The `builder` can be null, but if non-null it must point to a Builder made by this module,
517
+ * which has not previously been dropped.
518
+ * The CharSlice must be valid.
519
+ */
520
+ DDOG_CHECK_RETURN
521
+ struct ddog_VoidResult ddog_crasht_CrashInfoBuilder_with_counter(struct ddog_crasht_Handle_CrashInfoBuilder *builder,
522
+ ddog_CharSlice name,
523
+ int64_t value);
524
+
525
+ /**
526
+ * # Safety
527
+ * The `builder` can be null, but if non-null it must point to a Builder made by this module,
528
+ * which has not previously been dropped.
529
+ * The Kind must be valid.
530
+ */
531
+ DDOG_CHECK_RETURN
532
+ struct ddog_VoidResult ddog_crasht_CrashInfoBuilder_with_kind(struct ddog_crasht_Handle_CrashInfoBuilder *builder,
533
+ enum ddog_crasht_ErrorKind kind);
534
+
535
+ /**
536
+ * # Safety
537
+ * The `builder` can be null, but if non-null it must point to a Builder made by this module,
538
+ * which has not previously been dropped.
539
+ * The CharSlice must be valid.
540
+ */
541
+ DDOG_CHECK_RETURN
542
+ struct ddog_VoidResult ddog_crasht_CrashInfoBuilder_with_file(struct ddog_crasht_Handle_CrashInfoBuilder *builder,
543
+ ddog_CharSlice filename);
544
+
545
+ /**
546
+ * # Safety
547
+ * The `builder` can be null, but if non-null it must point to a Builder made by this module,
548
+ * which has not previously been dropped.
549
+ * The CharSlice must be valid.
550
+ */
551
+ DDOG_CHECK_RETURN
552
+ struct ddog_VoidResult ddog_crasht_CrashInfoBuilder_with_file_and_contents(struct ddog_crasht_Handle_CrashInfoBuilder *builder,
553
+ ddog_CharSlice filename,
554
+ struct ddog_crasht_Slice_CharSlice contents);
555
+
556
+ /**
557
+ * # Safety
558
+ * The `builder` can be null, but if non-null it must point to a Builder made by this module,
559
+ * which has not previously been dropped.
560
+ * The CharSlice must be valid.
561
+ */
562
+ DDOG_CHECK_RETURN
563
+ struct ddog_VoidResult ddog_crasht_CrashInfoBuilder_with_fingerprint(struct ddog_crasht_Handle_CrashInfoBuilder *builder,
564
+ ddog_CharSlice fingerprint);
565
+
566
+ /**
567
+ * # Safety
568
+ * The `builder` can be null, but if non-null it must point to a Builder made by this module,
569
+ * which has not previously been dropped.
570
+ * The CharSlice must be valid.
571
+ */
572
+ DDOG_CHECK_RETURN
573
+ struct ddog_VoidResult ddog_crasht_CrashInfoBuilder_with_incomplete(struct ddog_crasht_Handle_CrashInfoBuilder *builder,
574
+ bool incomplete);
575
+
576
+ /**
577
+ * # Safety
578
+ * The `builder` can be null, but if non-null it must point to a Builder made by this module,
579
+ * which has not previously been dropped.
580
+ * The CharSlice must be valid.
581
+ */
582
+ DDOG_CHECK_RETURN
583
+ struct ddog_VoidResult ddog_crasht_CrashInfoBuilder_with_log_message(struct ddog_crasht_Handle_CrashInfoBuilder *builder,
584
+ ddog_CharSlice message,
585
+ bool also_print);
586
+
587
+ /**
588
+ * # Safety
589
+ * The `builder` can be null, but if non-null it must point to a Builder made by this module,
590
+ * which has not previously been dropped.
591
+ * All arguments must be valid.
592
+ */
593
+ DDOG_CHECK_RETURN
594
+ struct ddog_VoidResult ddog_crasht_CrashInfoBuilder_with_metadata(struct ddog_crasht_Handle_CrashInfoBuilder *builder,
595
+ struct ddog_crasht_Metadata metadata);
596
+
597
+ /**
598
+ * # Safety
599
+ * The `builder` can be null, but if non-null it must point to a Builder made by this module,
600
+ * which has not previously been dropped.
601
+ * All arguments must be valid.
602
+ */
603
+ DDOG_CHECK_RETURN
604
+ struct ddog_VoidResult ddog_crasht_CrashInfoBuilder_with_os_info(struct ddog_crasht_Handle_CrashInfoBuilder *builder,
605
+ struct ddog_crasht_OsInfo os_info);
606
+
607
+ /**
608
+ * # Safety
609
+ * The `builder` can be null, but if non-null it must point to a Builder made by this module,
610
+ * which has not previously been dropped.
611
+ * All arguments must be valid.
612
+ */
613
+ DDOG_CHECK_RETURN
614
+ struct ddog_VoidResult ddog_crasht_CrashInfoBuilder_with_os_info_this_machine(struct ddog_crasht_Handle_CrashInfoBuilder *builder);
615
+
616
+ /**
617
+ * # Safety
618
+ * The `builder` can be null, but if non-null it must point to a Builder made by this module,
619
+ * which has not previously been dropped.
620
+ * All arguments must be valid.
621
+ */
622
+ DDOG_CHECK_RETURN
623
+ struct ddog_VoidResult ddog_crasht_CrashInfoBuilder_with_proc_info(struct ddog_crasht_Handle_CrashInfoBuilder *builder,
624
+ struct ddog_crasht_ProcInfo proc_info);
625
+
626
+ /**
627
+ * # Safety
628
+ * The `builder` can be null, but if non-null it must point to a Builder made by this module,
629
+ * which has not previously been dropped.
630
+ * All arguments must be valid.
631
+ */
632
+ DDOG_CHECK_RETURN
633
+ struct ddog_VoidResult ddog_crasht_CrashInfoBuilder_with_sig_info(struct ddog_crasht_Handle_CrashInfoBuilder *builder,
634
+ struct ddog_crasht_SigInfo sig_info);
635
+
636
+ /**
637
+ * # Safety
638
+ * The `builder` can be null, but if non-null it must point to a Builder made by this module,
639
+ * which has not previously been dropped.
640
+ * All arguments must be valid.
641
+ */
642
+ DDOG_CHECK_RETURN
643
+ struct ddog_VoidResult ddog_crasht_CrashInfoBuilder_with_span_id(struct ddog_crasht_Handle_CrashInfoBuilder *builder,
644
+ struct ddog_crasht_Span span_id);
645
+
646
+ /**
647
+ * # Safety
648
+ * The `builder` can be null, but if non-null it must point to a Builder made by this module,
649
+ * which has not previously been dropped.
650
+ * All arguments must be valid.
651
+ * Consumes the stack argument.
652
+ */
653
+ DDOG_CHECK_RETURN
654
+ struct ddog_VoidResult ddog_crasht_CrashInfoBuilder_with_stack(struct ddog_crasht_Handle_CrashInfoBuilder *builder,
655
+ struct ddog_crasht_Handle_StackTrace *stack);
656
+
657
+ /**
658
+ * # Safety
659
+ * The `builder` can be null, but if non-null it must point to a Builder made by this module,
660
+ * which has not previously been dropped.
661
+ * All arguments must be valid.
662
+ * Consumes the stack argument.
663
+ */
664
+ DDOG_CHECK_RETURN
665
+ struct ddog_VoidResult ddog_crasht_CrashInfoBuilder_with_thread(struct ddog_crasht_Handle_CrashInfoBuilder *builder,
666
+ struct ddog_crasht_ThreadData thread);
667
+
668
+ /**
669
+ * # Safety
670
+ * The `builder` can be null, but if non-null it must point to a Builder made by this module,
671
+ * which has not previously been dropped.
672
+ * The CharSlice must be valid.
673
+ */
674
+ DDOG_CHECK_RETURN
675
+ struct ddog_VoidResult ddog_crasht_CrashInfoBuilder_with_timestamp(struct ddog_crasht_Handle_CrashInfoBuilder *builder,
676
+ struct ddog_Timespec ts);
677
+
678
+ /**
679
+ * # Safety
680
+ * The `builder` can be null, but if non-null it must point to a Builder made by this module,
681
+ * which has not previously been dropped.
682
+ * The CharSlice must be valid.
683
+ */
684
+ DDOG_CHECK_RETURN
685
+ struct ddog_VoidResult ddog_crasht_CrashInfoBuilder_with_timestamp_now(struct ddog_crasht_Handle_CrashInfoBuilder *builder);
686
+
687
+ /**
688
+ * # Safety
689
+ * The `builder` can be null, but if non-null it must point to a Builder made by this module,
690
+ * which has not previously been dropped.
691
+ * All arguments must be valid.
692
+ */
693
+ DDOG_CHECK_RETURN
694
+ struct ddog_VoidResult ddog_crasht_CrashInfoBuilder_with_trace_id(struct ddog_crasht_Handle_CrashInfoBuilder *builder,
695
+ struct ddog_crasht_Span trace_id);
696
+
697
+ /**
698
+ * # Safety
699
+ * The `builder` can be null, but if non-null it must point to a Builder made by this module,
700
+ * which has not previously been dropped.
701
+ * The CharSlice must be valid.
702
+ */
703
+ DDOG_CHECK_RETURN
704
+ struct ddog_VoidResult ddog_crasht_CrashInfoBuilder_with_message(struct ddog_crasht_Handle_CrashInfoBuilder *builder,
705
+ ddog_CharSlice message);
706
+
707
+ /**
708
+ * # Safety
709
+ * The `builder` can be null, but if non-null it must point to a Builder made by this module,
710
+ * which has not previously been dropped.
711
+ * The CharSlice must be valid.
712
+ */
713
+ DDOG_CHECK_RETURN
714
+ struct ddog_VoidResult ddog_crasht_CrashInfoBuilder_with_thread_name(struct ddog_crasht_Handle_CrashInfoBuilder *builder,
715
+ ddog_CharSlice thread_name);
716
+
717
+ /**
718
+ * # Safety
719
+ * The `builder` can be null, but if non-null it must point to a Builder made by this module,
720
+ * which has not previously been dropped.
721
+ * All arguments must be valid.
722
+ * This method requires that the builder has `metadata` and `kind` set
723
+ * Applications can add `message` or `sig_info` to the builder to provide additional context.
724
+ * If set, the data will be used to derive the crash ping message in the order of
725
+ * - an explicit message set with `with_message`
726
+ * - sig_info set with `with_sig_info`
727
+ * - kind set with `with_kind`
728
+ */
729
+ DDOG_CHECK_RETURN
730
+ struct ddog_VoidResult ddog_crasht_CrashInfoBuilder_upload_ping_to_endpoint(struct ddog_crasht_Handle_CrashInfoBuilder *builder,
731
+ const struct ddog_Endpoint *endpoint);
732
+
733
+ /**
734
+ * Create a new StackFrame, and returns an opaque reference to it.
735
+ * # Safety
736
+ * No safety issues.
737
+ */
738
+ DDOG_CHECK_RETURN struct ddog_crasht_StackFrame_NewResult ddog_crasht_StackFrame_new(void);
739
+
740
+ /**
741
+ * # Safety
742
+ * The `frame` can be null, but if non-null it must point to a Frame
743
+ * made by this module, which has not previously been dropped.
744
+ */
745
+ void ddog_crasht_StackFrame_drop(struct ddog_crasht_Handle_StackFrame *frame);
746
+
747
+ /**
748
+ * # Safety
749
+ * The `frame` can be null, but if non-null it must point to a Frame made by this module,
750
+ * which has not previously been dropped.
751
+ * The CharSlice must be valid.
752
+ */
753
+ DDOG_CHECK_RETURN
754
+ struct ddog_VoidResult ddog_crasht_StackFrame_with_ip(struct ddog_crasht_Handle_StackFrame *frame,
755
+ uintptr_t ip);
756
+
757
+ /**
758
+ * # Safety
759
+ * The `frame` can be null, but if non-null it must point to a Frame made by this module,
760
+ * which has not previously been dropped.
761
+ * The CharSlice must be valid.
762
+ */
763
+ DDOG_CHECK_RETURN
764
+ struct ddog_VoidResult ddog_crasht_StackFrame_with_module_base_address(struct ddog_crasht_Handle_StackFrame *frame,
765
+ uintptr_t module_base_address);
766
+
767
+ /**
768
+ * # Safety
769
+ * The `frame` can be null, but if non-null it must point to a Frame made by this module,
770
+ * which has not previously been dropped.
771
+ * The CharSlice must be valid.
772
+ */
773
+ DDOG_CHECK_RETURN
774
+ struct ddog_VoidResult ddog_crasht_StackFrame_with_sp(struct ddog_crasht_Handle_StackFrame *frame,
775
+ uintptr_t sp);
776
+
777
+ /**
778
+ * # Safety
779
+ * The `frame` can be null, but if non-null it must point to a Frame made by this module,
780
+ * which has not previously been dropped.
781
+ * The CharSlice must be valid.
782
+ */
783
+ DDOG_CHECK_RETURN
784
+ struct ddog_VoidResult ddog_crasht_StackFrame_with_symbol_address(struct ddog_crasht_Handle_StackFrame *frame,
785
+ uintptr_t symbol_address);
786
+
787
+ /**
788
+ * # Safety
789
+ * The `frame` can be null, but if non-null it must point to a Frame made by this module,
790
+ * which has not previously been dropped.
791
+ * The CharSlice must be valid.
792
+ */
793
+ DDOG_CHECK_RETURN
794
+ struct ddog_VoidResult ddog_crasht_StackFrame_with_build_id(struct ddog_crasht_Handle_StackFrame *frame,
795
+ ddog_CharSlice build_id);
796
+
797
+ /**
798
+ * # Safety
799
+ * The `frame` can be null, but if non-null it must point to a Frame made by this module,
800
+ * which has not previously been dropped.
801
+ * The BuildIdType must be valid.
802
+ */
803
+ DDOG_CHECK_RETURN
804
+ struct ddog_VoidResult ddog_crasht_StackFrame_with_build_id_type(struct ddog_crasht_Handle_StackFrame *frame,
805
+ enum ddog_crasht_BuildIdType build_id_type);
806
+
807
+ /**
808
+ * # Safety
809
+ * The `frame` can be null, but if non-null it must point to a Frame made by this module,
810
+ * which has not previously been dropped.
811
+ * The FileType must be valid.
812
+ */
813
+ DDOG_CHECK_RETURN
814
+ struct ddog_VoidResult ddog_crasht_StackFrame_with_file_type(struct ddog_crasht_Handle_StackFrame *frame,
815
+ enum ddog_crasht_FileType file_type);
816
+
817
+ /**
818
+ * # Safety
819
+ * The `frame` can be null, but if non-null it must point to a Frame made by this module,
820
+ * which has not previously been dropped.
821
+ * The CharSlice must be valid.
822
+ */
823
+ DDOG_CHECK_RETURN
824
+ struct ddog_VoidResult ddog_crasht_StackFrame_with_path(struct ddog_crasht_Handle_StackFrame *frame,
825
+ ddog_CharSlice path);
826
+
827
+ /**
828
+ * # Safety
829
+ * The `frame` can be null, but if non-null it must point to a Frame made by this module,
830
+ * which has not previously been dropped.
831
+ * The CharSlice must be valid.
832
+ */
833
+ DDOG_CHECK_RETURN
834
+ struct ddog_VoidResult ddog_crasht_StackFrame_with_relative_address(struct ddog_crasht_Handle_StackFrame *frame,
835
+ uintptr_t relative_address);
836
+
837
+ /**
838
+ * # Safety
839
+ * The `frame` can be null, but if non-null it must point to a Frame made by this module,
840
+ * which has not previously been dropped.
841
+ */
842
+ DDOG_CHECK_RETURN
843
+ struct ddog_VoidResult ddog_crasht_StackFrame_with_column(struct ddog_crasht_Handle_StackFrame *frame,
844
+ uint32_t column);
845
+
846
+ /**
847
+ * # Safety
848
+ * The `frame` can be null, but if non-null it must point to a Frame made by this module,
849
+ * which has not previously been dropped.
850
+ * The CharSlice must be valid.
851
+ */
852
+ DDOG_CHECK_RETURN
853
+ struct ddog_VoidResult ddog_crasht_StackFrame_with_file(struct ddog_crasht_Handle_StackFrame *frame,
854
+ ddog_CharSlice file);
855
+
856
+ /**
857
+ * # Safety
858
+ * The `frame` can be null, but if non-null it must point to a Frame made by this module,
859
+ * which has not previously been dropped.
860
+ * The CharSlice must be valid.
861
+ */
862
+ DDOG_CHECK_RETURN
863
+ struct ddog_VoidResult ddog_crasht_StackFrame_with_function(struct ddog_crasht_Handle_StackFrame *frame,
864
+ ddog_CharSlice function);
865
+
866
+ /**
867
+ * # Safety
868
+ * The `frame` can be null, but if non-null it must point to a Frame made by this module,
869
+ * which has not previously been dropped.
870
+ */
871
+ DDOG_CHECK_RETURN
872
+ struct ddog_VoidResult ddog_crasht_StackFrame_with_line(struct ddog_crasht_Handle_StackFrame *frame,
873
+ uint32_t line);
874
+
875
+ /**
876
+ * Create a new StackTrace, and returns an opaque reference to it.
877
+ * # Safety
878
+ * No safety issues.
879
+ */
880
+ DDOG_CHECK_RETURN struct ddog_crasht_StackTrace_NewResult ddog_crasht_StackTrace_new(void);
881
+
882
+ /**
883
+ * # Safety
884
+ * The `frame` can be null, but if non-null it must point to a Frame
885
+ * made by this module, which has not previously been dropped.
886
+ */
887
+ void ddog_crasht_StackTrace_drop(struct ddog_crasht_Handle_StackTrace *trace);
888
+
889
+ /**
890
+ * # Safety
891
+ * The `stacktrace` can be null, but if non-null it must point to a StackTrace made by this module,
892
+ * which has not previously been dropped.
893
+ * The frame can be non-null, but if non-null it must point to a Frame made by this module,
894
+ * which has not previously been dropped.
895
+ * The frame is consumed, and does not need to be dropped after this operation.
896
+ */
897
+ DDOG_CHECK_RETURN
898
+ struct ddog_VoidResult ddog_crasht_StackTrace_push_frame(struct ddog_crasht_Handle_StackTrace *trace,
899
+ struct ddog_crasht_Handle_StackFrame *frame,
900
+ bool incomplete);
901
+
902
+ /**
903
+ * # Safety
904
+ * The `stacktrace` can be null, but if non-null it must point to a StackTrace made by this module,
905
+ * which has not previously been dropped.
906
+ */
907
+ DDOG_CHECK_RETURN
908
+ struct ddog_VoidResult ddog_crasht_StackTrace_set_complete(struct ddog_crasht_Handle_StackTrace *trace);
909
+
910
+ /**
911
+ * Demangles the string "name".
912
+ * If demangling fails, returns an empty string ""
913
+ *
914
+ * # Safety
915
+ * `name` should be a valid reference to a utf8 encoded String.
916
+ * The string is copied into the result, and does not need to outlive this call
917
+ */
918
+ DDOG_CHECK_RETURN
919
+ struct ddog_StringWrapperResult ddog_crasht_demangle(ddog_CharSlice name,
920
+ enum ddog_crasht_DemangleOptions options);
921
+
922
+ /**
923
+ * Receives data from a crash collector via a pipe on `stdin`, formats it into
924
+ * `CrashInfo` json, and emits it to the endpoint/file defined in `config`.
925
+ *
926
+ * At a high-level, this exists because doing anything in a
927
+ * signal handler is dangerous, so we fork a sidecar to do the stuff we aren't
928
+ * allowed to do in the handler.
929
+ *
930
+ * See comments in [libdd-crashtracker/lib.rs] for a full architecture description.
931
+ * # Safety
932
+ * No safety concerns
933
+ */
934
+ DDOG_CHECK_RETURN struct ddog_VoidResult ddog_crasht_receiver_entry_point_stdin(void);
935
+
936
+ /**
937
+ * Receives data from a crash collector via a pipe on `stdin`, formats it into
938
+ * `CrashInfo` json, and emits it to the endpoint/file defined in `config`.
939
+ *
940
+ * At a high-level, this exists because doing anything in a
941
+ * signal handler is dangerous, so we fork a sidecar to do the stuff we aren't
942
+ * allowed to do in the handler.
943
+ *
944
+ * See comments in [libdd-crashtracker/lib.rs] for a full architecture
945
+ * description.
946
+ * # Safety
947
+ * No safety concerns
948
+ */
949
+ DDOG_CHECK_RETURN
950
+ struct ddog_VoidResult ddog_crasht_receiver_entry_point_unix_socket(ddog_CharSlice socket_path);
951
+
952
+ /**
953
+ * Register a runtime stack collection callback
954
+ *
955
+ * # Arguments
956
+ * - `callback`: The callback function to invoke during crashes
957
+ *
958
+ * # Returns
959
+ * - `CallbackResult::Ok` if registration succeeds
960
+ * - `CallbackResult::Error` if registration fails
961
+ *
962
+ * # Safety
963
+ * - The callback must be signal-safe
964
+ * - Only one callback can be registered at a time
965
+ * - The callback must be registered once on CrashTracker initialization, before any crash occurs
966
+ *
967
+ * # Example Usage from C
968
+ * ```c
969
+ * static void my_runtime_callback(
970
+ * void (*emit_frame)(const ddog_RuntimeStackFrameFFI*),
971
+ * ) {
972
+ * // Collect runtime frames and call emit_frame for each one
973
+ * const char* function_name = "my_function";
974
+ * const char* file_name = "script.rb";
975
+ * ddog_CharSlice type_name = DDOG_CHARSLICE_FROM_CSTR("MyModule.MyClass");
976
+ * ddog_crasht_RuntimeStackFrameFFI frame = {
977
+ * .type_name = type_name,
978
+ * .function = DDOG_CHARSLICE_FROM_CSTR(function_name),
979
+ * .file = DDOG_CHARSLICE_FROM_CSTR(file_name),
980
+ * .line = 42,
981
+ * .column = 10
982
+ * };
983
+ * emit_frame(&frame);
984
+ * }
985
+ */
986
+ enum ddog_crasht_CallbackResult ddog_crasht_register_runtime_frame_callback(ddog_crasht_RuntimeStackFrameCallback callback);
987
+
988
+ /**
989
+ * Register a runtime stacktrace string collection callback
990
+ *
991
+ * # Arguments
992
+ * - `callback`: The callback function to invoke during crashes
993
+ *
994
+ * # Returns
995
+ * - `CallbackResult::Ok` if registration succeeds (replaces any existing callback)
996
+ * - `CallbackResult::Error` if registration fails
997
+ *
998
+ * # Safety
999
+ * - The callback must be signal-safe
1000
+ * - Only one callback can be registered at a time (this replaces any existing one)
1001
+ */
1002
+ enum ddog_crasht_CallbackResult ddog_crasht_register_runtime_stacktrace_string_callback(ddog_crasht_RuntimeStacktraceStringCallback callback);
1003
+
1004
+ /**
1005
+ * Returns true if a callback is registered, false otherwise
1006
+ *
1007
+ * # Safety
1008
+ * This function is safe to call at any time
1009
+ */
1010
+ bool ddog_crasht_is_runtime_callback_registered(void);
1011
+
1012
+ /**
1013
+ * Get the callback type from the currently registered callback context
1014
+ *
1015
+ * # Safety
1016
+ * - The returned pointer is valid only while the callback remains registered
1017
+ * - The caller should not free the returned pointer
1018
+ * - The returned string should be copied if it needs to persist beyond callback lifetime
1019
+ */
1020
+ const char *ddog_crasht_get_registered_callback_type(void);
1021
+
1022
+ #ifdef __cplusplus
1023
+ } // extern "C"
1024
+ #endif // __cplusplus
1025
+
1026
+ #endif /* DDOG_CRASHTRACKER_H */