libdatadog 12.0.0.1.0-x86_64-linux → 14.0.0.1.0-x86_64-linux

Sign up to get free protection for your applications and to get access to all the features.
Files changed (28) hide show
  1. checksums.yaml +4 -4
  2. data/lib/libdatadog/version.rb +1 -1
  3. data/vendor/{libdatadog-12.0.0 → libdatadog-14.0.0}/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/LICENSE-3rdparty.yml +12222 -9104
  4. data/vendor/{libdatadog-12.0.0 → libdatadog-14.0.0}/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/bin/libdatadog-crashtracking-receiver +0 -0
  5. data/vendor/libdatadog-14.0.0/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/include/datadog/blazesym.h +1291 -0
  6. data/vendor/{libdatadog-12.0.0/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl → libdatadog-14.0.0/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu}/include/datadog/common.h +50 -17
  7. data/vendor/{libdatadog-12.0.0/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl → libdatadog-14.0.0/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu}/include/datadog/crashtracker.h +11 -12
  8. data/vendor/{libdatadog-12.0.0/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl → libdatadog-14.0.0/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu}/include/datadog/profiling.h +3 -3
  9. data/vendor/{libdatadog-12.0.0 → libdatadog-14.0.0}/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/include/datadog/telemetry.h +1 -1
  10. data/vendor/{libdatadog-12.0.0/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl → libdatadog-14.0.0/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu}/lib/libdatadog_profiling.so +0 -0
  11. data/vendor/{libdatadog-12.0.0 → libdatadog-14.0.0}/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl/LICENSE-3rdparty.yml +12222 -9104
  12. data/vendor/libdatadog-14.0.0/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl/bin/libdatadog-crashtracking-receiver +0 -0
  13. data/vendor/libdatadog-14.0.0/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl/include/datadog/blazesym.h +1291 -0
  14. data/vendor/{libdatadog-12.0.0/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu → libdatadog-14.0.0/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl}/include/datadog/common.h +50 -17
  15. data/vendor/{libdatadog-12.0.0/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu → libdatadog-14.0.0/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl}/include/datadog/crashtracker.h +11 -12
  16. data/vendor/{libdatadog-12.0.0/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu → libdatadog-14.0.0/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl}/include/datadog/profiling.h +3 -3
  17. data/vendor/{libdatadog-12.0.0 → libdatadog-14.0.0}/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl/include/datadog/telemetry.h +1 -1
  18. data/vendor/{libdatadog-12.0.0/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu → libdatadog-14.0.0/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl}/lib/libdatadog_profiling.so +0 -0
  19. metadata +24 -24
  20. data/vendor/libdatadog-12.0.0/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/include/datadog/blazesym.h +0 -1229
  21. data/vendor/libdatadog-12.0.0/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl/bin/libdatadog-crashtracking-receiver +0 -0
  22. data/vendor/libdatadog-12.0.0/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl/include/datadog/blazesym.h +0 -1229
  23. /data/vendor/{libdatadog-12.0.0 → libdatadog-14.0.0}/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/LICENSE +0 -0
  24. /data/vendor/{libdatadog-12.0.0 → libdatadog-14.0.0}/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/NOTICE +0 -0
  25. /data/vendor/{libdatadog-12.0.0 → libdatadog-14.0.0}/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/lib/pkgconfig/datadog_profiling_with_rpath.pc +0 -0
  26. /data/vendor/{libdatadog-12.0.0 → libdatadog-14.0.0}/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl/LICENSE +0 -0
  27. /data/vendor/{libdatadog-12.0.0 → libdatadog-14.0.0}/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl/NOTICE +0 -0
  28. /data/vendor/{libdatadog-12.0.0 → libdatadog-14.0.0}/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl/lib/pkgconfig/datadog_profiling_with_rpath.pc +0 -0
@@ -0,0 +1,1291 @@
1
+ // BSD-3-Clause License
2
+ // Synchronized from blazesym repository
3
+ // https://github.com/libbpf/blazesym/blob/capi-v0.1.0-rc.1/capi/include/blazesym.h
4
+ /*
5
+ * Please refer to the documentation hosted at
6
+ *
7
+ * https://docs.rs/blazesym-c/0.1.0-rc.1
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
+ uint64_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 use the `PROCMAP_QUERY` ioctl instead of
301
+ * parsing `/proc/<pid>/maps` for getting available VMA ranges.
302
+ *
303
+ * Refer to
304
+ * [`blaze_supports_procmap_query`][crate::helper::blaze_supports_procmap_query]
305
+ * as a way to check whether your system supports this
306
+ * functionality.
307
+ *
308
+ * # Notes
309
+ *
310
+ * Support for this ioctl is only present in very recent kernels
311
+ * (likely: 6.11+). See <https://lwn.net/Articles/979931/> for
312
+ * details.
313
+ *
314
+ * Furthermore, the ioctl will also be used for retrieving build
315
+ * IDs (if enabled). Build ID reading logic in the kernel is known
316
+ * to be incomplete, with a fix slated to be included only with
317
+ * 6.12.
318
+ */
319
+ bool use_procmap_query;
320
+ /**
321
+ * Whether or not to cache `/proc/<pid>/maps` contents.
322
+ *
323
+ * Setting this flag to `true` is not generally recommended, because it
324
+ * could result in addresses corresponding to mappings added after caching
325
+ * may not be normalized successfully, as there is no reasonable way of
326
+ * detecting staleness.
327
+ */
328
+ bool cache_vmas;
329
+ /**
330
+ * Whether to read and report build IDs as part of the normalization
331
+ * process.
332
+ *
333
+ * Note that build ID read failures will be swallowed without
334
+ * failing the normalization operation.
335
+ */
336
+ bool build_ids;
337
+ /**
338
+ * Whether or not to cache build IDs. This flag only has an effect
339
+ * if build ID reading is enabled in the first place.
340
+ */
341
+ bool cache_build_ids;
342
+ /**
343
+ * Unused member available for future expansion. Must be initialized
344
+ * to zero.
345
+ */
346
+ uint8_t reserved[4];
347
+ } blaze_normalizer_opts;
348
+
349
+ /**
350
+ * C compatible version of [`Apk`].
351
+ */
352
+ typedef struct blaze_user_meta_apk {
353
+ /**
354
+ * The canonical absolute path to the APK, including its name.
355
+ * This member is always present.
356
+ */
357
+ char *path;
358
+ /**
359
+ * Unused member available for future expansion.
360
+ */
361
+ uint8_t reserved[8];
362
+ } blaze_user_meta_apk;
363
+
364
+ /**
365
+ * C compatible version of [`Elf`].
366
+ */
367
+ typedef struct blaze_user_meta_elf {
368
+ /**
369
+ * The path to the ELF file. This member is always present.
370
+ */
371
+ char *path;
372
+ /**
373
+ * The length of the build ID, in bytes.
374
+ */
375
+ size_t build_id_len;
376
+ /**
377
+ * The optional build ID of the ELF file, if found and readable.
378
+ */
379
+ uint8_t *build_id;
380
+ /**
381
+ * Unused member available for future expansion.
382
+ */
383
+ uint8_t reserved[8];
384
+ } blaze_user_meta_elf;
385
+
386
+ /**
387
+ * C compatible version of [`Unknown`].
388
+ */
389
+ typedef struct blaze_user_meta_unknown {
390
+ /**
391
+ * The reason why normalization failed.
392
+ *
393
+ * The provided reason is a best guess, hinting at what ultimately
394
+ * prevented the normalization from being successful.
395
+ */
396
+ blaze_normalize_reason reason;
397
+ /**
398
+ * Unused member available for future expansion.
399
+ */
400
+ uint8_t reserved[7];
401
+ } blaze_user_meta_unknown;
402
+
403
+ /**
404
+ * The actual variant data in [`blaze_user_meta`].
405
+ */
406
+ typedef union blaze_user_meta_variant {
407
+ /**
408
+ * Valid on [`blaze_user_meta_kind::BLAZE_USER_META_APK`].
409
+ */
410
+ struct blaze_user_meta_apk apk;
411
+ /**
412
+ * Valid on [`blaze_user_meta_kind::BLAZE_USER_META_ELF`].
413
+ */
414
+ struct blaze_user_meta_elf elf;
415
+ /**
416
+ * Valid on [`blaze_user_meta_kind::BLAZE_USER_META_UNKNOWN`].
417
+ */
418
+ struct blaze_user_meta_unknown unknown;
419
+ } blaze_user_meta_variant;
420
+
421
+ /**
422
+ * C ABI compatible version of [`UserMeta`].
423
+ */
424
+ typedef struct blaze_user_meta {
425
+ /**
426
+ * The variant kind that is present.
427
+ */
428
+ enum blaze_user_meta_kind kind;
429
+ /**
430
+ * The actual variant with its data.
431
+ */
432
+ union blaze_user_meta_variant variant;
433
+ } blaze_user_meta;
434
+
435
+ /**
436
+ * A file offset or non-normalized address along with an index into the
437
+ * associated [`blaze_user_meta`] array (such as
438
+ * [`blaze_normalized_user_output::metas`]).
439
+ */
440
+ typedef struct blaze_normalized_output {
441
+ /**
442
+ * The file offset or non-normalized address.
443
+ */
444
+ uint64_t output;
445
+ /**
446
+ * The index into the associated [`blaze_user_meta`] array.
447
+ */
448
+ size_t meta_idx;
449
+ } blaze_normalized_output;
450
+
451
+ /**
452
+ * An object representing normalized user addresses.
453
+ *
454
+ * C ABI compatible version of [`UserOutput`].
455
+ */
456
+ typedef struct blaze_normalized_user_output {
457
+ /**
458
+ * The number of [`blaze_user_meta`] objects present in `metas`.
459
+ */
460
+ size_t meta_cnt;
461
+ /**
462
+ * An array of `meta_cnt` objects.
463
+ */
464
+ struct blaze_user_meta *metas;
465
+ /**
466
+ * The number of [`blaze_normalized_output`] objects present in `outputs`.
467
+ */
468
+ size_t output_cnt;
469
+ /**
470
+ * An array of `output_cnt` objects.
471
+ */
472
+ struct blaze_normalized_output *outputs;
473
+ /**
474
+ * Unused member available for future expansion.
475
+ */
476
+ uint8_t reserved[8];
477
+ } blaze_normalized_user_output;
478
+
479
+ /**
480
+ * Options influencing the address normalization process.
481
+ */
482
+ typedef struct blaze_normalize_opts {
483
+ /**
484
+ * The size of this object's type.
485
+ *
486
+ * Make sure to initialize it to `sizeof(<type>)`. This member is used to
487
+ * ensure compatibility in the presence of member additions.
488
+ */
489
+ size_t type_size;
490
+ /**
491
+ * Whether or not addresses are sorted (in ascending order) already.
492
+ *
493
+ * Normalization always happens on sorted addresses and if the addresses
494
+ * are sorted already, the library does not need to sort and later restore
495
+ * original ordering, speeding up the normalization process.
496
+ */
497
+ bool sorted_addrs;
498
+ /**
499
+ * Whether to report `/proc/<pid>/map_files/` entry paths or work
500
+ * with symbolic paths mentioned in `/proc/<pid>/maps` instead.
501
+ *
502
+ * Relying on `map_files` may make sense in cases where
503
+ * symbolization happens on the local system and the reported paths
504
+ * can be worked with directly. In most other cases where one wants
505
+ * to attach meaning to symbolic paths on a remote system (e.g., by
506
+ * using them for file look up) symbolic paths are probably the
507
+ * better choice.
508
+ */
509
+ bool map_files;
510
+ /**
511
+ * Unused member available for future expansion. Must be initialized
512
+ * to zero.
513
+ */
514
+ uint8_t reserved[6];
515
+ } blaze_normalize_opts;
516
+
517
+ /**
518
+ * C ABI compatible version of [`blazesym::symbolize::Symbolizer`].
519
+ *
520
+ * It is returned by [`blaze_symbolizer_new`] and should be free by
521
+ * [`blaze_symbolizer_free`].
522
+ */
523
+ typedef struct blaze_symbolizer blaze_symbolizer;
524
+
525
+ /**
526
+ * Options for configuring [`blaze_symbolizer`] objects.
527
+ */
528
+ typedef struct blaze_symbolizer_opts {
529
+ /**
530
+ * The size of this object's type.
531
+ *
532
+ * Make sure to initialize it to `sizeof(<type>)`. This member is used to
533
+ * ensure compatibility in the presence of member additions.
534
+ */
535
+ size_t type_size;
536
+ /**
537
+ * Array of debug directories to search for split debug information.
538
+ *
539
+ * These directories will be consulted (in given order) when resolving
540
+ * debug links in binaries. By default and when this member is NULL,
541
+ * `/usr/lib/debug` and `/lib/debug/` will be searched. Setting an array
542
+ * here will overwrite these defaults, so make sure to include these
543
+ * directories as desired.
544
+ *
545
+ * Note that the directory containing a symbolization source is always an
546
+ * implicit candidate target directory of the highest precedence.
547
+ */
548
+ const char *const *debug_dirs;
549
+ /**
550
+ * The number of array elements in `debug_dirs`.
551
+ */
552
+ size_t debug_dirs_len;
553
+ /**
554
+ * Whether or not to automatically reload file system based
555
+ * symbolization sources that were updated since the last
556
+ * symbolization operation.
557
+ */
558
+ bool auto_reload;
559
+ /**
560
+ * Whether to attempt to gather source code location information.
561
+ *
562
+ * This setting implies `debug_syms` (and forces it to `true`).
563
+ */
564
+ bool code_info;
565
+ /**
566
+ * Whether to report inlined functions as part of symbolization.
567
+ */
568
+ bool inlined_fns;
569
+ /**
570
+ * Whether or not to transparently demangle symbols.
571
+ *
572
+ * Demangling happens on a best-effort basis. Currently supported
573
+ * languages are Rust and C++ and the flag will have no effect if
574
+ * the underlying language does not mangle symbols (such as C).
575
+ */
576
+ bool demangle;
577
+ /**
578
+ * Unused member available for future expansion. Must be initialized
579
+ * to zero.
580
+ */
581
+ uint8_t reserved[4];
582
+ } blaze_symbolizer_opts;
583
+
584
+ /**
585
+ * Source code location information for a symbol or inlined function.
586
+ */
587
+ typedef struct blaze_symbolize_code_info {
588
+ /**
589
+ * The directory in which the source file resides.
590
+ *
591
+ * This attribute is optional and may be NULL.
592
+ */
593
+ const char *dir;
594
+ /**
595
+ * The file that defines the symbol.
596
+ *
597
+ * This attribute is optional and may be NULL.
598
+ */
599
+ const char *file;
600
+ /**
601
+ * The line number on which the symbol is located in the source
602
+ * code.
603
+ */
604
+ uint32_t line;
605
+ /**
606
+ * The column number of the symbolized instruction in the source
607
+ * code.
608
+ */
609
+ uint16_t column;
610
+ /**
611
+ * Unused member available for future expansion.
612
+ */
613
+ uint8_t reserved[10];
614
+ } blaze_symbolize_code_info;
615
+
616
+ /**
617
+ * Data about an inlined function call.
618
+ */
619
+ typedef struct blaze_symbolize_inlined_fn {
620
+ /**
621
+ * The symbol name of the inlined function.
622
+ */
623
+ const char *name;
624
+ /**
625
+ * Source code location information for the inlined function.
626
+ */
627
+ struct blaze_symbolize_code_info code_info;
628
+ /**
629
+ * Unused member available for future expansion.
630
+ */
631
+ uint8_t reserved[8];
632
+ } blaze_symbolize_inlined_fn;
633
+
634
+ /**
635
+ * The result of symbolization of an address.
636
+ *
637
+ * A `blaze_sym` is the information of a symbol found for an
638
+ * address.
639
+ */
640
+ typedef struct blaze_sym {
641
+ /**
642
+ * The symbol name is where the given address should belong to.
643
+ *
644
+ * If an address could not be symbolized, this member will be NULL.
645
+ */
646
+ const char *name;
647
+ /**
648
+ * The address at which the symbol is located (i.e., its "start").
649
+ *
650
+ * This is the "normalized" address of the symbol, as present in
651
+ * the file (and reported by tools such as `readelf(1)`,
652
+ * `llvm-gsymutil`, or similar).
653
+ */
654
+ uint64_t addr;
655
+ /**
656
+ * The byte offset of the address that got symbolized from the
657
+ * start of the symbol (i.e., from `addr`).
658
+ *
659
+ * E.g., when symbolizing address 0x1337 of a function that starts at
660
+ * 0x1330, the offset will be set to 0x07 (and `addr` will be 0x1330). This
661
+ * member is especially useful in contexts when input addresses are not
662
+ * already normalized, such as when symbolizing an address in a process
663
+ * context (which may have been relocated and/or have layout randomizations
664
+ * applied).
665
+ */
666
+ size_t offset;
667
+ /**
668
+ * Source code location information for the symbol.
669
+ */
670
+ struct blaze_symbolize_code_info code_info;
671
+ /**
672
+ * The number of symbolized inlined function calls present.
673
+ */
674
+ size_t inlined_cnt;
675
+ /**
676
+ * An array of `inlined_cnt` symbolized inlined function calls.
677
+ */
678
+ const struct blaze_symbolize_inlined_fn *inlined;
679
+ /**
680
+ * On error (i.e., if `name` is NULL), a reason trying to explain
681
+ * why symbolization failed.
682
+ */
683
+ blaze_symbolize_reason reason;
684
+ /**
685
+ * Unused member available for future expansion.
686
+ */
687
+ uint8_t reserved[7];
688
+ } blaze_sym;
689
+
690
+ /**
691
+ * `blaze_syms` is the result of symbolization of a list of addresses.
692
+ *
693
+ * Instances of [`blaze_syms`] are returned by any of the `blaze_symbolize_*`
694
+ * variants. They should be freed by calling [`blaze_syms_free`].
695
+ */
696
+ typedef struct blaze_syms {
697
+ /**
698
+ * The number of symbols being reported.
699
+ */
700
+ size_t cnt;
701
+ /**
702
+ * The symbols corresponding to input addresses.
703
+ *
704
+ * Symbolization happens based on the ordering of (input) addresses.
705
+ * Therefore, every input address has an associated symbol.
706
+ */
707
+ struct blaze_sym syms[0];
708
+ } blaze_syms;
709
+
710
+ /**
711
+ * The parameters to load symbols and debug information from a process.
712
+ *
713
+ * Load all ELF files in a process as the sources of symbols and debug
714
+ * information.
715
+ */
716
+ typedef struct blaze_symbolize_src_process {
717
+ /**
718
+ * The size of this object's type.
719
+ *
720
+ * Make sure to initialize it to `sizeof(<type>)`. This member is used to
721
+ * ensure compatibility in the presence of member additions.
722
+ */
723
+ size_t type_size;
724
+ /**
725
+ * It is the PID of a process to symbolize.
726
+ *
727
+ * blazesym will parse `/proc/<pid>/maps` and load all the object
728
+ * files.
729
+ */
730
+ uint32_t pid;
731
+ /**
732
+ * Whether or not to consult debug symbols to satisfy the request
733
+ * (if present).
734
+ */
735
+ bool debug_syms;
736
+ /**
737
+ * Whether to incorporate a process' perf map file into the symbolization
738
+ * procedure.
739
+ */
740
+ bool perf_map;
741
+ /**
742
+ * Whether to work with `/proc/<pid>/map_files/` entries or with
743
+ * symbolic paths mentioned in `/proc/<pid>/maps` instead.
744
+ * `map_files` usage is generally strongly encouraged, as symbolic
745
+ * path usage is unlikely to work reliably in mount namespace
746
+ * contexts or when files have been deleted from the file system.
747
+ * However, by using symbolic paths the need for requiring the
748
+ * `SYS_ADMIN` capability is eliminated.
749
+ */
750
+ bool map_files;
751
+ /**
752
+ * Unused member available for future expansion. Must be initialized
753
+ * to zero.
754
+ */
755
+ uint8_t reserved[1];
756
+ } blaze_symbolize_src_process;
757
+
758
+ /**
759
+ * The parameters to load symbols and debug information from a kernel.
760
+ *
761
+ * Use a kernel image and a snapshot of its kallsyms as a source of symbols and
762
+ * debug information.
763
+ */
764
+ typedef struct blaze_symbolize_src_kernel {
765
+ /**
766
+ * The size of this object's type.
767
+ *
768
+ * Make sure to initialize it to `sizeof(<type>)`. This member is used to
769
+ * ensure compatibility in the presence of member additions.
770
+ */
771
+ size_t type_size;
772
+ /**
773
+ * The path of a copy of kallsyms.
774
+ *
775
+ * It can be `"/proc/kallsyms"` for the running kernel on the
776
+ * device. However, you can make copies for later. In that situation,
777
+ * you should give the path of a copy.
778
+ * Passing a `NULL`, by default, will result in `"/proc/kallsyms"`.
779
+ */
780
+ const char *kallsyms;
781
+ /**
782
+ * The path of a kernel image.
783
+ *
784
+ * The path of a kernel image should be, for instance,
785
+ * `"/boot/vmlinux-xxxx"`. For a `NULL` value, it will locate the
786
+ * kernel image of the running kernel in `"/boot/"` or
787
+ * `"/usr/lib/debug/boot/"`.
788
+ */
789
+ const char *kernel_image;
790
+ /**
791
+ * Whether or not to consult debug symbols from `kernel_image`
792
+ * to satisfy the request (if present).
793
+ */
794
+ bool debug_syms;
795
+ /**
796
+ * Unused member available for future expansion. Must be initialized
797
+ * to zero.
798
+ */
799
+ uint8_t reserved[7];
800
+ } blaze_symbolize_src_kernel;
801
+
802
+ /**
803
+ * The parameters to load symbols and debug information from an ELF.
804
+ *
805
+ * Describes the path and address of an ELF file loaded in a
806
+ * process.
807
+ */
808
+ typedef struct blaze_symbolize_src_elf {
809
+ /**
810
+ * The size of this object's type.
811
+ *
812
+ * Make sure to initialize it to `sizeof(<type>)`. This member is used to
813
+ * ensure compatibility in the presence of member additions.
814
+ */
815
+ size_t type_size;
816
+ /**
817
+ * The path to the ELF file.
818
+ *
819
+ * The referenced file may be an executable or shared object. For example,
820
+ * passing "/bin/sh" will load symbols and debug information from `sh` and
821
+ * passing "/lib/libc.so.xxx" will load symbols and debug information from
822
+ * libc.
823
+ */
824
+ const char *path;
825
+ /**
826
+ * Whether or not to consult debug symbols to satisfy the request
827
+ * (if present).
828
+ */
829
+ bool debug_syms;
830
+ /**
831
+ * Unused member available for future expansion. Must be initialized
832
+ * to zero.
833
+ */
834
+ uint8_t reserved[7];
835
+ } blaze_symbolize_src_elf;
836
+
837
+ /**
838
+ * The parameters to load symbols and debug information from "raw" Gsym data.
839
+ */
840
+ typedef struct blaze_symbolize_src_gsym_data {
841
+ /**
842
+ * The size of this object's type.
843
+ *
844
+ * Make sure to initialize it to `sizeof(<type>)`. This member is used to
845
+ * ensure compatibility in the presence of member additions.
846
+ */
847
+ size_t type_size;
848
+ /**
849
+ * The Gsym data.
850
+ */
851
+ const uint8_t *data;
852
+ /**
853
+ * The size of the Gsym data.
854
+ */
855
+ size_t data_len;
856
+ } blaze_symbolize_src_gsym_data;
857
+
858
+ /**
859
+ * The parameters to load symbols and debug information from a Gsym file.
860
+ */
861
+ typedef struct blaze_symbolize_src_gsym_file {
862
+ /**
863
+ * The size of this object's type.
864
+ *
865
+ * Make sure to initialize it to `sizeof(<type>)`. This member is used to
866
+ * ensure compatibility in the presence of member additions.
867
+ */
868
+ size_t type_size;
869
+ /**
870
+ * The path to a gsym file.
871
+ */
872
+ const char *path;
873
+ } blaze_symbolize_src_gsym_file;
874
+
875
+ #ifdef __cplusplus
876
+ extern "C" {
877
+ #endif // __cplusplus
878
+
879
+ /**
880
+ * Retrieve the error reported by the last fallible API function invoked.
881
+ */
882
+ enum blaze_err blaze_err_last(void);
883
+
884
+ /**
885
+ * Retrieve a textual representation of the error code.
886
+ */
887
+ const char *blaze_err_str(enum blaze_err err);
888
+
889
+ /**
890
+ * Check whether the `PROCMAP_QUERY` ioctl is supported by the system.
891
+ *
892
+ * This function returns `true` if the system supports the
893
+ * `PROCMAP_QUERY` ioctl and `false` in all other cases, including when
894
+ * an error occurred. Use [`blaze_err_last`] to optionally retrieve
895
+ * this error.
896
+ */
897
+ bool blaze_supports_procmap_query(void);
898
+
899
+ /**
900
+ * Read the build ID of an ELF file located at the given path.
901
+ *
902
+ * Build IDs can have variable length, depending on which flavor is
903
+ * used (e.g., 20 bytes for `sha1` flavor). Build IDs are
904
+ * reported as "raw" bytes. If you need a hexadecimal representation as
905
+ * reported by tools such as `readelf(1)`, a post processing step is
906
+ * necessary.
907
+ *
908
+ * On success and when a build ID present, the function returns a
909
+ * pointer to the "raw" build ID bytes and `len`, if provided, is set
910
+ * to the build ID's length. The resulting buffer should be released
911
+ * using libc's `free` function once it is no longer needed.
912
+ *
913
+ * On error, the function returns `NULL` and sets the thread's last
914
+ * error to indicate the problem encountered. Use [`blaze_err_last`] to
915
+ * retrieve this error.
916
+ *
917
+ * Similarly, if no build ID is present `NULL` is returned and the last
918
+ * error will be set to [`BLAZE_ERR_OK`][blaze_err::BLAZE_ERR_OK].
919
+ *
920
+ * # Safety
921
+ * - `path` needs to be a valid pointer to a NUL terminated string
922
+ */
923
+ uint8_t *blaze_read_elf_build_id(const char *path,
924
+ size_t *len);
925
+
926
+ /**
927
+ * Lookup symbol information in an ELF file.
928
+ *
929
+ * On success, returns an array with `name_cnt` elements. Each such element, in
930
+ * turn, is NULL terminated array comprised of each symbol found. The returned
931
+ * object should be released using [`blaze_inspect_syms_free`] once it is no
932
+ * longer needed.
933
+ *
934
+ * On error, the function returns `NULL` and sets the thread's last error to
935
+ * indicate the problem encountered. Use [`blaze_err_last`] to retrieve this
936
+ * error.
937
+ *
938
+ * # Safety
939
+ * - `inspector` needs to point to an initialized [`blaze_inspector`] object
940
+ * - `src` needs to point to an initialized [`blaze_inspect_syms_elf`] object
941
+ * - `names` needs to be a valid pointer to `name_cnt` NUL terminated strings
942
+ */
943
+ const struct blaze_sym_info *const *blaze_inspect_syms_elf(const blaze_inspector *inspector,
944
+ const struct blaze_inspect_elf_src *src,
945
+ const char *const *names,
946
+ size_t name_cnt);
947
+
948
+ /**
949
+ * Free an array returned by [`blaze_inspect_syms_elf`].
950
+ *
951
+ * # Safety
952
+ *
953
+ * The pointer must be returned by [`blaze_inspect_syms_elf`].
954
+ */
955
+ void blaze_inspect_syms_free(const struct blaze_sym_info *const *syms);
956
+
957
+ /**
958
+ * Create an instance of a blazesym inspector.
959
+ *
960
+ * C ABI compatible version of [`blazesym::inspect::Inspector::new()`].
961
+ * Please refer to its documentation for the default configuration in
962
+ * use.
963
+ *
964
+ * On success, the function creates a new [`blaze_inspector`] object
965
+ * and returns it. The resulting object should be released using
966
+ * [`blaze_inspector_free`] once it is no longer needed.
967
+ *
968
+ * On error, the function returns `NULL` and sets the thread's last error to
969
+ * indicate the problem encountered. Use [`blaze_err_last`] to retrieve this
970
+ * error.
971
+ */
972
+ blaze_inspector *blaze_inspector_new(void);
973
+
974
+ /**
975
+ * Free a blazesym inspector.
976
+ *
977
+ * Release resources associated with a inspector as created by
978
+ * [`blaze_inspector_new`], for example.
979
+ *
980
+ * # Safety
981
+ * The provided inspector should have been created by
982
+ * [`blaze_inspector_new`].
983
+ */
984
+ void blaze_inspector_free(blaze_inspector *inspector);
985
+
986
+ /**
987
+ * Create an instance of a blazesym normalizer in the default
988
+ * configuration.
989
+ *
990
+ * C ABI compatible version of [`blazesym::normalize::Normalizer::new()`].
991
+ * Please refer to its documentation for the default configuration in use.
992
+ *
993
+ * On success, the function creates a new [`blaze_normalizer`] object and
994
+ * returns it. The resulting object should be released using
995
+ * [`blaze_normalizer_free`] once it is no longer needed.
996
+ *
997
+ * On error, the function returns `NULL` and sets the thread's last error to
998
+ * indicate the problem encountered. Use [`blaze_err_last`] to retrieve this
999
+ * error.
1000
+ */
1001
+ blaze_normalizer *blaze_normalizer_new(void);
1002
+
1003
+ /**
1004
+ * Create an instance of a blazesym normalizer.
1005
+ *
1006
+ * On success, the function creates a new [`blaze_normalizer`] object and
1007
+ * returns it. The resulting object should be released using
1008
+ * [`blaze_normalizer_free`] once it is no longer needed.
1009
+ *
1010
+ * On error, the function returns `NULL` and sets the thread's last error to
1011
+ * indicate the problem encountered. Use [`blaze_err_last`] to retrieve this
1012
+ * error.
1013
+ *
1014
+ * # Safety
1015
+ * - `opts` needs to point to a valid [`blaze_normalizer_opts`] object
1016
+ */
1017
+ blaze_normalizer *blaze_normalizer_new_opts(const struct blaze_normalizer_opts *opts);
1018
+
1019
+ /**
1020
+ * Free a blazesym normalizer.
1021
+ *
1022
+ * Release resources associated with a normalizer as created by
1023
+ * [`blaze_normalizer_new`], for example.
1024
+ *
1025
+ * # Safety
1026
+ * The provided normalizer should have been created by
1027
+ * [`blaze_normalizer_new`].
1028
+ */
1029
+ void blaze_normalizer_free(blaze_normalizer *normalizer);
1030
+
1031
+ /**
1032
+ * Retrieve a textual representation of the reason of a normalization failure.
1033
+ */
1034
+ const char *blaze_normalize_reason_str(blaze_normalize_reason err);
1035
+
1036
+ /**
1037
+ * Normalize a list of user space addresses.
1038
+ *
1039
+ * C ABI compatible version of [`Normalizer::normalize_user_addrs`].
1040
+ *
1041
+ * `pid` should describe the PID of the process to which the addresses
1042
+ * belongs. It may be `0` if they belong to the calling process.
1043
+ *
1044
+ * On success, the function creates a new [`blaze_normalized_user_output`]
1045
+ * object and returns it. The resulting object should be released using
1046
+ * [`blaze_user_output_free`] once it is no longer needed.
1047
+ *
1048
+ * On error, the function returns `NULL` and sets the thread's last error to
1049
+ * indicate the problem encountered. Use [`blaze_err_last`] to retrieve this
1050
+ * error.
1051
+ *
1052
+ * # Safety
1053
+ * - `addrs` needs to be a valid pointer to `addr_cnt` addresses
1054
+ */
1055
+ struct blaze_normalized_user_output *blaze_normalize_user_addrs(const blaze_normalizer *normalizer,
1056
+ uint32_t pid,
1057
+ const uint64_t *addrs,
1058
+ size_t addr_cnt);
1059
+
1060
+ /**
1061
+ * Normalize a list of user space addresses.
1062
+ *
1063
+ * C ABI compatible version of [`Normalizer::normalize_user_addrs_opts`].
1064
+ *
1065
+ * `pid` should describe the PID of the process to which the addresses
1066
+ * belongs. It may be `0` if they belong to the calling process.
1067
+ *
1068
+ * `opts` should point to a valid [`blaze_normalize_opts`] object.
1069
+ *
1070
+ * On success, the function creates a new [`blaze_normalized_user_output`]
1071
+ * object and returns it. The resulting object should be released using
1072
+ * [`blaze_user_output_free`] once it is no longer needed.
1073
+ *
1074
+ * On error, the function returns `NULL` and sets the thread's last error to
1075
+ * indicate the problem encountered. Use [`blaze_err_last`] to retrieve this
1076
+ * error.
1077
+ *
1078
+ * # Safety
1079
+ * - `addrs` needs to be a valid pointer to `addr_cnt` addresses
1080
+ */
1081
+ struct blaze_normalized_user_output *blaze_normalize_user_addrs_opts(const blaze_normalizer *normalizer,
1082
+ uint32_t pid,
1083
+ const uint64_t *addrs,
1084
+ size_t addr_cnt,
1085
+ const struct blaze_normalize_opts *opts);
1086
+
1087
+ /**
1088
+ * Free an object as returned by [`blaze_normalize_user_addrs`] or
1089
+ * [`blaze_normalize_user_addrs_opts`].
1090
+ *
1091
+ * # Safety
1092
+ * The provided object should have been created by
1093
+ * [`blaze_normalize_user_addrs`] or
1094
+ * [`blaze_normalize_user_addrs_opts`].
1095
+ */
1096
+ void blaze_user_output_free(struct blaze_normalized_user_output *output);
1097
+
1098
+ /**
1099
+ * Retrieve a textual representation of the reason of a symbolization
1100
+ * failure.
1101
+ */
1102
+ const char *blaze_symbolize_reason_str(blaze_symbolize_reason err);
1103
+
1104
+ /**
1105
+ * Create an instance of a symbolizer.
1106
+ *
1107
+ * C ABI compatible version of [`blazesym::symbolize::Symbolizer::new()`].
1108
+ * Please refer to its documentation for the default configuration in use.
1109
+ *
1110
+ * On success, the function creates a new [`blaze_symbolizer`] object
1111
+ * and returns it. The resulting object should be released using
1112
+ * [`blaze_symbolizer_free`] once it is no longer needed.
1113
+ *
1114
+ * On error, the function returns `NULL` and sets the thread's last error to
1115
+ * indicate the problem encountered. Use [`blaze_err_last`] to retrieve this
1116
+ * error.
1117
+ */
1118
+ blaze_symbolizer *blaze_symbolizer_new(void);
1119
+
1120
+ /**
1121
+ * Create an instance of a symbolizer with configurable options.
1122
+ *
1123
+ * On success, the function creates a new [`blaze_symbolizer`] object
1124
+ * and returns it. The resulting object should be released using
1125
+ * [`blaze_symbolizer_free`] once it is no longer needed.
1126
+ *
1127
+ * On error, the function returns `NULL` and sets the thread's last error to
1128
+ * indicate the problem encountered. Use [`blaze_err_last`] to retrieve this
1129
+ * error.
1130
+ *
1131
+ * # Safety
1132
+ * - `opts` needs to point to a valid [`blaze_symbolizer_opts`] object
1133
+ */
1134
+ blaze_symbolizer *blaze_symbolizer_new_opts(const struct blaze_symbolizer_opts *opts);
1135
+
1136
+ /**
1137
+ * Free an instance of blazesym a symbolizer for C API.
1138
+ *
1139
+ * # Safety
1140
+ *
1141
+ * The pointer must have been returned by [`blaze_symbolizer_new`] or
1142
+ * [`blaze_symbolizer_new_opts`].
1143
+ */
1144
+ void blaze_symbolizer_free(blaze_symbolizer *symbolizer);
1145
+
1146
+ /**
1147
+ * Symbolize a list of process absolute addresses.
1148
+ *
1149
+ * On success, the function returns a [`blaze_syms`] containing an
1150
+ * array of `abs_addr_cnt` [`blaze_sym`] objects. The returned object
1151
+ * should be released using [`blaze_syms_free`] once it is no longer
1152
+ * needed.
1153
+ *
1154
+ * On error, the function returns `NULL` and sets the thread's last error to
1155
+ * indicate the problem encountered. Use [`blaze_err_last`] to retrieve this
1156
+ * error.
1157
+ *
1158
+ * # Safety
1159
+ * - `symbolizer` needs to point to a valid [`blaze_symbolizer`] object
1160
+ * - `src` needs to point to a valid [`blaze_symbolize_src_process`] object
1161
+ * - `abs_addrs` point to an array of `abs_addr_cnt` addresses
1162
+ */
1163
+ const struct blaze_syms *blaze_symbolize_process_abs_addrs(blaze_symbolizer *symbolizer,
1164
+ const struct blaze_symbolize_src_process *src,
1165
+ const uint64_t *abs_addrs,
1166
+ size_t abs_addr_cnt);
1167
+
1168
+ /**
1169
+ * Symbolize a list of kernel absolute addresses.
1170
+ *
1171
+ * On success, the function returns a [`blaze_syms`] containing an
1172
+ * array of `abs_addr_cnt` [`blaze_sym`] objects. The returned object
1173
+ * should be released using [`blaze_syms_free`] once it is no longer
1174
+ * needed.
1175
+ *
1176
+ * On error, the function returns `NULL` and sets the thread's last error to
1177
+ * indicate the problem encountered. Use [`blaze_err_last`] to retrieve this
1178
+ * error.
1179
+ *
1180
+ * # Safety
1181
+ * - `symbolizer` needs to point to a valid [`blaze_symbolizer`] object
1182
+ * - `src` needs to point to a valid [`blaze_symbolize_src_kernel`] object
1183
+ * - `abs_addrs` point to an array of `abs_addr_cnt` addresses
1184
+ */
1185
+ const struct blaze_syms *blaze_symbolize_kernel_abs_addrs(blaze_symbolizer *symbolizer,
1186
+ const struct blaze_symbolize_src_kernel *src,
1187
+ const uint64_t *abs_addrs,
1188
+ size_t abs_addr_cnt);
1189
+
1190
+ /**
1191
+ * Symbolize virtual offsets in an ELF file.
1192
+ *
1193
+ * On success, the function returns a [`blaze_syms`] containing an
1194
+ * array of `virt_offset_cnt` [`blaze_sym`] objects. The returned
1195
+ * object should be released using [`blaze_syms_free`] once it is no
1196
+ * longer needed.
1197
+ *
1198
+ * On error, the function returns `NULL` and sets the thread's last error to
1199
+ * indicate the problem encountered. Use [`blaze_err_last`] to retrieve this
1200
+ * error.
1201
+ *
1202
+ * # Safety
1203
+ * - `symbolizer` needs to point to a valid [`blaze_symbolizer`] object
1204
+ * - `src` needs to point to a valid [`blaze_symbolize_src_elf`] object
1205
+ * - `virt_offsets` point to an array of `virt_offset_cnt` addresses
1206
+ */
1207
+ const struct blaze_syms *blaze_symbolize_elf_virt_offsets(blaze_symbolizer *symbolizer,
1208
+ const struct blaze_symbolize_src_elf *src,
1209
+ const uint64_t *virt_offsets,
1210
+ size_t virt_offset_cnt);
1211
+
1212
+ /**
1213
+ * Symbolize file offsets in an ELF file.
1214
+ *
1215
+ * On success, the function returns a [`blaze_syms`] containing an
1216
+ * array of `file_offset_cnt` [`blaze_sym`] objects. The returned
1217
+ * object should be released using [`blaze_syms_free`] once it is no
1218
+ * longer needed.
1219
+ *
1220
+ * On error, the function returns `NULL` and sets the thread's last error to
1221
+ * indicate the problem encountered. Use [`blaze_err_last`] to retrieve this
1222
+ * error.
1223
+ *
1224
+ * # Safety
1225
+ * - `symbolizer` needs to point to a valid [`blaze_symbolizer`] object
1226
+ * - `src` needs to point to a valid [`blaze_symbolize_src_elf`] object
1227
+ * - `file_offsets` point to an array of `file_offset_cnt` addresses
1228
+ */
1229
+ const struct blaze_syms *blaze_symbolize_elf_file_offsets(blaze_symbolizer *symbolizer,
1230
+ const struct blaze_symbolize_src_elf *src,
1231
+ const uint64_t *file_offsets,
1232
+ size_t file_offset_cnt);
1233
+
1234
+ /**
1235
+ * Symbolize virtual offsets using "raw" Gsym data.
1236
+ *
1237
+ * On success, the function returns a [`blaze_syms`] containing an
1238
+ * array of `virt_offset_cnt` [`blaze_sym`] objects. The returned
1239
+ * object should be released using [`blaze_syms_free`] once it is no
1240
+ * longer needed.
1241
+ *
1242
+ * On error, the function returns `NULL` and sets the thread's last error to
1243
+ * indicate the problem encountered. Use [`blaze_err_last`] to retrieve this
1244
+ * error.
1245
+ *
1246
+ * # Safety
1247
+ * - `symbolizer` needs to point to a valid [`blaze_symbolizer`] object
1248
+ * - `src` needs to point to a valid [`blaze_symbolize_src_gsym_data`] object
1249
+ * - `virt_offsets` point to an array of `virt_offset_cnt` addresses
1250
+ */
1251
+ const struct blaze_syms *blaze_symbolize_gsym_data_virt_offsets(blaze_symbolizer *symbolizer,
1252
+ const struct blaze_symbolize_src_gsym_data *src,
1253
+ const uint64_t *virt_offsets,
1254
+ size_t virt_offset_cnt);
1255
+
1256
+ /**
1257
+ * Symbolize virtual offsets in a Gsym file.
1258
+ *
1259
+ * On success, the function returns a [`blaze_syms`] containing an
1260
+ * array of `virt_offset_cnt` [`blaze_sym`] objects. The returned
1261
+ * object should be released using [`blaze_syms_free`] once it is no
1262
+ * longer needed.
1263
+ *
1264
+ * On error, the function returns `NULL` and sets the thread's last error to
1265
+ * indicate the problem encountered. Use [`blaze_err_last`] to retrieve this
1266
+ * error.
1267
+ *
1268
+ * # Safety
1269
+ * - `symbolizer` needs to point to a valid [`blaze_symbolizer`] object
1270
+ * - `src` needs to point to a valid [`blaze_symbolize_src_gsym_file`] object
1271
+ * - `virt_offsets` point to an array of `virt_offset_cnt` addresses
1272
+ */
1273
+ const struct blaze_syms *blaze_symbolize_gsym_file_virt_offsets(blaze_symbolizer *symbolizer,
1274
+ const struct blaze_symbolize_src_gsym_file *src,
1275
+ const uint64_t *virt_offsets,
1276
+ size_t virt_offset_cnt);
1277
+
1278
+ /**
1279
+ * Free an array returned by any of the `blaze_symbolize_*` variants.
1280
+ *
1281
+ * # Safety
1282
+ * The pointer must have been returned by any of the `blaze_symbolize_*`
1283
+ * variants.
1284
+ */
1285
+ void blaze_syms_free(const struct blaze_syms *syms);
1286
+
1287
+ #ifdef __cplusplus
1288
+ } // extern "C"
1289
+ #endif // __cplusplus
1290
+
1291
+ #endif /* __blazesym_h_ */