libdatadog 11.0.0.1.0 → 13.1.0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/lib/libdatadog/version.rb +1 -1
  3. data/vendor/{libdatadog-11.0.0/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl → libdatadog-13.1.0/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu}/LICENSE-3rdparty.yml +4473 -593
  4. data/vendor/{libdatadog-11.0.0 → libdatadog-13.1.0}/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu/bin/libdatadog-crashtracking-receiver +0 -0
  5. data/vendor/libdatadog-13.1.0/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu/include/datadog/blazesym.h +1230 -0
  6. data/vendor/{libdatadog-11.0.0/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl → libdatadog-13.1.0/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu}/include/datadog/common.h +531 -293
  7. data/vendor/libdatadog-13.1.0/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu/include/datadog/crashtracker.h +436 -0
  8. data/vendor/{libdatadog-11.0.0/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl → libdatadog-13.1.0/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu}/include/datadog/profiling.h +10 -275
  9. data/vendor/{libdatadog-11.0.0 → libdatadog-13.1.0}/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu/lib/libdatadog_profiling.so +0 -0
  10. data/vendor/{libdatadog-11.0.0/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu → libdatadog-13.1.0/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl}/LICENSE-3rdparty.yml +4473 -593
  11. data/vendor/{libdatadog-11.0.0 → libdatadog-13.1.0}/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl/bin/libdatadog-crashtracking-receiver +0 -0
  12. data/vendor/libdatadog-13.1.0/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl/include/datadog/blazesym.h +1230 -0
  13. data/vendor/{libdatadog-11.0.0/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu → libdatadog-13.1.0/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl}/include/datadog/common.h +531 -293
  14. data/vendor/libdatadog-13.1.0/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl/include/datadog/crashtracker.h +436 -0
  15. data/vendor/{libdatadog-11.0.0/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu → libdatadog-13.1.0/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl}/include/datadog/profiling.h +10 -275
  16. data/vendor/{libdatadog-11.0.0 → libdatadog-13.1.0}/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl/lib/libdatadog_profiling.so +0 -0
  17. data/vendor/{libdatadog-11.0.0/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl → libdatadog-13.1.0/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu}/LICENSE-3rdparty.yml +4473 -593
  18. data/vendor/{libdatadog-11.0.0 → libdatadog-13.1.0}/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/bin/libdatadog-crashtracking-receiver +0 -0
  19. data/vendor/libdatadog-13.1.0/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/include/datadog/blazesym.h +1230 -0
  20. data/vendor/{libdatadog-11.0.0 → libdatadog-13.1.0}/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/include/datadog/common.h +531 -293
  21. data/vendor/libdatadog-13.1.0/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/include/datadog/crashtracker.h +436 -0
  22. data/vendor/{libdatadog-11.0.0 → libdatadog-13.1.0}/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/include/datadog/profiling.h +10 -275
  23. data/vendor/{libdatadog-11.0.0 → libdatadog-13.1.0}/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/lib/libdatadog_profiling.so +0 -0
  24. data/vendor/{libdatadog-11.0.0/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu → libdatadog-13.1.0/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl}/LICENSE-3rdparty.yml +4473 -593
  25. data/vendor/libdatadog-13.1.0/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl/bin/libdatadog-crashtracking-receiver +0 -0
  26. data/vendor/libdatadog-13.1.0/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl/include/datadog/blazesym.h +1230 -0
  27. data/vendor/{libdatadog-11.0.0 → libdatadog-13.1.0}/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl/include/datadog/common.h +531 -293
  28. data/vendor/libdatadog-13.1.0/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl/include/datadog/crashtracker.h +436 -0
  29. data/vendor/{libdatadog-11.0.0/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl → libdatadog-13.1.0/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl}/include/datadog/profiling.h +10 -275
  30. data/vendor/{libdatadog-11.0.0 → libdatadog-13.1.0}/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl/lib/libdatadog_profiling.so +0 -0
  31. metadata +46 -42
  32. data/vendor/libdatadog-11.0.0/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu/include/datadog/blazesym.h +0 -1229
  33. data/vendor/libdatadog-11.0.0/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl/include/datadog/blazesym.h +0 -1229
  34. data/vendor/libdatadog-11.0.0/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/include/datadog/blazesym.h +0 -1229
  35. data/vendor/libdatadog-11.0.0/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl/bin/libdatadog-crashtracking-receiver +0 -0
  36. data/vendor/libdatadog-11.0.0/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl/include/datadog/blazesym.h +0 -1229
  37. /data/vendor/{libdatadog-11.0.0 → libdatadog-13.1.0}/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu/LICENSE +0 -0
  38. /data/vendor/{libdatadog-11.0.0 → libdatadog-13.1.0}/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu/NOTICE +0 -0
  39. /data/vendor/{libdatadog-11.0.0 → libdatadog-13.1.0}/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu/include/datadog/telemetry.h +0 -0
  40. /data/vendor/{libdatadog-11.0.0 → libdatadog-13.1.0}/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu/lib/pkgconfig/datadog_profiling_with_rpath.pc +0 -0
  41. /data/vendor/{libdatadog-11.0.0 → libdatadog-13.1.0}/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl/LICENSE +0 -0
  42. /data/vendor/{libdatadog-11.0.0 → libdatadog-13.1.0}/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl/NOTICE +0 -0
  43. /data/vendor/{libdatadog-11.0.0 → libdatadog-13.1.0}/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl/include/datadog/telemetry.h +0 -0
  44. /data/vendor/{libdatadog-11.0.0 → libdatadog-13.1.0}/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl/lib/pkgconfig/datadog_profiling_with_rpath.pc +0 -0
  45. /data/vendor/{libdatadog-11.0.0 → libdatadog-13.1.0}/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/LICENSE +0 -0
  46. /data/vendor/{libdatadog-11.0.0 → libdatadog-13.1.0}/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/NOTICE +0 -0
  47. /data/vendor/{libdatadog-11.0.0 → libdatadog-13.1.0}/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/include/datadog/telemetry.h +0 -0
  48. /data/vendor/{libdatadog-11.0.0 → libdatadog-13.1.0}/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/lib/pkgconfig/datadog_profiling_with_rpath.pc +0 -0
  49. /data/vendor/{libdatadog-11.0.0 → libdatadog-13.1.0}/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl/LICENSE +0 -0
  50. /data/vendor/{libdatadog-11.0.0 → libdatadog-13.1.0}/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl/NOTICE +0 -0
  51. /data/vendor/{libdatadog-11.0.0 → libdatadog-13.1.0}/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl/include/datadog/telemetry.h +0 -0
  52. /data/vendor/{libdatadog-11.0.0 → libdatadog-13.1.0}/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl/lib/pkgconfig/datadog_profiling_with_rpath.pc +0 -0
@@ -0,0 +1,1230 @@
1
+ // BSD-3-Clause License
2
+ // Synchronized from blazesym repository
3
+ // https://github.com/libbpf/blazesym/blob/capi-v0.1.0-rc.0/capi/include/blazesym.h
4
+ /*
5
+ * Please refer to the documentation hosted at
6
+ *
7
+ * https://docs.rs/blazesym-c/0.1.0-rc.0
8
+ */
9
+
10
+
11
+ #ifndef __blazesym_h_
12
+ #define __blazesym_h_
13
+
14
+ #include <stdarg.h>
15
+ #include <stdbool.h>
16
+ #include <stddef.h>
17
+ #include <stdint.h>
18
+ #include <stdlib.h>
19
+
20
+ /**
21
+ * An enum providing a rough classification of errors.
22
+ *
23
+ * C ABI compatible version of [`blazesym::ErrorKind`].
24
+ */
25
+ typedef enum blaze_err {
26
+ /**
27
+ * The operation was successful.
28
+ */
29
+ BLAZE_ERR_OK = 0,
30
+ /**
31
+ * An entity was not found, often a file.
32
+ */
33
+ BLAZE_ERR_NOT_FOUND = -2,
34
+ /**
35
+ * The operation lacked the necessary privileges to complete.
36
+ */
37
+ BLAZE_ERR_PERMISSION_DENIED = -1,
38
+ /**
39
+ * An entity already exists, often a file.
40
+ */
41
+ BLAZE_ERR_ALREADY_EXISTS = -17,
42
+ /**
43
+ * The operation needs to block to complete, but the blocking
44
+ * operation was requested to not occur.
45
+ */
46
+ BLAZE_ERR_WOULD_BLOCK = -11,
47
+ /**
48
+ * Data not valid for the operation were encountered.
49
+ */
50
+ BLAZE_ERR_INVALID_DATA = -22,
51
+ /**
52
+ * The I/O operation's timeout expired, causing it to be canceled.
53
+ */
54
+ BLAZE_ERR_TIMED_OUT = -110,
55
+ /**
56
+ * This operation is unsupported on this platform.
57
+ */
58
+ BLAZE_ERR_UNSUPPORTED = -95,
59
+ /**
60
+ * An operation could not be completed, because it failed
61
+ * to allocate enough memory.
62
+ */
63
+ BLAZE_ERR_OUT_OF_MEMORY = -12,
64
+ /**
65
+ * A parameter was incorrect.
66
+ */
67
+ BLAZE_ERR_INVALID_INPUT = -256,
68
+ /**
69
+ * An error returned when an operation could not be completed
70
+ * because a call to [`write`] returned [`Ok(0)`].
71
+ */
72
+ BLAZE_ERR_WRITE_ZERO = -257,
73
+ /**
74
+ * An error returned when an operation could not be completed
75
+ * because an "end of file" was reached prematurely.
76
+ */
77
+ BLAZE_ERR_UNEXPECTED_EOF = -258,
78
+ /**
79
+ * DWARF input data was invalid.
80
+ */
81
+ BLAZE_ERR_INVALID_DWARF = -259,
82
+ /**
83
+ * A custom error that does not fall under any other I/O error
84
+ * kind.
85
+ */
86
+ BLAZE_ERR_OTHER = -260,
87
+ } blaze_err;
88
+
89
+ /**
90
+ * The reason why normalization failed.
91
+ *
92
+ * The reason is generally only meant as a hint. Reasons reported may change
93
+ * over time and, hence, should not be relied upon for the correctness of the
94
+ * application.
95
+ */
96
+ enum blaze_normalize_reason
97
+ #ifdef __cplusplus
98
+ : uint8_t
99
+ #endif // __cplusplus
100
+ {
101
+ /**
102
+ * The absolute address was not found in the corresponding process' virtual
103
+ * memory map.
104
+ */
105
+ BLAZE_NORMALIZE_REASON_UNMAPPED,
106
+ /**
107
+ * The `/proc/<pid>/maps` entry corresponding to the address does not have
108
+ * a component (file system path, object, ...) associated with it.
109
+ */
110
+ BLAZE_NORMALIZE_REASON_MISSING_COMPONENT,
111
+ /**
112
+ * The address belonged to an entity that is currently unsupported.
113
+ */
114
+ BLAZE_NORMALIZE_REASON_UNSUPPORTED,
115
+ };
116
+ #ifndef __cplusplus
117
+ typedef uint8_t blaze_normalize_reason;
118
+ #endif // __cplusplus
119
+
120
+ /**
121
+ * The type of a symbol.
122
+ */
123
+ enum blaze_sym_type
124
+ #ifdef __cplusplus
125
+ : uint8_t
126
+ #endif // __cplusplus
127
+ {
128
+ /**
129
+ * The symbol type is unspecified or unknown.
130
+ *
131
+ * In input contexts this variant can be used to encompass all
132
+ * other variants (functions and variables), whereas in output
133
+ * contexts it means that the type is not known.
134
+ */
135
+ BLAZE_SYM_UNDEF,
136
+ /**
137
+ * The symbol is a function.
138
+ */
139
+ BLAZE_SYM_FUNC,
140
+ /**
141
+ * The symbol is a variable.
142
+ */
143
+ BLAZE_SYM_VAR,
144
+ };
145
+ #ifndef __cplusplus
146
+ typedef uint8_t blaze_sym_type;
147
+ #endif // __cplusplus
148
+
149
+ /**
150
+ * The reason why symbolization failed.
151
+ *
152
+ * The reason is generally only meant as a hint. Reasons reported may
153
+ * change over time and, hence, should not be relied upon for the
154
+ * correctness of the application.
155
+ */
156
+ enum blaze_symbolize_reason
157
+ #ifdef __cplusplus
158
+ : uint8_t
159
+ #endif // __cplusplus
160
+ {
161
+ /**
162
+ * Symbolization was successful.
163
+ */
164
+ BLAZE_SYMBOLIZE_REASON_SUCCESS = 0,
165
+ /**
166
+ * The absolute address was not found in the corresponding process'
167
+ * virtual memory map.
168
+ */
169
+ BLAZE_SYMBOLIZE_REASON_UNMAPPED,
170
+ /**
171
+ * The file offset does not map to a valid piece of code/data.
172
+ */
173
+ BLAZE_SYMBOLIZE_REASON_INVALID_FILE_OFFSET,
174
+ /**
175
+ * The `/proc/<pid>/maps` entry corresponding to the address does
176
+ * not have a component (file system path, object, ...) associated
177
+ * with it.
178
+ */
179
+ BLAZE_SYMBOLIZE_REASON_MISSING_COMPONENT,
180
+ /**
181
+ * The symbolization source has no or no relevant symbols.
182
+ */
183
+ BLAZE_SYMBOLIZE_REASON_MISSING_SYMS,
184
+ /**
185
+ * The address could not be found in the symbolization source.
186
+ */
187
+ BLAZE_SYMBOLIZE_REASON_UNKNOWN_ADDR,
188
+ /**
189
+ * The address belonged to an entity that is currently unsupported.
190
+ */
191
+ BLAZE_SYMBOLIZE_REASON_UNSUPPORTED,
192
+ };
193
+ #ifndef __cplusplus
194
+ typedef uint8_t blaze_symbolize_reason;
195
+ #endif // __cplusplus
196
+
197
+ /**
198
+ * The valid variant kind in [`blaze_user_meta`].
199
+ */
200
+ typedef enum blaze_user_meta_kind {
201
+ /**
202
+ * [`blaze_user_meta_variant::unknown`] is valid.
203
+ */
204
+ BLAZE_USER_META_UNKNOWN,
205
+ /**
206
+ * [`blaze_user_meta_variant::apk`] is valid.
207
+ */
208
+ BLAZE_USER_META_APK,
209
+ /**
210
+ * [`blaze_user_meta_variant::elf`] is valid.
211
+ */
212
+ BLAZE_USER_META_ELF,
213
+ } blaze_user_meta_kind;
214
+
215
+ /**
216
+ * Information about a looked up symbol.
217
+ */
218
+ typedef struct blaze_sym_info {
219
+ /**
220
+ * See [`inspect::SymInfo::name`].
221
+ */
222
+ const char *name;
223
+ /**
224
+ * See [`inspect::SymInfo::addr`].
225
+ */
226
+ uintptr_t addr;
227
+ /**
228
+ * See [`inspect::SymInfo::size`].
229
+ */
230
+ size_t size;
231
+ /**
232
+ * See [`inspect::SymInfo::file_offset`].
233
+ */
234
+ uint64_t file_offset;
235
+ /**
236
+ * See [`inspect::SymInfo::obj_file_name`].
237
+ */
238
+ const char *obj_file_name;
239
+ /**
240
+ * See [`inspect::SymInfo::sym_type`].
241
+ */
242
+ blaze_sym_type sym_type;
243
+ /**
244
+ * Unused member available for future expansion.
245
+ */
246
+ uint8_t reserved[15];
247
+ } blaze_sym_info;
248
+
249
+ /**
250
+ * C ABI compatible version of [`blazesym::inspect::Inspector`].
251
+ */
252
+ typedef struct blaze_inspector blaze_inspector;
253
+
254
+ /**
255
+ * An object representing an ELF inspection source.
256
+ *
257
+ * C ABI compatible version of [`inspect::Elf`].
258
+ */
259
+ typedef struct blaze_inspect_elf_src {
260
+ /**
261
+ * The size of this object's type.
262
+ *
263
+ * Make sure to initialize it to `sizeof(<type>)`. This member is used to
264
+ * ensure compatibility in the presence of member additions.
265
+ */
266
+ size_t type_size;
267
+ /**
268
+ * The path to the ELF file. This member is always present.
269
+ */
270
+ const char *path;
271
+ /**
272
+ * Whether or not to consult debug symbols to satisfy the request
273
+ * (if present).
274
+ */
275
+ bool debug_syms;
276
+ /**
277
+ * Unused member available for future expansion. Must be initialized
278
+ * to zero.
279
+ */
280
+ uint8_t reserved[7];
281
+ } blaze_inspect_elf_src;
282
+
283
+ /**
284
+ * C ABI compatible version of [`blazesym::normalize::Normalizer`].
285
+ */
286
+ typedef struct blaze_normalizer blaze_normalizer;
287
+
288
+ /**
289
+ * Options for configuring [`blaze_normalizer`] objects.
290
+ */
291
+ typedef struct blaze_normalizer_opts {
292
+ /**
293
+ * The size of this object's type.
294
+ *
295
+ * Make sure to initialize it to `sizeof(<type>)`. This member is used to
296
+ * ensure compatibility in the presence of member additions.
297
+ */
298
+ size_t type_size;
299
+ /**
300
+ * Whether or not to cache `/proc/<pid>/maps` contents.
301
+ *
302
+ * Setting this flag to `true` is not generally recommended, because it
303
+ * could result in addresses corresponding to mappings added after caching
304
+ * may not be normalized successfully, as there is no reasonable way of
305
+ * detecting staleness.
306
+ */
307
+ bool cache_maps;
308
+ /**
309
+ * Whether to read and report build IDs as part of the normalization
310
+ * process.
311
+ */
312
+ bool build_ids;
313
+ /**
314
+ * Whether or not to cache build IDs. This flag only has an effect
315
+ * if build ID reading is enabled in the first place.
316
+ */
317
+ bool cache_build_ids;
318
+ /**
319
+ * Unused member available for future expansion. Must be initialized
320
+ * to zero.
321
+ */
322
+ uint8_t reserved[5];
323
+ } blaze_normalizer_opts;
324
+
325
+ /**
326
+ * C compatible version of [`Apk`].
327
+ */
328
+ typedef struct blaze_user_meta_apk {
329
+ /**
330
+ * The canonical absolute path to the APK, including its name.
331
+ * This member is always present.
332
+ */
333
+ char *path;
334
+ /**
335
+ * Unused member available for future expansion.
336
+ */
337
+ uint8_t reserved[8];
338
+ } blaze_user_meta_apk;
339
+
340
+ /**
341
+ * C compatible version of [`Elf`].
342
+ */
343
+ typedef struct blaze_user_meta_elf {
344
+ /**
345
+ * The path to the ELF file. This member is always present.
346
+ */
347
+ char *path;
348
+ /**
349
+ * The length of the build ID, in bytes.
350
+ */
351
+ size_t build_id_len;
352
+ /**
353
+ * The optional build ID of the ELF file, if found.
354
+ */
355
+ uint8_t *build_id;
356
+ /**
357
+ * Unused member available for future expansion.
358
+ */
359
+ uint8_t reserved[8];
360
+ } blaze_user_meta_elf;
361
+
362
+ /**
363
+ * C compatible version of [`Unknown`].
364
+ */
365
+ typedef struct blaze_user_meta_unknown {
366
+ /**
367
+ * The reason why normalization failed.
368
+ *
369
+ * The provided reason is a best guess, hinting at what ultimately
370
+ * prevented the normalization from being successful.
371
+ */
372
+ blaze_normalize_reason reason;
373
+ /**
374
+ * Unused member available for future expansion.
375
+ */
376
+ uint8_t reserved[7];
377
+ } blaze_user_meta_unknown;
378
+
379
+ /**
380
+ * The actual variant data in [`blaze_user_meta`].
381
+ */
382
+ typedef union blaze_user_meta_variant {
383
+ /**
384
+ * Valid on [`blaze_user_meta_kind::BLAZE_USER_META_APK`].
385
+ */
386
+ struct blaze_user_meta_apk apk;
387
+ /**
388
+ * Valid on [`blaze_user_meta_kind::BLAZE_USER_META_ELF`].
389
+ */
390
+ struct blaze_user_meta_elf elf;
391
+ /**
392
+ * Valid on [`blaze_user_meta_kind::BLAZE_USER_META_UNKNOWN`].
393
+ */
394
+ struct blaze_user_meta_unknown unknown;
395
+ } blaze_user_meta_variant;
396
+
397
+ /**
398
+ * C ABI compatible version of [`UserMeta`].
399
+ */
400
+ typedef struct blaze_user_meta {
401
+ /**
402
+ * The variant kind that is present.
403
+ */
404
+ enum blaze_user_meta_kind kind;
405
+ /**
406
+ * The actual variant with its data.
407
+ */
408
+ union blaze_user_meta_variant variant;
409
+ } blaze_user_meta;
410
+
411
+ /**
412
+ * A file offset or non-normalized address along with an index into the
413
+ * associated [`blaze_user_meta`] array (such as
414
+ * [`blaze_normalized_user_output::metas`]).
415
+ */
416
+ typedef struct blaze_normalized_output {
417
+ /**
418
+ * The file offset or non-normalized address.
419
+ */
420
+ uint64_t output;
421
+ /**
422
+ * The index into the associated [`blaze_user_meta`] array.
423
+ */
424
+ size_t meta_idx;
425
+ } blaze_normalized_output;
426
+
427
+ /**
428
+ * An object representing normalized user addresses.
429
+ *
430
+ * C ABI compatible version of [`UserOutput`].
431
+ */
432
+ typedef struct blaze_normalized_user_output {
433
+ /**
434
+ * The number of [`blaze_user_meta`] objects present in `metas`.
435
+ */
436
+ size_t meta_cnt;
437
+ /**
438
+ * An array of `meta_cnt` objects.
439
+ */
440
+ struct blaze_user_meta *metas;
441
+ /**
442
+ * The number of [`blaze_normalized_output`] objects present in `outputs`.
443
+ */
444
+ size_t output_cnt;
445
+ /**
446
+ * An array of `output_cnt` objects.
447
+ */
448
+ struct blaze_normalized_output *outputs;
449
+ /**
450
+ * Unused member available for future expansion.
451
+ */
452
+ uint8_t reserved[8];
453
+ } blaze_normalized_user_output;
454
+
455
+ /**
456
+ * Options influencing the address normalization process.
457
+ */
458
+ typedef struct blaze_normalize_opts {
459
+ /**
460
+ * The size of this object's type.
461
+ *
462
+ * Make sure to initialize it to `sizeof(<type>)`. This member is used to
463
+ * ensure compatibility in the presence of member additions.
464
+ */
465
+ size_t type_size;
466
+ /**
467
+ * Whether or not addresses are sorted (in ascending order) already.
468
+ *
469
+ * Normalization always happens on sorted addresses and if the addresses
470
+ * are sorted already, the library does not need to sort and later restore
471
+ * original ordering, speeding up the normalization process.
472
+ */
473
+ bool sorted_addrs;
474
+ /**
475
+ * Whether to report `/proc/<pid>/map_files/` entry paths or work
476
+ * with symbolic paths mentioned in `/proc/<pid>/maps` instead.
477
+ *
478
+ * Relying on `map_files` may make sense in cases where
479
+ * symbolization happens on the local system and the reported paths
480
+ * can be worked with directly. In most other cases where one wants
481
+ * to attach meaning to symbolic paths on a remote system (e.g., by
482
+ * using them for file look up) symbolic paths are probably the
483
+ * better choice.
484
+ */
485
+ bool map_files;
486
+ /**
487
+ * Unused member available for future expansion. Must be initialized
488
+ * to zero.
489
+ */
490
+ uint8_t reserved[6];
491
+ } blaze_normalize_opts;
492
+
493
+ /**
494
+ * C ABI compatible version of [`blazesym::symbolize::Symbolizer`].
495
+ *
496
+ * It is returned by [`blaze_symbolizer_new`] and should be free by
497
+ * [`blaze_symbolizer_free`].
498
+ */
499
+ typedef struct blaze_symbolizer blaze_symbolizer;
500
+
501
+ /**
502
+ * Options for configuring [`blaze_symbolizer`] objects.
503
+ */
504
+ typedef struct blaze_symbolizer_opts {
505
+ /**
506
+ * The size of this object's type.
507
+ *
508
+ * Make sure to initialize it to `sizeof(<type>)`. This member is used to
509
+ * ensure compatibility in the presence of member additions.
510
+ */
511
+ size_t type_size;
512
+ /**
513
+ * Array of debug directories to search for split debug information.
514
+ *
515
+ * These directories will be consulted (in given order) when resolving
516
+ * debug links in binaries. By default and when this member is NULL,
517
+ * `/usr/lib/debug` and `/lib/debug/` will be searched. Setting an array
518
+ * here will overwrite these defaults, so make sure to include these
519
+ * directories as desired.
520
+ *
521
+ * Note that the directory containing a symbolization source is always an
522
+ * implicit candidate target directory of the highest precedence.
523
+ */
524
+ const char *const *debug_dirs;
525
+ /**
526
+ * The number of array elements in `debug_dirs`.
527
+ */
528
+ size_t debug_dirs_len;
529
+ /**
530
+ * Whether or not to automatically reload file system based
531
+ * symbolization sources that were updated since the last
532
+ * symbolization operation.
533
+ */
534
+ bool auto_reload;
535
+ /**
536
+ * Whether to attempt to gather source code location information.
537
+ *
538
+ * This setting implies `debug_syms` (and forces it to `true`).
539
+ */
540
+ bool code_info;
541
+ /**
542
+ * Whether to report inlined functions as part of symbolization.
543
+ */
544
+ bool inlined_fns;
545
+ /**
546
+ * Whether or not to transparently demangle symbols.
547
+ *
548
+ * Demangling happens on a best-effort basis. Currently supported
549
+ * languages are Rust and C++ and the flag will have no effect if
550
+ * the underlying language does not mangle symbols (such as C).
551
+ */
552
+ bool demangle;
553
+ /**
554
+ * Unused member available for future expansion. Must be initialized
555
+ * to zero.
556
+ */
557
+ uint8_t reserved[4];
558
+ } blaze_symbolizer_opts;
559
+
560
+ /**
561
+ * Source code location information for a symbol or inlined function.
562
+ */
563
+ typedef struct blaze_symbolize_code_info {
564
+ /**
565
+ * The directory in which the source file resides.
566
+ *
567
+ * This attribute is optional and may be NULL.
568
+ */
569
+ const char *dir;
570
+ /**
571
+ * The file that defines the symbol.
572
+ *
573
+ * This attribute is optional and may be NULL.
574
+ */
575
+ const char *file;
576
+ /**
577
+ * The line number on which the symbol is located in the source
578
+ * code.
579
+ */
580
+ uint32_t line;
581
+ /**
582
+ * The column number of the symbolized instruction in the source
583
+ * code.
584
+ */
585
+ uint16_t column;
586
+ /**
587
+ * Unused member available for future expansion.
588
+ */
589
+ uint8_t reserved[10];
590
+ } blaze_symbolize_code_info;
591
+
592
+ /**
593
+ * Data about an inlined function call.
594
+ */
595
+ typedef struct blaze_symbolize_inlined_fn {
596
+ /**
597
+ * The symbol name of the inlined function.
598
+ */
599
+ const char *name;
600
+ /**
601
+ * Source code location information for the inlined function.
602
+ */
603
+ struct blaze_symbolize_code_info code_info;
604
+ /**
605
+ * Unused member available for future expansion.
606
+ */
607
+ uint8_t reserved[8];
608
+ } blaze_symbolize_inlined_fn;
609
+
610
+ /**
611
+ * The result of symbolization of an address.
612
+ *
613
+ * A `blaze_sym` is the information of a symbol found for an
614
+ * address.
615
+ */
616
+ typedef struct blaze_sym {
617
+ /**
618
+ * The symbol name is where the given address should belong to.
619
+ *
620
+ * If an address could not be symbolized, this member will be NULL.
621
+ */
622
+ const char *name;
623
+ /**
624
+ * The address at which the symbol is located (i.e., its "start").
625
+ *
626
+ * This is the "normalized" address of the symbol, as present in
627
+ * the file (and reported by tools such as `readelf(1)`,
628
+ * `llvm-gsymutil`, or similar).
629
+ */
630
+ uintptr_t addr;
631
+ /**
632
+ * The byte offset of the address that got symbolized from the
633
+ * start of the symbol (i.e., from `addr`).
634
+ *
635
+ * E.g., when symbolizing address 0x1337 of a function that starts at
636
+ * 0x1330, the offset will be set to 0x07 (and `addr` will be 0x1330). This
637
+ * member is especially useful in contexts when input addresses are not
638
+ * already normalized, such as when symbolizing an address in a process
639
+ * context (which may have been relocated and/or have layout randomizations
640
+ * applied).
641
+ */
642
+ size_t offset;
643
+ /**
644
+ * Source code location information for the symbol.
645
+ */
646
+ struct blaze_symbolize_code_info code_info;
647
+ /**
648
+ * The number of symbolized inlined function calls present.
649
+ */
650
+ size_t inlined_cnt;
651
+ /**
652
+ * An array of `inlined_cnt` symbolized inlined function calls.
653
+ */
654
+ const struct blaze_symbolize_inlined_fn *inlined;
655
+ /**
656
+ * On error (i.e., if `name` is NULL), a reason trying to explain
657
+ * why symbolization failed.
658
+ */
659
+ blaze_symbolize_reason reason;
660
+ /**
661
+ * Unused member available for future expansion.
662
+ */
663
+ uint8_t reserved[7];
664
+ } blaze_sym;
665
+
666
+ /**
667
+ * `blaze_result` is the result of symbolization for C API.
668
+ *
669
+ * Instances of [`blaze_result`] are returned by any of the `blaze_symbolize_*`
670
+ * variants. They should be freed by calling [`blaze_result_free`].
671
+ */
672
+ typedef struct blaze_result {
673
+ /**
674
+ * The number of symbols being reported.
675
+ */
676
+ size_t cnt;
677
+ /**
678
+ * The symbols corresponding to input addresses.
679
+ *
680
+ * Symbolization happens based on the ordering of (input) addresses.
681
+ * Therefore, every input address has an associated symbol.
682
+ */
683
+ struct blaze_sym syms[0];
684
+ } blaze_result;
685
+
686
+ /**
687
+ * The parameters to load symbols and debug information from a process.
688
+ *
689
+ * Load all ELF files in a process as the sources of symbols and debug
690
+ * information.
691
+ */
692
+ typedef struct blaze_symbolize_src_process {
693
+ /**
694
+ * The size of this object's type.
695
+ *
696
+ * Make sure to initialize it to `sizeof(<type>)`. This member is used to
697
+ * ensure compatibility in the presence of member additions.
698
+ */
699
+ size_t type_size;
700
+ /**
701
+ * It is the PID of a process to symbolize.
702
+ *
703
+ * blazesym will parse `/proc/<pid>/maps` and load all the object
704
+ * files.
705
+ */
706
+ uint32_t pid;
707
+ /**
708
+ * Whether or not to consult debug symbols to satisfy the request
709
+ * (if present).
710
+ */
711
+ bool debug_syms;
712
+ /**
713
+ * Whether to incorporate a process' perf map file into the symbolization
714
+ * procedure.
715
+ */
716
+ bool perf_map;
717
+ /**
718
+ * Whether to work with `/proc/<pid>/map_files/` entries or with
719
+ * symbolic paths mentioned in `/proc/<pid>/maps` instead.
720
+ * `map_files` usage is generally strongly encouraged, as symbolic
721
+ * path usage is unlikely to work reliably in mount namespace
722
+ * contexts or when files have been deleted from the file system.
723
+ * However, by using symbolic paths the need for requiring the
724
+ * `SYS_ADMIN` capability is eliminated.
725
+ */
726
+ bool map_files;
727
+ /**
728
+ * Unused member available for future expansion. Must be initialized
729
+ * to zero.
730
+ */
731
+ uint8_t reserved[1];
732
+ } blaze_symbolize_src_process;
733
+
734
+ /**
735
+ * The parameters to load symbols and debug information from a kernel.
736
+ *
737
+ * Use a kernel image and a snapshot of its kallsyms as a source of symbols and
738
+ * debug information.
739
+ */
740
+ typedef struct blaze_symbolize_src_kernel {
741
+ /**
742
+ * The size of this object's type.
743
+ *
744
+ * Make sure to initialize it to `sizeof(<type>)`. This member is used to
745
+ * ensure compatibility in the presence of member additions.
746
+ */
747
+ size_t type_size;
748
+ /**
749
+ * The path of a copy of kallsyms.
750
+ *
751
+ * It can be `"/proc/kallsyms"` for the running kernel on the
752
+ * device. However, you can make copies for later. In that situation,
753
+ * you should give the path of a copy.
754
+ * Passing a `NULL`, by default, will result in `"/proc/kallsyms"`.
755
+ */
756
+ const char *kallsyms;
757
+ /**
758
+ * The path of a kernel image.
759
+ *
760
+ * The path of a kernel image should be, for instance,
761
+ * `"/boot/vmlinux-xxxx"`. For a `NULL` value, it will locate the
762
+ * kernel image of the running kernel in `"/boot/"` or
763
+ * `"/usr/lib/debug/boot/"`.
764
+ */
765
+ const char *kernel_image;
766
+ /**
767
+ * Whether or not to consult debug symbols from `kernel_image`
768
+ * to satisfy the request (if present).
769
+ */
770
+ bool debug_syms;
771
+ /**
772
+ * Unused member available for future expansion. Must be initialized
773
+ * to zero.
774
+ */
775
+ uint8_t reserved[7];
776
+ } blaze_symbolize_src_kernel;
777
+
778
+ /**
779
+ * The parameters to load symbols and debug information from an ELF.
780
+ *
781
+ * Describes the path and address of an ELF file loaded in a
782
+ * process.
783
+ */
784
+ typedef struct blaze_symbolize_src_elf {
785
+ /**
786
+ * The size of this object's type.
787
+ *
788
+ * Make sure to initialize it to `sizeof(<type>)`. This member is used to
789
+ * ensure compatibility in the presence of member additions.
790
+ */
791
+ size_t type_size;
792
+ /**
793
+ * The path to the ELF file.
794
+ *
795
+ * The referenced file may be an executable or shared object. For example,
796
+ * passing "/bin/sh" will load symbols and debug information from `sh` and
797
+ * passing "/lib/libc.so.xxx" will load symbols and debug information from
798
+ * libc.
799
+ */
800
+ const char *path;
801
+ /**
802
+ * Whether or not to consult debug symbols to satisfy the request
803
+ * (if present).
804
+ */
805
+ bool debug_syms;
806
+ /**
807
+ * Unused member available for future expansion. Must be initialized
808
+ * to zero.
809
+ */
810
+ uint8_t reserved[7];
811
+ } blaze_symbolize_src_elf;
812
+
813
+ /**
814
+ * The parameters to load symbols and debug information from "raw" Gsym data.
815
+ */
816
+ typedef struct blaze_symbolize_src_gsym_data {
817
+ /**
818
+ * The size of this object's type.
819
+ *
820
+ * Make sure to initialize it to `sizeof(<type>)`. This member is used to
821
+ * ensure compatibility in the presence of member additions.
822
+ */
823
+ size_t type_size;
824
+ /**
825
+ * The Gsym data.
826
+ */
827
+ const uint8_t *data;
828
+ /**
829
+ * The size of the Gsym data.
830
+ */
831
+ size_t data_len;
832
+ } blaze_symbolize_src_gsym_data;
833
+
834
+ /**
835
+ * The parameters to load symbols and debug information from a Gsym file.
836
+ */
837
+ typedef struct blaze_symbolize_src_gsym_file {
838
+ /**
839
+ * The size of this object's type.
840
+ *
841
+ * Make sure to initialize it to `sizeof(<type>)`. This member is used to
842
+ * ensure compatibility in the presence of member additions.
843
+ */
844
+ size_t type_size;
845
+ /**
846
+ * The path to a gsym file.
847
+ */
848
+ const char *path;
849
+ } blaze_symbolize_src_gsym_file;
850
+
851
+ #ifdef __cplusplus
852
+ extern "C" {
853
+ #endif // __cplusplus
854
+
855
+ /**
856
+ * Retrieve the error reported by the last fallible API function invoked.
857
+ */
858
+ enum blaze_err blaze_err_last(void);
859
+
860
+ /**
861
+ * Retrieve a textual representation of the error code.
862
+ */
863
+ const char *blaze_err_str(enum blaze_err err);
864
+
865
+ /**
866
+ * Lookup symbol information in an ELF file.
867
+ *
868
+ * On success, returns an array with `name_cnt` elements. Each such element, in
869
+ * turn, is NULL terminated array comprised of each symbol found. The returned
870
+ * object should be released using [`blaze_inspect_syms_free`] once it is no
871
+ * longer needed.
872
+ *
873
+ * On error, the function returns `NULL` and sets the thread's last error to
874
+ * indicate the problem encountered. Use [`blaze_err_last`] to retrieve this
875
+ * error.
876
+ *
877
+ * # Safety
878
+ * - `inspector` needs to point to an initialized [`blaze_inspector`] object
879
+ * - `src` needs to point to an initialized [`blaze_inspect_syms_elf`] object
880
+ * - `names` needs to be a valid pointer to `name_cnt` NUL terminated strings
881
+ */
882
+ const struct blaze_sym_info *const *blaze_inspect_syms_elf(const blaze_inspector *inspector,
883
+ const struct blaze_inspect_elf_src *src,
884
+ const char *const *names,
885
+ size_t name_cnt);
886
+
887
+ /**
888
+ * Free an array returned by [`blaze_inspect_syms_elf`].
889
+ *
890
+ * # Safety
891
+ *
892
+ * The pointer must be returned by [`blaze_inspect_syms_elf`].
893
+ */
894
+ void blaze_inspect_syms_free(const struct blaze_sym_info *const *syms);
895
+
896
+ /**
897
+ * Create an instance of a blazesym inspector.
898
+ *
899
+ * C ABI compatible version of [`blazesym::inspect::Inspector::new()`].
900
+ * Please refer to its documentation for the default configuration in
901
+ * use.
902
+ *
903
+ * On success, the function creates a new [`blaze_inspector`] object
904
+ * and returns it. The resulting object should be released using
905
+ * [`blaze_inspector_free`] once it is no longer needed.
906
+ *
907
+ * On error, the function returns `NULL` and sets the thread's last error to
908
+ * indicate the problem encountered. Use [`blaze_err_last`] to retrieve this
909
+ * error.
910
+ */
911
+ blaze_inspector *blaze_inspector_new(void);
912
+
913
+ /**
914
+ * Free a blazesym inspector.
915
+ *
916
+ * Release resources associated with a inspector as created by
917
+ * [`blaze_inspector_new`], for example.
918
+ *
919
+ * # Safety
920
+ * The provided inspector should have been created by
921
+ * [`blaze_inspector_new`].
922
+ */
923
+ void blaze_inspector_free(blaze_inspector *inspector);
924
+
925
+ /**
926
+ * Create an instance of a blazesym normalizer in the default
927
+ * configuration.
928
+ *
929
+ * C ABI compatible version of [`blazesym::normalize::Normalizer::new()`].
930
+ * Please refer to its documentation for the default configuration in use.
931
+ *
932
+ * On success, the function creates a new [`blaze_normalizer`] object and
933
+ * returns it. The resulting object should be released using
934
+ * [`blaze_normalizer_free`] once it is no longer needed.
935
+ *
936
+ * On error, the function returns `NULL` and sets the thread's last error to
937
+ * indicate the problem encountered. Use [`blaze_err_last`] to retrieve this
938
+ * error.
939
+ */
940
+ blaze_normalizer *blaze_normalizer_new(void);
941
+
942
+ /**
943
+ * Create an instance of a blazesym normalizer.
944
+ *
945
+ * On success, the function creates a new [`blaze_normalizer`] object and
946
+ * returns it. The resulting object should be released using
947
+ * [`blaze_normalizer_free`] once it is no longer needed.
948
+ *
949
+ * On error, the function returns `NULL` and sets the thread's last error to
950
+ * indicate the problem encountered. Use [`blaze_err_last`] to retrieve this
951
+ * error.
952
+ *
953
+ * # Safety
954
+ * - `opts` needs to point to a valid [`blaze_normalizer_opts`] object
955
+ */
956
+ blaze_normalizer *blaze_normalizer_new_opts(const struct blaze_normalizer_opts *opts);
957
+
958
+ /**
959
+ * Free a blazesym normalizer.
960
+ *
961
+ * Release resources associated with a normalizer as created by
962
+ * [`blaze_normalizer_new`], for example.
963
+ *
964
+ * # Safety
965
+ * The provided normalizer should have been created by
966
+ * [`blaze_normalizer_new`].
967
+ */
968
+ void blaze_normalizer_free(blaze_normalizer *normalizer);
969
+
970
+ /**
971
+ * Retrieve a textual representation of the reason of a normalization failure.
972
+ */
973
+ const char *blaze_normalize_reason_str(blaze_normalize_reason err);
974
+
975
+ /**
976
+ * Normalize a list of user space addresses.
977
+ *
978
+ * C ABI compatible version of [`Normalizer::normalize_user_addrs`].
979
+ *
980
+ * `pid` should describe the PID of the process to which the addresses
981
+ * belongs. It may be `0` if they belong to the calling process.
982
+ *
983
+ * On success, the function creates a new [`blaze_normalized_user_output`]
984
+ * object and returns it. The resulting object should be released using
985
+ * [`blaze_user_output_free`] once it is no longer needed.
986
+ *
987
+ * On error, the function returns `NULL` and sets the thread's last error to
988
+ * indicate the problem encountered. Use [`blaze_err_last`] to retrieve this
989
+ * error.
990
+ *
991
+ * # Safety
992
+ * - `addrs` needs to be a valid pointer to `addr_cnt` addresses
993
+ */
994
+ struct blaze_normalized_user_output *blaze_normalize_user_addrs(const blaze_normalizer *normalizer,
995
+ uint32_t pid,
996
+ const uintptr_t *addrs,
997
+ size_t addr_cnt);
998
+
999
+ /**
1000
+ * Normalize a list of user space addresses.
1001
+ *
1002
+ * C ABI compatible version of [`Normalizer::normalize_user_addrs_opts`].
1003
+ *
1004
+ * `pid` should describe the PID of the process to which the addresses
1005
+ * belongs. It may be `0` if they belong to the calling process.
1006
+ *
1007
+ * `opts` should point to a valid [`blaze_normalize_opts`] object.
1008
+ *
1009
+ * On success, the function creates a new [`blaze_normalized_user_output`]
1010
+ * object and returns it. The resulting object should be released using
1011
+ * [`blaze_user_output_free`] once it is no longer needed.
1012
+ *
1013
+ * On error, the function returns `NULL` and sets the thread's last error to
1014
+ * indicate the problem encountered. Use [`blaze_err_last`] to retrieve this
1015
+ * error.
1016
+ *
1017
+ * # Safety
1018
+ * - `addrs` needs to be a valid pointer to `addr_cnt` addresses
1019
+ */
1020
+ struct blaze_normalized_user_output *blaze_normalize_user_addrs_opts(const blaze_normalizer *normalizer,
1021
+ uint32_t pid,
1022
+ const uintptr_t *addrs,
1023
+ size_t addr_cnt,
1024
+ const struct blaze_normalize_opts *opts);
1025
+
1026
+ /**
1027
+ * Free an object as returned by [`blaze_normalize_user_addrs`] or
1028
+ * [`blaze_normalize_user_addrs_opts`].
1029
+ *
1030
+ * # Safety
1031
+ * The provided object should have been created by
1032
+ * [`blaze_normalize_user_addrs`] or
1033
+ * [`blaze_normalize_user_addrs_opts`].
1034
+ */
1035
+ void blaze_user_output_free(struct blaze_normalized_user_output *output);
1036
+
1037
+ /**
1038
+ * Retrieve a textual representation of the reason of a symbolization
1039
+ * failure.
1040
+ */
1041
+ const char *blaze_symbolize_reason_str(blaze_symbolize_reason err);
1042
+
1043
+ /**
1044
+ * Create an instance of a symbolizer.
1045
+ *
1046
+ * C ABI compatible version of [`blazesym::symbolize::Symbolizer::new()`].
1047
+ * Please refer to its documentation for the default configuration in use.
1048
+ *
1049
+ * On success, the function creates a new [`blaze_symbolizer`] object
1050
+ * and returns it. The resulting object should be released using
1051
+ * [`blaze_symbolizer_free`] once it is no longer needed.
1052
+ *
1053
+ * On error, the function returns `NULL` and sets the thread's last error to
1054
+ * indicate the problem encountered. Use [`blaze_err_last`] to retrieve this
1055
+ * error.
1056
+ */
1057
+ blaze_symbolizer *blaze_symbolizer_new(void);
1058
+
1059
+ /**
1060
+ * Create an instance of a symbolizer with configurable options.
1061
+ *
1062
+ * On success, the function creates a new [`blaze_symbolizer`] object
1063
+ * and returns it. The resulting object should be released using
1064
+ * [`blaze_symbolizer_free`] once it is no longer needed.
1065
+ *
1066
+ * On error, the function returns `NULL` and sets the thread's last error to
1067
+ * indicate the problem encountered. Use [`blaze_err_last`] to retrieve this
1068
+ * error.
1069
+ *
1070
+ * # Safety
1071
+ * - `opts` needs to point to a valid [`blaze_symbolizer_opts`] object
1072
+ */
1073
+ blaze_symbolizer *blaze_symbolizer_new_opts(const struct blaze_symbolizer_opts *opts);
1074
+
1075
+ /**
1076
+ * Free an instance of blazesym a symbolizer for C API.
1077
+ *
1078
+ * # Safety
1079
+ *
1080
+ * The pointer must have been returned by [`blaze_symbolizer_new`] or
1081
+ * [`blaze_symbolizer_new_opts`].
1082
+ */
1083
+ void blaze_symbolizer_free(blaze_symbolizer *symbolizer);
1084
+
1085
+ /**
1086
+ * Symbolize a list of process absolute addresses.
1087
+ *
1088
+ * On success, the function returns a [`blaze_result`] containing an
1089
+ * array of `abs_addr_cnt` [`blaze_sym`] objects. The returned object
1090
+ * should be released using [`blaze_result_free`] once it is no longer
1091
+ * needed.
1092
+ *
1093
+ * On error, the function returns `NULL` and sets the thread's last error to
1094
+ * indicate the problem encountered. Use [`blaze_err_last`] to retrieve this
1095
+ * error.
1096
+ *
1097
+ * # Safety
1098
+ * - `symbolizer` needs to point to a valid [`blaze_symbolizer`] object
1099
+ * - `src` needs to point to a valid [`blaze_symbolize_src_process`] object
1100
+ * -`abs_addrs` point to an array of `abs_addr_cnt` addresses
1101
+ */
1102
+ const struct blaze_result *blaze_symbolize_process_abs_addrs(blaze_symbolizer *symbolizer,
1103
+ const struct blaze_symbolize_src_process *src,
1104
+ const uintptr_t *abs_addrs,
1105
+ size_t abs_addr_cnt);
1106
+
1107
+ /**
1108
+ * Symbolize a list of kernel absolute addresses.
1109
+ *
1110
+ * On success, the function returns a [`blaze_result`] containing an
1111
+ * array of `abs_addr_cnt` [`blaze_sym`] objects. The returned object
1112
+ * should be released using [`blaze_result_free`] once it is no longer
1113
+ * needed.
1114
+ *
1115
+ * On error, the function returns `NULL` and sets the thread's last error to
1116
+ * indicate the problem encountered. Use [`blaze_err_last`] to retrieve this
1117
+ * error.
1118
+ *
1119
+ * # Safety
1120
+ * - `symbolizer` needs to point to a valid [`blaze_symbolizer`] object
1121
+ * - `src` needs to point to a valid [`blaze_symbolize_src_kernel`] object
1122
+ * -`abs_addrs` point to an array of `abs_addr_cnt` addresses
1123
+ */
1124
+ const struct blaze_result *blaze_symbolize_kernel_abs_addrs(blaze_symbolizer *symbolizer,
1125
+ const struct blaze_symbolize_src_kernel *src,
1126
+ const uintptr_t *abs_addrs,
1127
+ size_t abs_addr_cnt);
1128
+
1129
+ /**
1130
+ * Symbolize virtual offsets in an ELF file.
1131
+ *
1132
+ * On success, the function returns a [`blaze_result`] containing an
1133
+ * array of `virt_offset_cnt` [`blaze_sym`] objects. The returned
1134
+ * object should be released using [`blaze_result_free`] once it is no
1135
+ * longer needed.
1136
+ *
1137
+ * On error, the function returns `NULL` and sets the thread's last error to
1138
+ * indicate the problem encountered. Use [`blaze_err_last`] to retrieve this
1139
+ * error.
1140
+ *
1141
+ * # Safety
1142
+ * - `symbolizer` needs to point to a valid [`blaze_symbolizer`] object
1143
+ * - `src` needs to point to a valid [`blaze_symbolize_src_elf`] object
1144
+ * -`virt_offsets` point to an array of `virt_offset_cnt` addresses
1145
+ */
1146
+ const struct blaze_result *blaze_symbolize_elf_virt_offsets(blaze_symbolizer *symbolizer,
1147
+ const struct blaze_symbolize_src_elf *src,
1148
+ const uintptr_t *virt_offsets,
1149
+ size_t virt_offset_cnt);
1150
+
1151
+ /**
1152
+ * Symbolize file offsets in an ELF file.
1153
+ *
1154
+ * On success, the function returns a [`blaze_result`] containing an
1155
+ * array of `file_offset_cnt` [`blaze_sym`] objects. The returned
1156
+ * object should be released using [`blaze_result_free`] once it is no
1157
+ * longer needed.
1158
+ *
1159
+ * On error, the function returns `NULL` and sets the thread's last error to
1160
+ * indicate the problem encountered. Use [`blaze_err_last`] to retrieve this
1161
+ * error.
1162
+ *
1163
+ * # Safety
1164
+ * - `symbolizer` needs to point to a valid [`blaze_symbolizer`] object
1165
+ * - `src` needs to point to a valid [`blaze_symbolize_src_elf`] object
1166
+ * -`file_offsets` point to an array of `file_offset_cnt` addresses
1167
+ */
1168
+ const struct blaze_result *blaze_symbolize_elf_file_offsets(blaze_symbolizer *symbolizer,
1169
+ const struct blaze_symbolize_src_elf *src,
1170
+ const uintptr_t *file_offsets,
1171
+ size_t file_offset_cnt);
1172
+
1173
+ /**
1174
+ * Symbolize virtual offsets using "raw" Gsym data.
1175
+ *
1176
+ * On success, the function returns a [`blaze_result`] containing an
1177
+ * array of `virt_offset_cnt` [`blaze_sym`] objects. The returned
1178
+ * object should be released using [`blaze_result_free`] once it is no
1179
+ * longer needed.
1180
+ *
1181
+ * On error, the function returns `NULL` and sets the thread's last error to
1182
+ * indicate the problem encountered. Use [`blaze_err_last`] to retrieve this
1183
+ * error.
1184
+ *
1185
+ * # Safety
1186
+ * - `symbolizer` needs to point to a valid [`blaze_symbolizer`] object
1187
+ * - `src` needs to point to a valid [`blaze_symbolize_src_gsym_data`] object
1188
+ * -`virt_offsets` point to an array of `virt_offset_cnt` addresses
1189
+ */
1190
+ const struct blaze_result *blaze_symbolize_gsym_data_virt_offsets(blaze_symbolizer *symbolizer,
1191
+ const struct blaze_symbolize_src_gsym_data *src,
1192
+ const uintptr_t *virt_offsets,
1193
+ size_t virt_offset_cnt);
1194
+
1195
+ /**
1196
+ * Symbolize virtual offsets in a Gsym file.
1197
+ *
1198
+ * On success, the function returns a [`blaze_result`] containing an
1199
+ * array of `virt_offset_cnt` [`blaze_sym`] objects. The returned
1200
+ * object should be released using [`blaze_result_free`] once it is no
1201
+ * longer needed.
1202
+ *
1203
+ * On error, the function returns `NULL` and sets the thread's last error to
1204
+ * indicate the problem encountered. Use [`blaze_err_last`] to retrieve this
1205
+ * error.
1206
+ *
1207
+ * # Safety
1208
+ * - `symbolizer` needs to point to a valid [`blaze_symbolizer`] object
1209
+ * - `src` needs to point to a valid [`blaze_symbolize_src_gsym_file`] object
1210
+ * -`virt_offsets` point to an array of `virt_offset_cnt` addresses
1211
+ */
1212
+ const struct blaze_result *blaze_symbolize_gsym_file_virt_offsets(blaze_symbolizer *symbolizer,
1213
+ const struct blaze_symbolize_src_gsym_file *src,
1214
+ const uintptr_t *virt_offsets,
1215
+ size_t virt_offset_cnt);
1216
+
1217
+ /**
1218
+ * Free an array returned by any of the `blaze_symbolize_*` variants.
1219
+ *
1220
+ * # Safety
1221
+ * The pointer must have been returned by any of the `blaze_symbolize_*`
1222
+ * variants.
1223
+ */
1224
+ void blaze_result_free(const struct blaze_result *results);
1225
+
1226
+ #ifdef __cplusplus
1227
+ } // extern "C"
1228
+ #endif // __cplusplus
1229
+
1230
+ #endif /* __blazesym_h_ */