libdatadog 46.1.1.1.1 → 47.0.0.1.1

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 (99) hide show
  1. checksums.yaml +4 -4
  2. data/lib/libdatadog/version.rb +1 -1
  3. data/rust-toolchain.toml +1 -1
  4. data/vendor/{libdatadog-46.1.1/aarch64-linux-musl → libdatadog-47.0.0/aarch64-linux}/LICENSE-3rdparty.csv +7 -3
  5. data/vendor/{libdatadog-46.1.1 → libdatadog-47.0.0}/aarch64-linux/bin/libdatadog-crashtracking-receiver +0 -0
  6. data/vendor/{libdatadog-46.1.1 → libdatadog-47.0.0}/aarch64-linux/include/datadog/common.h +25 -0
  7. data/vendor/{libdatadog-46.1.1/arm64-darwin → libdatadog-47.0.0/aarch64-linux}/include/datadog/crashtracker.h +0 -28
  8. data/vendor/{libdatadog-46.1.1/aarch64-linux-musl → libdatadog-47.0.0/aarch64-linux}/include/datadog/ffe.h +34 -0
  9. data/vendor/{libdatadog-46.1.1 → libdatadog-47.0.0}/aarch64-linux/lib/libdatadog_profiling.so +0 -0
  10. data/vendor/{libdatadog-46.1.1/arm64-darwin → libdatadog-47.0.0/aarch64-linux}/lib/pkgconfig/datadog_profiling_with_rpath.pc +1 -1
  11. data/vendor/{libdatadog-46.1.1/aarch64-linux → libdatadog-47.0.0/aarch64-linux-musl}/LICENSE-3rdparty.csv +7 -3
  12. data/vendor/{libdatadog-46.1.1 → libdatadog-47.0.0}/aarch64-linux-musl/bin/libdatadog-crashtracking-receiver +0 -0
  13. data/vendor/{libdatadog-46.1.1 → libdatadog-47.0.0}/aarch64-linux-musl/include/datadog/common.h +25 -0
  14. data/vendor/{libdatadog-46.1.1/aarch64-linux → libdatadog-47.0.0/aarch64-linux-musl}/include/datadog/crashtracker.h +0 -28
  15. data/vendor/{libdatadog-46.1.1/aarch64-linux → libdatadog-47.0.0/aarch64-linux-musl}/include/datadog/ffe.h +34 -0
  16. data/vendor/{libdatadog-46.1.1 → libdatadog-47.0.0}/aarch64-linux-musl/lib/libdatadog_profiling.so +0 -0
  17. data/vendor/{libdatadog-46.1.1 → libdatadog-47.0.0}/aarch64-linux-musl/lib/pkgconfig/datadog_profiling_with_rpath.pc +1 -1
  18. data/vendor/{libdatadog-46.1.1 → libdatadog-47.0.0}/arm64-darwin/LICENSE-3rdparty.csv +7 -3
  19. data/vendor/{libdatadog-46.1.1 → libdatadog-47.0.0}/arm64-darwin/include/datadog/common.h +25 -0
  20. data/vendor/{libdatadog-46.1.1/aarch64-linux-musl → libdatadog-47.0.0/arm64-darwin}/include/datadog/crashtracker.h +0 -28
  21. data/vendor/{libdatadog-46.1.1 → libdatadog-47.0.0}/arm64-darwin/include/datadog/ffe.h +34 -0
  22. data/vendor/{libdatadog-46.1.1 → libdatadog-47.0.0}/arm64-darwin/lib/libdatadog_profiling.dylib +0 -0
  23. data/vendor/{libdatadog-46.1.1/x86_64-linux-musl → libdatadog-47.0.0/arm64-darwin}/lib/pkgconfig/datadog_profiling_with_rpath.pc +1 -1
  24. data/vendor/libdatadog-47.0.0/x86_64-linux/LICENSE-3rdparty.csv +561 -0
  25. data/vendor/{libdatadog-46.1.1 → libdatadog-47.0.0}/x86_64-linux/bin/libdatadog-crashtracking-receiver +0 -0
  26. data/vendor/libdatadog-47.0.0/x86_64-linux/include/datadog/common.h +3240 -0
  27. data/vendor/libdatadog-47.0.0/x86_64-linux/include/datadog/crashtracker.h +998 -0
  28. data/vendor/libdatadog-47.0.0/x86_64-linux/include/datadog/ffe.h +225 -0
  29. data/vendor/{libdatadog-46.1.1 → libdatadog-47.0.0}/x86_64-linux/lib/libdatadog_profiling.so +0 -0
  30. data/vendor/libdatadog-47.0.0/x86_64-linux/lib/pkgconfig/datadog_profiling_with_rpath.pc +15 -0
  31. data/vendor/{libdatadog-46.1.1 → libdatadog-47.0.0}/x86_64-linux-musl/LICENSE-3rdparty.csv +7 -3
  32. data/vendor/{libdatadog-46.1.1 → libdatadog-47.0.0}/x86_64-linux-musl/bin/libdatadog-crashtracking-receiver +0 -0
  33. data/vendor/{libdatadog-46.1.1 → libdatadog-47.0.0}/x86_64-linux-musl/include/datadog/common.h +25 -0
  34. data/vendor/{libdatadog-46.1.1 → libdatadog-47.0.0}/x86_64-linux-musl/include/datadog/crashtracker.h +0 -28
  35. data/vendor/{libdatadog-46.1.1 → libdatadog-47.0.0}/x86_64-linux-musl/include/datadog/ffe.h +34 -0
  36. data/vendor/{libdatadog-46.1.1 → libdatadog-47.0.0}/x86_64-linux-musl/lib/libdatadog_profiling.so +0 -0
  37. data/vendor/{libdatadog-46.1.1/aarch64-linux → libdatadog-47.0.0/x86_64-linux-musl}/lib/pkgconfig/datadog_profiling_with_rpath.pc +1 -1
  38. metadata +91 -91
  39. data/vendor/libdatadog-46.1.1/x86_64-linux/LICENSE-3rdparty.csv +0 -557
  40. data/vendor/libdatadog-46.1.1/x86_64-linux/include/datadog/common.h +0 -3215
  41. data/vendor/libdatadog-46.1.1/x86_64-linux/include/datadog/crashtracker.h +0 -1026
  42. data/vendor/libdatadog-46.1.1/x86_64-linux/include/datadog/ffe.h +0 -191
  43. data/vendor/libdatadog-46.1.1/x86_64-linux/lib/pkgconfig/datadog_profiling_with_rpath.pc +0 -15
  44. /data/vendor/{libdatadog-46.1.1 → libdatadog-47.0.0}/aarch64-linux/LICENSE +0 -0
  45. /data/vendor/{libdatadog-46.1.1 → libdatadog-47.0.0}/aarch64-linux/NOTICE +0 -0
  46. /data/vendor/{libdatadog-46.1.1 → libdatadog-47.0.0}/aarch64-linux/include/datadog/blazesym.h +0 -0
  47. /data/vendor/{libdatadog-46.1.1 → libdatadog-47.0.0}/aarch64-linux/include/datadog/data-pipeline.h +0 -0
  48. /data/vendor/{libdatadog-46.1.1 → libdatadog-47.0.0}/aarch64-linux/include/datadog/ddsketch.h +0 -0
  49. /data/vendor/{libdatadog-46.1.1 → libdatadog-47.0.0}/aarch64-linux/include/datadog/library-config.h +0 -0
  50. /data/vendor/{libdatadog-46.1.1 → libdatadog-47.0.0}/aarch64-linux/include/datadog/log.h +0 -0
  51. /data/vendor/{libdatadog-46.1.1 → libdatadog-47.0.0}/aarch64-linux/include/datadog/otel-thread-ctx.h +0 -0
  52. /data/vendor/{libdatadog-46.1.1 → libdatadog-47.0.0}/aarch64-linux/include/datadog/profiling.h +0 -0
  53. /data/vendor/{libdatadog-46.1.1 → libdatadog-47.0.0}/aarch64-linux/include/datadog/shared-runtime.h +0 -0
  54. /data/vendor/{libdatadog-46.1.1 → libdatadog-47.0.0}/aarch64-linux/include/datadog/telemetry.h +0 -0
  55. /data/vendor/{libdatadog-46.1.1 → libdatadog-47.0.0}/aarch64-linux-musl/LICENSE +0 -0
  56. /data/vendor/{libdatadog-46.1.1 → libdatadog-47.0.0}/aarch64-linux-musl/NOTICE +0 -0
  57. /data/vendor/{libdatadog-46.1.1 → libdatadog-47.0.0}/aarch64-linux-musl/include/datadog/blazesym.h +0 -0
  58. /data/vendor/{libdatadog-46.1.1 → libdatadog-47.0.0}/aarch64-linux-musl/include/datadog/data-pipeline.h +0 -0
  59. /data/vendor/{libdatadog-46.1.1 → libdatadog-47.0.0}/aarch64-linux-musl/include/datadog/ddsketch.h +0 -0
  60. /data/vendor/{libdatadog-46.1.1 → libdatadog-47.0.0}/aarch64-linux-musl/include/datadog/library-config.h +0 -0
  61. /data/vendor/{libdatadog-46.1.1 → libdatadog-47.0.0}/aarch64-linux-musl/include/datadog/log.h +0 -0
  62. /data/vendor/{libdatadog-46.1.1 → libdatadog-47.0.0}/aarch64-linux-musl/include/datadog/otel-thread-ctx.h +0 -0
  63. /data/vendor/{libdatadog-46.1.1 → libdatadog-47.0.0}/aarch64-linux-musl/include/datadog/profiling.h +0 -0
  64. /data/vendor/{libdatadog-46.1.1 → libdatadog-47.0.0}/aarch64-linux-musl/include/datadog/shared-runtime.h +0 -0
  65. /data/vendor/{libdatadog-46.1.1 → libdatadog-47.0.0}/aarch64-linux-musl/include/datadog/telemetry.h +0 -0
  66. /data/vendor/{libdatadog-46.1.1 → libdatadog-47.0.0}/arm64-darwin/LICENSE +0 -0
  67. /data/vendor/{libdatadog-46.1.1 → libdatadog-47.0.0}/arm64-darwin/NOTICE +0 -0
  68. /data/vendor/{libdatadog-46.1.1 → libdatadog-47.0.0}/arm64-darwin/bin/libdatadog-crashtracking-receiver +0 -0
  69. /data/vendor/{libdatadog-46.1.1 → libdatadog-47.0.0}/arm64-darwin/include/datadog/blazesym.h +0 -0
  70. /data/vendor/{libdatadog-46.1.1 → libdatadog-47.0.0}/arm64-darwin/include/datadog/data-pipeline.h +0 -0
  71. /data/vendor/{libdatadog-46.1.1 → libdatadog-47.0.0}/arm64-darwin/include/datadog/ddsketch.h +0 -0
  72. /data/vendor/{libdatadog-46.1.1 → libdatadog-47.0.0}/arm64-darwin/include/datadog/library-config.h +0 -0
  73. /data/vendor/{libdatadog-46.1.1 → libdatadog-47.0.0}/arm64-darwin/include/datadog/log.h +0 -0
  74. /data/vendor/{libdatadog-46.1.1 → libdatadog-47.0.0}/arm64-darwin/include/datadog/otel-thread-ctx.h +0 -0
  75. /data/vendor/{libdatadog-46.1.1 → libdatadog-47.0.0}/arm64-darwin/include/datadog/profiling.h +0 -0
  76. /data/vendor/{libdatadog-46.1.1 → libdatadog-47.0.0}/arm64-darwin/include/datadog/shared-runtime.h +0 -0
  77. /data/vendor/{libdatadog-46.1.1 → libdatadog-47.0.0}/arm64-darwin/include/datadog/telemetry.h +0 -0
  78. /data/vendor/{libdatadog-46.1.1 → libdatadog-47.0.0}/x86_64-linux/LICENSE +0 -0
  79. /data/vendor/{libdatadog-46.1.1 → libdatadog-47.0.0}/x86_64-linux/NOTICE +0 -0
  80. /data/vendor/{libdatadog-46.1.1 → libdatadog-47.0.0}/x86_64-linux/include/datadog/blazesym.h +0 -0
  81. /data/vendor/{libdatadog-46.1.1 → libdatadog-47.0.0}/x86_64-linux/include/datadog/data-pipeline.h +0 -0
  82. /data/vendor/{libdatadog-46.1.1 → libdatadog-47.0.0}/x86_64-linux/include/datadog/ddsketch.h +0 -0
  83. /data/vendor/{libdatadog-46.1.1 → libdatadog-47.0.0}/x86_64-linux/include/datadog/library-config.h +0 -0
  84. /data/vendor/{libdatadog-46.1.1 → libdatadog-47.0.0}/x86_64-linux/include/datadog/log.h +0 -0
  85. /data/vendor/{libdatadog-46.1.1 → libdatadog-47.0.0}/x86_64-linux/include/datadog/otel-thread-ctx.h +0 -0
  86. /data/vendor/{libdatadog-46.1.1 → libdatadog-47.0.0}/x86_64-linux/include/datadog/profiling.h +0 -0
  87. /data/vendor/{libdatadog-46.1.1 → libdatadog-47.0.0}/x86_64-linux/include/datadog/shared-runtime.h +0 -0
  88. /data/vendor/{libdatadog-46.1.1 → libdatadog-47.0.0}/x86_64-linux/include/datadog/telemetry.h +0 -0
  89. /data/vendor/{libdatadog-46.1.1 → libdatadog-47.0.0}/x86_64-linux-musl/LICENSE +0 -0
  90. /data/vendor/{libdatadog-46.1.1 → libdatadog-47.0.0}/x86_64-linux-musl/NOTICE +0 -0
  91. /data/vendor/{libdatadog-46.1.1 → libdatadog-47.0.0}/x86_64-linux-musl/include/datadog/blazesym.h +0 -0
  92. /data/vendor/{libdatadog-46.1.1 → libdatadog-47.0.0}/x86_64-linux-musl/include/datadog/data-pipeline.h +0 -0
  93. /data/vendor/{libdatadog-46.1.1 → libdatadog-47.0.0}/x86_64-linux-musl/include/datadog/ddsketch.h +0 -0
  94. /data/vendor/{libdatadog-46.1.1 → libdatadog-47.0.0}/x86_64-linux-musl/include/datadog/library-config.h +0 -0
  95. /data/vendor/{libdatadog-46.1.1 → libdatadog-47.0.0}/x86_64-linux-musl/include/datadog/log.h +0 -0
  96. /data/vendor/{libdatadog-46.1.1 → libdatadog-47.0.0}/x86_64-linux-musl/include/datadog/otel-thread-ctx.h +0 -0
  97. /data/vendor/{libdatadog-46.1.1 → libdatadog-47.0.0}/x86_64-linux-musl/include/datadog/profiling.h +0 -0
  98. /data/vendor/{libdatadog-46.1.1 → libdatadog-47.0.0}/x86_64-linux-musl/include/datadog/shared-runtime.h +0 -0
  99. /data/vendor/{libdatadog-46.1.1 → libdatadog-47.0.0}/x86_64-linux-musl/include/datadog/telemetry.h +0 -0
@@ -0,0 +1,998 @@
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
+ /**
411
+ * # Safety
412
+ * The `crash_info` can be null, but if non-null it must point to a Builder made by this module,
413
+ * which has not previously been dropped.
414
+ */
415
+ DDOG_CHECK_RETURN
416
+ struct ddog_VoidResult ddog_crasht_CrashInfo_demangle_names(struct ddog_crasht_Handle_CrashInfo *crash_info);
417
+
418
+ /**
419
+ * # Safety
420
+ * The `builder` can be null, but if non-null it must point to a Frame
421
+ * made by this module, which has not previously been dropped.
422
+ */
423
+ void ddog_crasht_CrashInfo_drop(struct ddog_crasht_Handle_CrashInfo *builder);
424
+
425
+ /**
426
+ * # Safety
427
+ * The `crash_info` can be null, but if non-null it must point to a Builder made by this module,
428
+ * which has not previously been dropped.
429
+ */
430
+ DDOG_CHECK_RETURN
431
+ struct ddog_VoidResult ddog_crasht_CrashInfo_normalize_ips(struct ddog_crasht_Handle_CrashInfo *crash_info,
432
+ uint32_t pid);
433
+
434
+ /**
435
+ * # Safety
436
+ * The `crash_info` can be null, but if non-null it must point to a Builder made by this module,
437
+ * which has not previously been dropped.
438
+ */
439
+ DDOG_CHECK_RETURN
440
+ struct ddog_VoidResult ddog_crasht_CrashInfo_resolve_names(struct ddog_crasht_Handle_CrashInfo *crash_info,
441
+ uint32_t pid);
442
+
443
+ /**
444
+ * # Safety
445
+ * The `crash_info` can be null, but if non-null it must point to a Builder made by this module,
446
+ * which has not previously been dropped.
447
+ * This function will:
448
+ */
449
+ DDOG_CHECK_RETURN
450
+ struct ddog_VoidResult ddog_crasht_CrashInfo_enrich_callstacks(struct ddog_crasht_Handle_CrashInfo *crash_info,
451
+ uint32_t pid);
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
+ * The CharSlice must be valid.
458
+ */
459
+ DDOG_CHECK_RETURN
460
+ struct ddog_VoidResult ddog_crasht_CrashInfo_upload_to_endpoint(struct ddog_crasht_Handle_CrashInfo *crash_info,
461
+ const struct ddog_Endpoint *endpoint);
462
+
463
+ /**
464
+ * Create a new CrashInfoBuilder, and returns an opaque reference to it.
465
+ * # Safety
466
+ * No safety issues.
467
+ */
468
+ DDOG_CHECK_RETURN
469
+ struct ddog_crasht_CrashInfoBuilder_NewResult ddog_crasht_CrashInfoBuilder_new(void);
470
+
471
+ /**
472
+ * # Safety
473
+ * The `builder` can be null, but if non-null it must point to a Frame
474
+ * made by this module, which has not previously been dropped.
475
+ */
476
+ void ddog_crasht_CrashInfoBuilder_drop(struct ddog_crasht_Handle_CrashInfoBuilder *builder);
477
+
478
+ /**
479
+ * # Safety
480
+ * The `builder` can be null, but if non-null it must point to a Builder made by this module,
481
+ * which has not previously been dropped.
482
+ */
483
+ DDOG_CHECK_RETURN
484
+ ddog_crasht_CrashInfo_NewResult ddog_crasht_CrashInfoBuilder_build(struct ddog_crasht_Handle_CrashInfoBuilder *builder);
485
+
486
+ /**
487
+ * # Safety
488
+ * The `builder` can be null, but if non-null it must point to a Builder made by this module,
489
+ * which has not previously been dropped.
490
+ * The CharSlice must be valid.
491
+ */
492
+ DDOG_CHECK_RETURN
493
+ struct ddog_VoidResult ddog_crasht_CrashInfoBuilder_with_counter(struct ddog_crasht_Handle_CrashInfoBuilder *builder,
494
+ ddog_CharSlice name,
495
+ int64_t value);
496
+
497
+ /**
498
+ * # Safety
499
+ * The `builder` can be null, but if non-null it must point to a Builder made by this module,
500
+ * which has not previously been dropped.
501
+ * The Kind must be valid.
502
+ */
503
+ DDOG_CHECK_RETURN
504
+ struct ddog_VoidResult ddog_crasht_CrashInfoBuilder_with_kind(struct ddog_crasht_Handle_CrashInfoBuilder *builder,
505
+ enum ddog_crasht_ErrorKind kind);
506
+
507
+ /**
508
+ * # Safety
509
+ * The `builder` can be null, but if non-null it must point to a Builder made by this module,
510
+ * which has not previously been dropped.
511
+ * The CharSlice must be valid.
512
+ */
513
+ DDOG_CHECK_RETURN
514
+ struct ddog_VoidResult ddog_crasht_CrashInfoBuilder_with_file(struct ddog_crasht_Handle_CrashInfoBuilder *builder,
515
+ ddog_CharSlice filename);
516
+
517
+ /**
518
+ * # Safety
519
+ * The `builder` can be null, but if non-null it must point to a Builder made by this module,
520
+ * which has not previously been dropped.
521
+ * The CharSlice must be valid.
522
+ */
523
+ DDOG_CHECK_RETURN
524
+ struct ddog_VoidResult ddog_crasht_CrashInfoBuilder_with_file_and_contents(struct ddog_crasht_Handle_CrashInfoBuilder *builder,
525
+ ddog_CharSlice filename,
526
+ struct ddog_crasht_Slice_CharSlice contents);
527
+
528
+ /**
529
+ * # Safety
530
+ * The `builder` can be null, but if non-null it must point to a Builder made by this module,
531
+ * which has not previously been dropped.
532
+ * The CharSlice must be valid.
533
+ */
534
+ DDOG_CHECK_RETURN
535
+ struct ddog_VoidResult ddog_crasht_CrashInfoBuilder_with_fingerprint(struct ddog_crasht_Handle_CrashInfoBuilder *builder,
536
+ ddog_CharSlice fingerprint);
537
+
538
+ /**
539
+ * # Safety
540
+ * The `builder` can be null, but if non-null it must point to a Builder made by this module,
541
+ * which has not previously been dropped.
542
+ * The CharSlice must be valid.
543
+ */
544
+ DDOG_CHECK_RETURN
545
+ struct ddog_VoidResult ddog_crasht_CrashInfoBuilder_with_incomplete(struct ddog_crasht_Handle_CrashInfoBuilder *builder,
546
+ bool incomplete);
547
+
548
+ /**
549
+ * # Safety
550
+ * The `builder` can be null, but if non-null it must point to a Builder made by this module,
551
+ * which has not previously been dropped.
552
+ * The CharSlice must be valid.
553
+ */
554
+ DDOG_CHECK_RETURN
555
+ struct ddog_VoidResult ddog_crasht_CrashInfoBuilder_with_log_message(struct ddog_crasht_Handle_CrashInfoBuilder *builder,
556
+ ddog_CharSlice message,
557
+ bool also_print);
558
+
559
+ /**
560
+ * # Safety
561
+ * The `builder` can be null, but if non-null it must point to a Builder made by this module,
562
+ * which has not previously been dropped.
563
+ * All arguments must be valid.
564
+ */
565
+ DDOG_CHECK_RETURN
566
+ struct ddog_VoidResult ddog_crasht_CrashInfoBuilder_with_metadata(struct ddog_crasht_Handle_CrashInfoBuilder *builder,
567
+ struct ddog_crasht_Metadata metadata);
568
+
569
+ /**
570
+ * # Safety
571
+ * The `builder` can be null, but if non-null it must point to a Builder made by this module,
572
+ * which has not previously been dropped.
573
+ * All arguments must be valid.
574
+ */
575
+ DDOG_CHECK_RETURN
576
+ struct ddog_VoidResult ddog_crasht_CrashInfoBuilder_with_os_info(struct ddog_crasht_Handle_CrashInfoBuilder *builder,
577
+ struct ddog_crasht_OsInfo os_info);
578
+
579
+ /**
580
+ * # Safety
581
+ * The `builder` can be null, but if non-null it must point to a Builder made by this module,
582
+ * which has not previously been dropped.
583
+ * All arguments must be valid.
584
+ */
585
+ DDOG_CHECK_RETURN
586
+ struct ddog_VoidResult ddog_crasht_CrashInfoBuilder_with_os_info_this_machine(struct ddog_crasht_Handle_CrashInfoBuilder *builder);
587
+
588
+ /**
589
+ * # Safety
590
+ * The `builder` can be null, but if non-null it must point to a Builder made by this module,
591
+ * which has not previously been dropped.
592
+ * All arguments must be valid.
593
+ */
594
+ DDOG_CHECK_RETURN
595
+ struct ddog_VoidResult ddog_crasht_CrashInfoBuilder_with_proc_info(struct ddog_crasht_Handle_CrashInfoBuilder *builder,
596
+ struct ddog_crasht_ProcInfo proc_info);
597
+
598
+ /**
599
+ * # Safety
600
+ * The `builder` can be null, but if non-null it must point to a Builder made by this module,
601
+ * which has not previously been dropped.
602
+ * All arguments must be valid.
603
+ */
604
+ DDOG_CHECK_RETURN
605
+ struct ddog_VoidResult ddog_crasht_CrashInfoBuilder_with_sig_info(struct ddog_crasht_Handle_CrashInfoBuilder *builder,
606
+ struct ddog_crasht_SigInfo sig_info);
607
+
608
+ /**
609
+ * # Safety
610
+ * The `builder` can be null, but if non-null it must point to a Builder made by this module,
611
+ * which has not previously been dropped.
612
+ * All arguments must be valid.
613
+ */
614
+ DDOG_CHECK_RETURN
615
+ struct ddog_VoidResult ddog_crasht_CrashInfoBuilder_with_span_id(struct ddog_crasht_Handle_CrashInfoBuilder *builder,
616
+ struct ddog_crasht_Span span_id);
617
+
618
+ /**
619
+ * # Safety
620
+ * The `builder` can be null, but if non-null it must point to a Builder made by this module,
621
+ * which has not previously been dropped.
622
+ * All arguments must be valid.
623
+ * Consumes the stack argument.
624
+ */
625
+ DDOG_CHECK_RETURN
626
+ struct ddog_VoidResult ddog_crasht_CrashInfoBuilder_with_stack(struct ddog_crasht_Handle_CrashInfoBuilder *builder,
627
+ struct ddog_crasht_Handle_StackTrace *stack);
628
+
629
+ /**
630
+ * # Safety
631
+ * The `builder` can be null, but if non-null it must point to a Builder made by this module,
632
+ * which has not previously been dropped.
633
+ * All arguments must be valid.
634
+ * Consumes the stack argument.
635
+ */
636
+ DDOG_CHECK_RETURN
637
+ struct ddog_VoidResult ddog_crasht_CrashInfoBuilder_with_thread(struct ddog_crasht_Handle_CrashInfoBuilder *builder,
638
+ struct ddog_crasht_ThreadData thread);
639
+
640
+ /**
641
+ * # Safety
642
+ * The `builder` can be null, but if non-null it must point to a Builder made by this module,
643
+ * which has not previously been dropped.
644
+ * The CharSlice must be valid.
645
+ */
646
+ DDOG_CHECK_RETURN
647
+ struct ddog_VoidResult ddog_crasht_CrashInfoBuilder_with_timestamp(struct ddog_crasht_Handle_CrashInfoBuilder *builder,
648
+ struct ddog_Timespec ts);
649
+
650
+ /**
651
+ * # Safety
652
+ * The `builder` can be null, but if non-null it must point to a Builder made by this module,
653
+ * which has not previously been dropped.
654
+ * The CharSlice must be valid.
655
+ */
656
+ DDOG_CHECK_RETURN
657
+ struct ddog_VoidResult ddog_crasht_CrashInfoBuilder_with_timestamp_now(struct ddog_crasht_Handle_CrashInfoBuilder *builder);
658
+
659
+ /**
660
+ * # Safety
661
+ * The `builder` can be null, but if non-null it must point to a Builder made by this module,
662
+ * which has not previously been dropped.
663
+ * All arguments must be valid.
664
+ */
665
+ DDOG_CHECK_RETURN
666
+ struct ddog_VoidResult ddog_crasht_CrashInfoBuilder_with_trace_id(struct ddog_crasht_Handle_CrashInfoBuilder *builder,
667
+ struct ddog_crasht_Span trace_id);
668
+
669
+ /**
670
+ * # Safety
671
+ * The `builder` can be null, but if non-null it must point to a Builder made by this module,
672
+ * which has not previously been dropped.
673
+ * The CharSlice must be valid.
674
+ */
675
+ DDOG_CHECK_RETURN
676
+ struct ddog_VoidResult ddog_crasht_CrashInfoBuilder_with_message(struct ddog_crasht_Handle_CrashInfoBuilder *builder,
677
+ ddog_CharSlice message);
678
+
679
+ /**
680
+ * # Safety
681
+ * The `builder` can be null, but if non-null it must point to a Builder made by this module,
682
+ * which has not previously been dropped.
683
+ * The CharSlice must be valid.
684
+ */
685
+ DDOG_CHECK_RETURN
686
+ struct ddog_VoidResult ddog_crasht_CrashInfoBuilder_with_thread_name(struct ddog_crasht_Handle_CrashInfoBuilder *builder,
687
+ ddog_CharSlice thread_name);
688
+
689
+ /**
690
+ * # Safety
691
+ * The `builder` can be null, but if non-null it must point to a Builder made by this module,
692
+ * which has not previously been dropped.
693
+ * All arguments must be valid.
694
+ * This method requires that the builder has `metadata` and `kind` set
695
+ * Applications can add `message` or `sig_info` to the builder to provide additional context.
696
+ * If set, the data will be used to derive the crash ping message in the order of
697
+ * - an explicit message set with `with_message`
698
+ * - sig_info set with `with_sig_info`
699
+ * - kind set with `with_kind`
700
+ */
701
+ DDOG_CHECK_RETURN
702
+ struct ddog_VoidResult ddog_crasht_CrashInfoBuilder_upload_ping_to_endpoint(struct ddog_crasht_Handle_CrashInfoBuilder *builder,
703
+ const struct ddog_Endpoint *endpoint);
704
+
705
+ /**
706
+ * Create a new StackFrame, and returns an opaque reference to it.
707
+ * # Safety
708
+ * No safety issues.
709
+ */
710
+ DDOG_CHECK_RETURN struct ddog_crasht_StackFrame_NewResult ddog_crasht_StackFrame_new(void);
711
+
712
+ /**
713
+ * # Safety
714
+ * The `frame` can be null, but if non-null it must point to a Frame
715
+ * made by this module, which has not previously been dropped.
716
+ */
717
+ void ddog_crasht_StackFrame_drop(struct ddog_crasht_Handle_StackFrame *frame);
718
+
719
+ /**
720
+ * # Safety
721
+ * The `frame` can be null, but if non-null it must point to a Frame made by this module,
722
+ * which has not previously been dropped.
723
+ * The CharSlice must be valid.
724
+ */
725
+ DDOG_CHECK_RETURN
726
+ struct ddog_VoidResult ddog_crasht_StackFrame_with_ip(struct ddog_crasht_Handle_StackFrame *frame,
727
+ uintptr_t ip);
728
+
729
+ /**
730
+ * # Safety
731
+ * The `frame` can be null, but if non-null it must point to a Frame made by this module,
732
+ * which has not previously been dropped.
733
+ * The CharSlice must be valid.
734
+ */
735
+ DDOG_CHECK_RETURN
736
+ struct ddog_VoidResult ddog_crasht_StackFrame_with_module_base_address(struct ddog_crasht_Handle_StackFrame *frame,
737
+ uintptr_t module_base_address);
738
+
739
+ /**
740
+ * # Safety
741
+ * The `frame` can be null, but if non-null it must point to a Frame made by this module,
742
+ * which has not previously been dropped.
743
+ * The CharSlice must be valid.
744
+ */
745
+ DDOG_CHECK_RETURN
746
+ struct ddog_VoidResult ddog_crasht_StackFrame_with_sp(struct ddog_crasht_Handle_StackFrame *frame,
747
+ uintptr_t sp);
748
+
749
+ /**
750
+ * # Safety
751
+ * The `frame` can be null, but if non-null it must point to a Frame made by this module,
752
+ * which has not previously been dropped.
753
+ * The CharSlice must be valid.
754
+ */
755
+ DDOG_CHECK_RETURN
756
+ struct ddog_VoidResult ddog_crasht_StackFrame_with_symbol_address(struct ddog_crasht_Handle_StackFrame *frame,
757
+ uintptr_t symbol_address);
758
+
759
+ /**
760
+ * # Safety
761
+ * The `frame` can be null, but if non-null it must point to a Frame made by this module,
762
+ * which has not previously been dropped.
763
+ * The CharSlice must be valid.
764
+ */
765
+ DDOG_CHECK_RETURN
766
+ struct ddog_VoidResult ddog_crasht_StackFrame_with_build_id(struct ddog_crasht_Handle_StackFrame *frame,
767
+ ddog_CharSlice build_id);
768
+
769
+ /**
770
+ * # Safety
771
+ * The `frame` can be null, but if non-null it must point to a Frame made by this module,
772
+ * which has not previously been dropped.
773
+ * The BuildIdType must be valid.
774
+ */
775
+ DDOG_CHECK_RETURN
776
+ struct ddog_VoidResult ddog_crasht_StackFrame_with_build_id_type(struct ddog_crasht_Handle_StackFrame *frame,
777
+ enum ddog_crasht_BuildIdType build_id_type);
778
+
779
+ /**
780
+ * # Safety
781
+ * The `frame` can be null, but if non-null it must point to a Frame made by this module,
782
+ * which has not previously been dropped.
783
+ * The FileType must be valid.
784
+ */
785
+ DDOG_CHECK_RETURN
786
+ struct ddog_VoidResult ddog_crasht_StackFrame_with_file_type(struct ddog_crasht_Handle_StackFrame *frame,
787
+ enum ddog_crasht_FileType file_type);
788
+
789
+ /**
790
+ * # Safety
791
+ * The `frame` can be null, but if non-null it must point to a Frame made by this module,
792
+ * which has not previously been dropped.
793
+ * The CharSlice must be valid.
794
+ */
795
+ DDOG_CHECK_RETURN
796
+ struct ddog_VoidResult ddog_crasht_StackFrame_with_path(struct ddog_crasht_Handle_StackFrame *frame,
797
+ ddog_CharSlice path);
798
+
799
+ /**
800
+ * # Safety
801
+ * The `frame` can be null, but if non-null it must point to a Frame made by this module,
802
+ * which has not previously been dropped.
803
+ * The CharSlice must be valid.
804
+ */
805
+ DDOG_CHECK_RETURN
806
+ struct ddog_VoidResult ddog_crasht_StackFrame_with_relative_address(struct ddog_crasht_Handle_StackFrame *frame,
807
+ uintptr_t relative_address);
808
+
809
+ /**
810
+ * # Safety
811
+ * The `frame` can be null, but if non-null it must point to a Frame made by this module,
812
+ * which has not previously been dropped.
813
+ */
814
+ DDOG_CHECK_RETURN
815
+ struct ddog_VoidResult ddog_crasht_StackFrame_with_column(struct ddog_crasht_Handle_StackFrame *frame,
816
+ uint32_t column);
817
+
818
+ /**
819
+ * # Safety
820
+ * The `frame` can be null, but if non-null it must point to a Frame made by this module,
821
+ * which has not previously been dropped.
822
+ * The CharSlice must be valid.
823
+ */
824
+ DDOG_CHECK_RETURN
825
+ struct ddog_VoidResult ddog_crasht_StackFrame_with_file(struct ddog_crasht_Handle_StackFrame *frame,
826
+ ddog_CharSlice file);
827
+
828
+ /**
829
+ * # Safety
830
+ * The `frame` can be null, but if non-null it must point to a Frame made by this module,
831
+ * which has not previously been dropped.
832
+ * The CharSlice must be valid.
833
+ */
834
+ DDOG_CHECK_RETURN
835
+ struct ddog_VoidResult ddog_crasht_StackFrame_with_function(struct ddog_crasht_Handle_StackFrame *frame,
836
+ ddog_CharSlice function);
837
+
838
+ /**
839
+ * # Safety
840
+ * The `frame` can be null, but if non-null it must point to a Frame made by this module,
841
+ * which has not previously been dropped.
842
+ */
843
+ DDOG_CHECK_RETURN
844
+ struct ddog_VoidResult ddog_crasht_StackFrame_with_line(struct ddog_crasht_Handle_StackFrame *frame,
845
+ uint32_t line);
846
+
847
+ /**
848
+ * Create a new StackTrace, and returns an opaque reference to it.
849
+ * # Safety
850
+ * No safety issues.
851
+ */
852
+ DDOG_CHECK_RETURN struct ddog_crasht_StackTrace_NewResult ddog_crasht_StackTrace_new(void);
853
+
854
+ /**
855
+ * # Safety
856
+ * The `frame` can be null, but if non-null it must point to a Frame
857
+ * made by this module, which has not previously been dropped.
858
+ */
859
+ void ddog_crasht_StackTrace_drop(struct ddog_crasht_Handle_StackTrace *trace);
860
+
861
+ /**
862
+ * # Safety
863
+ * The `stacktrace` can be null, but if non-null it must point to a StackTrace made by this module,
864
+ * which has not previously been dropped.
865
+ * The frame can be non-null, but if non-null it must point to a Frame made by this module,
866
+ * which has not previously been dropped.
867
+ * The frame is consumed, and does not need to be dropped after this operation.
868
+ */
869
+ DDOG_CHECK_RETURN
870
+ struct ddog_VoidResult ddog_crasht_StackTrace_push_frame(struct ddog_crasht_Handle_StackTrace *trace,
871
+ struct ddog_crasht_Handle_StackFrame *frame,
872
+ bool incomplete);
873
+
874
+ /**
875
+ * # Safety
876
+ * The `stacktrace` can be null, but if non-null it must point to a StackTrace made by this module,
877
+ * which has not previously been dropped.
878
+ */
879
+ DDOG_CHECK_RETURN
880
+ struct ddog_VoidResult ddog_crasht_StackTrace_set_complete(struct ddog_crasht_Handle_StackTrace *trace);
881
+
882
+ /**
883
+ * Demangles the string "name".
884
+ * If demangling fails, returns an empty string ""
885
+ *
886
+ * # Safety
887
+ * `name` should be a valid reference to a utf8 encoded String.
888
+ * The string is copied into the result, and does not need to outlive this call
889
+ */
890
+ DDOG_CHECK_RETURN
891
+ struct ddog_StringWrapperResult ddog_crasht_demangle(ddog_CharSlice name,
892
+ enum ddog_crasht_DemangleOptions options);
893
+
894
+ /**
895
+ * Receives data from a crash collector via a pipe on `stdin`, formats it into
896
+ * `CrashInfo` json, and emits it to the endpoint/file defined in `config`.
897
+ *
898
+ * At a high-level, this exists because doing anything in a
899
+ * signal handler is dangerous, so we fork a sidecar to do the stuff we aren't
900
+ * allowed to do in the handler.
901
+ *
902
+ * See comments in [libdd-crashtracker/lib.rs] for a full architecture description.
903
+ * # Safety
904
+ * No safety concerns
905
+ */
906
+ DDOG_CHECK_RETURN struct ddog_VoidResult ddog_crasht_receiver_entry_point_stdin(void);
907
+
908
+ /**
909
+ * Receives data from a crash collector via a pipe on `stdin`, formats it into
910
+ * `CrashInfo` json, and emits it to the endpoint/file defined in `config`.
911
+ *
912
+ * At a high-level, this exists because doing anything in a
913
+ * signal handler is dangerous, so we fork a sidecar to do the stuff we aren't
914
+ * allowed to do in the handler.
915
+ *
916
+ * See comments in [libdd-crashtracker/lib.rs] for a full architecture
917
+ * description.
918
+ * # Safety
919
+ * No safety concerns
920
+ */
921
+ DDOG_CHECK_RETURN
922
+ struct ddog_VoidResult ddog_crasht_receiver_entry_point_unix_socket(ddog_CharSlice socket_path);
923
+
924
+ /**
925
+ * Register a runtime stack collection callback
926
+ *
927
+ * # Arguments
928
+ * - `callback`: The callback function to invoke during crashes
929
+ *
930
+ * # Returns
931
+ * - `CallbackResult::Ok` if registration succeeds
932
+ * - `CallbackResult::Error` if registration fails
933
+ *
934
+ * # Safety
935
+ * - The callback must be signal-safe
936
+ * - Only one callback can be registered at a time
937
+ * - The callback must be registered once on CrashTracker initialization, before any crash occurs
938
+ *
939
+ * # Example Usage from C
940
+ * ```c
941
+ * static void my_runtime_callback(
942
+ * void (*emit_frame)(const ddog_RuntimeStackFrameFFI*),
943
+ * ) {
944
+ * // Collect runtime frames and call emit_frame for each one
945
+ * const char* function_name = "my_function";
946
+ * const char* file_name = "script.rb";
947
+ * ddog_CharSlice type_name = DDOG_CHARSLICE_FROM_CSTR("MyModule.MyClass");
948
+ * ddog_crasht_RuntimeStackFrameFFI frame = {
949
+ * .type_name = type_name,
950
+ * .function = DDOG_CHARSLICE_FROM_CSTR(function_name),
951
+ * .file = DDOG_CHARSLICE_FROM_CSTR(file_name),
952
+ * .line = 42,
953
+ * .column = 10
954
+ * };
955
+ * emit_frame(&frame);
956
+ * }
957
+ */
958
+ enum ddog_crasht_CallbackResult ddog_crasht_register_runtime_frame_callback(ddog_crasht_RuntimeStackFrameCallback callback);
959
+
960
+ /**
961
+ * Register a runtime stacktrace string collection callback
962
+ *
963
+ * # Arguments
964
+ * - `callback`: The callback function to invoke during crashes
965
+ *
966
+ * # Returns
967
+ * - `CallbackResult::Ok` if registration succeeds (replaces any existing callback)
968
+ * - `CallbackResult::Error` if registration fails
969
+ *
970
+ * # Safety
971
+ * - The callback must be signal-safe
972
+ * - Only one callback can be registered at a time (this replaces any existing one)
973
+ */
974
+ enum ddog_crasht_CallbackResult ddog_crasht_register_runtime_stacktrace_string_callback(ddog_crasht_RuntimeStacktraceStringCallback callback);
975
+
976
+ /**
977
+ * Returns true if a callback is registered, false otherwise
978
+ *
979
+ * # Safety
980
+ * This function is safe to call at any time
981
+ */
982
+ bool ddog_crasht_is_runtime_callback_registered(void);
983
+
984
+ /**
985
+ * Get the callback type from the currently registered callback context
986
+ *
987
+ * # Safety
988
+ * - The returned pointer is valid only while the callback remains registered
989
+ * - The caller should not free the returned pointer
990
+ * - The returned string should be copied if it needs to persist beyond callback lifetime
991
+ */
992
+ const char *ddog_crasht_get_registered_callback_type(void);
993
+
994
+ #ifdef __cplusplus
995
+ } // extern "C"
996
+ #endif // __cplusplus
997
+
998
+ #endif /* DDOG_CRASHTRACKER_H */