libdatadog 6.0.0.2.0-aarch64-linux → 9.0.0.1.0-aarch64-linux

Sign up to get free protection for your applications and to get access to all the features.
Files changed (26) hide show
  1. checksums.yaml +4 -4
  2. data/lib/libdatadog/version.rb +2 -2
  3. data/lib/libdatadog.rb +16 -0
  4. data/vendor/{libdatadog-6.0.0 → libdatadog-9.0.0}/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu/LICENSE-3rdparty.yml +17283 -7448
  5. data/vendor/{libdatadog-6.0.0 → libdatadog-9.0.0}/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu/bin/libdatadog-crashtracking-receiver +0 -0
  6. data/vendor/libdatadog-9.0.0/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu/include/datadog/blazesym.h +895 -0
  7. data/vendor/{libdatadog-6.0.0 → libdatadog-9.0.0}/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu/include/datadog/common.h +369 -42
  8. data/vendor/{libdatadog-6.0.0 → libdatadog-9.0.0}/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu/include/datadog/profiling.h +293 -40
  9. data/vendor/libdatadog-9.0.0/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu/include/datadog/telemetry.h +288 -0
  10. data/vendor/libdatadog-9.0.0/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu/lib/libdatadog_profiling.so +0 -0
  11. data/vendor/{libdatadog-6.0.0 → libdatadog-9.0.0}/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu/lib/pkgconfig/datadog_profiling_with_rpath.pc +2 -4
  12. data/vendor/{libdatadog-6.0.0 → libdatadog-9.0.0}/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl/LICENSE-3rdparty.yml +17283 -7448
  13. data/vendor/{libdatadog-6.0.0 → libdatadog-9.0.0}/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl/bin/libdatadog-crashtracking-receiver +0 -0
  14. data/vendor/libdatadog-9.0.0/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl/include/datadog/blazesym.h +895 -0
  15. data/vendor/{libdatadog-6.0.0 → libdatadog-9.0.0}/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl/include/datadog/common.h +369 -42
  16. data/vendor/{libdatadog-6.0.0 → libdatadog-9.0.0}/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl/include/datadog/profiling.h +293 -40
  17. data/vendor/libdatadog-9.0.0/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl/include/datadog/telemetry.h +288 -0
  18. data/vendor/libdatadog-9.0.0/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl/lib/libdatadog_profiling.so +0 -0
  19. data/vendor/{libdatadog-6.0.0 → libdatadog-9.0.0}/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl/lib/pkgconfig/datadog_profiling_with_rpath.pc +2 -4
  20. metadata +22 -18
  21. data/vendor/libdatadog-6.0.0/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu/lib/libdatadog_profiling.so +0 -0
  22. data/vendor/libdatadog-6.0.0/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl/lib/libdatadog_profiling.so +0 -0
  23. /data/vendor/{libdatadog-6.0.0 → libdatadog-9.0.0}/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu/LICENSE +0 -0
  24. /data/vendor/{libdatadog-6.0.0 → libdatadog-9.0.0}/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu/NOTICE +0 -0
  25. /data/vendor/{libdatadog-6.0.0 → libdatadog-9.0.0}/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl/LICENSE +0 -0
  26. /data/vendor/{libdatadog-6.0.0 → libdatadog-9.0.0}/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl/NOTICE +0 -0
@@ -0,0 +1,895 @@
1
+ // BSD-3-Clause License
2
+ // Synchronized from blazesym repository
3
+ #ifndef __blazesym_h_
4
+ #define __blazesym_h_
5
+
6
+ #include <stdarg.h>
7
+ #include <stdbool.h>
8
+ #include <stddef.h>
9
+ #include <stdint.h>
10
+ #include <stdlib.h>
11
+ /* Helper macro to declare and initialize a blazesym input struct.
12
+ *
13
+ * Inspired by `LIBBPF_OPTS` macro provided by libbpf.
14
+ */
15
+ #define BLAZE_INPUT(TYPE, NAME, ...) \
16
+ struct TYPE NAME = ({ \
17
+ (struct TYPE) { \
18
+ .type_size = sizeof(struct TYPE), \
19
+ __VA_ARGS__ \
20
+ }; \
21
+ })
22
+
23
+
24
+ /**
25
+ * The type of a symbol.
26
+ */
27
+ enum blaze_sym_type
28
+ #ifdef __cplusplus
29
+ : uint8_t
30
+ #endif // __cplusplus
31
+ {
32
+ /**
33
+ * The symbol type is unspecified or unknown.
34
+ *
35
+ * In input contexts this variant can be used to encompass all
36
+ * other variants (functions and variables), whereas in output
37
+ * contexts it means that the type is not known.
38
+ */
39
+ BLAZE_SYM_UNDEF,
40
+ /**
41
+ * The symbol is a function.
42
+ */
43
+ BLAZE_SYM_FUNC,
44
+ /**
45
+ * The symbol is a variable.
46
+ */
47
+ BLAZE_SYM_VAR,
48
+ };
49
+ #ifndef __cplusplus
50
+ typedef uint8_t blaze_sym_type;
51
+ #endif // __cplusplus
52
+
53
+ /**
54
+ * The valid variant kind in [`blaze_user_meta`].
55
+ */
56
+ typedef enum blaze_user_meta_kind {
57
+ /**
58
+ * [`blaze_user_meta_variant::unknown`] is valid.
59
+ */
60
+ BLAZE_USER_META_UNKNOWN,
61
+ /**
62
+ * [`blaze_user_meta_variant::apk`] is valid.
63
+ */
64
+ BLAZE_USER_META_APK,
65
+ /**
66
+ * [`blaze_user_meta_variant::elf`] is valid.
67
+ */
68
+ BLAZE_USER_META_ELF,
69
+ } blaze_user_meta_kind;
70
+
71
+ /**
72
+ * Information about a looked up symbol.
73
+ */
74
+ typedef struct blaze_sym_info {
75
+ /**
76
+ * See [`inspect::SymInfo::name`].
77
+ */
78
+ const char *name;
79
+ /**
80
+ * See [`inspect::SymInfo::addr`].
81
+ */
82
+ uintptr_t addr;
83
+ /**
84
+ * See [`inspect::SymInfo::size`].
85
+ */
86
+ size_t size;
87
+ /**
88
+ * See [`inspect::SymInfo::file_offset`].
89
+ */
90
+ uint64_t file_offset;
91
+ /**
92
+ * See [`inspect::SymInfo::obj_file_name`].
93
+ */
94
+ const char *obj_file_name;
95
+ /**
96
+ * See [`inspect::SymInfo::sym_type`].
97
+ */
98
+ blaze_sym_type sym_type;
99
+ /**
100
+ * Unused member available for future expansion.
101
+ */
102
+ uint8_t reserved[15];
103
+ } blaze_sym_info;
104
+
105
+ /**
106
+ * C ABI compatible version of [`blazesym::inspect::Inspector`].
107
+ */
108
+ typedef struct blaze_inspector blaze_inspector;
109
+
110
+ /**
111
+ * An object representing an ELF inspection source.
112
+ *
113
+ * C ABI compatible version of [`inspect::Elf`].
114
+ */
115
+ typedef struct blaze_inspect_elf_src {
116
+ /**
117
+ * The size of this object's type.
118
+ *
119
+ * Make sure to initialize it to `sizeof(<type>)`. This member is used to
120
+ * ensure compatibility in the presence of member additions.
121
+ */
122
+ size_t type_size;
123
+ /**
124
+ * The path to the ELF file. This member is always present.
125
+ */
126
+ const char *path;
127
+ /**
128
+ * Whether or not to consult debug symbols to satisfy the request
129
+ * (if present).
130
+ */
131
+ bool debug_syms;
132
+ /**
133
+ * Unused member available for future expansion. Must be initialized
134
+ * to zero.
135
+ */
136
+ uint8_t reserved[7];
137
+ } blaze_inspect_elf_src;
138
+
139
+ /**
140
+ * C ABI compatible version of [`blazesym::normalize::Normalizer`].
141
+ */
142
+ typedef struct blaze_normalizer blaze_normalizer;
143
+
144
+ /**
145
+ * Options for configuring [`blaze_normalizer`] objects.
146
+ */
147
+ typedef struct blaze_normalizer_opts {
148
+ /**
149
+ * The size of this object's type.
150
+ *
151
+ * Make sure to initialize it to `sizeof(<type>)`. This member is used to
152
+ * ensure compatibility in the presence of member additions.
153
+ */
154
+ size_t type_size;
155
+ /**
156
+ * Whether to read and report build IDs as part of the normalization
157
+ * process.
158
+ */
159
+ bool build_ids;
160
+ /**
161
+ * Unused member available for future expansion. Must be initialized
162
+ * to zero.
163
+ */
164
+ uint8_t reserved[7];
165
+ } blaze_normalizer_opts;
166
+
167
+ /**
168
+ * C compatible version of [`Apk`].
169
+ */
170
+ typedef struct blaze_user_meta_apk {
171
+ /**
172
+ * The canonical absolute path to the APK, including its name.
173
+ * This member is always present.
174
+ */
175
+ char *path;
176
+ /**
177
+ * Unused member available for future expansion.
178
+ */
179
+ uint8_t reserved[8];
180
+ } blaze_user_meta_apk;
181
+
182
+ /**
183
+ * C compatible version of [`Elf`].
184
+ */
185
+ typedef struct blaze_user_meta_elf {
186
+ /**
187
+ * The path to the ELF file. This member is always present.
188
+ */
189
+ char *path;
190
+ /**
191
+ * The length of the build ID, in bytes.
192
+ */
193
+ size_t build_id_len;
194
+ /**
195
+ * The optional build ID of the ELF file, if found.
196
+ */
197
+ uint8_t *build_id;
198
+ /**
199
+ * Unused member available for future expansion.
200
+ */
201
+ uint8_t reserved[8];
202
+ } blaze_user_meta_elf;
203
+
204
+ /**
205
+ * C compatible version of [`Unknown`].
206
+ */
207
+ typedef struct blaze_user_meta_unknown {
208
+ /**
209
+ * Unused member available for future expansion.
210
+ */
211
+ uint8_t reserved[8];
212
+ } blaze_user_meta_unknown;
213
+
214
+ /**
215
+ * The actual variant data in [`blaze_user_meta`].
216
+ */
217
+ typedef union blaze_user_meta_variant {
218
+ /**
219
+ * Valid on [`blaze_user_meta_kind::BLAZE_USER_META_APK`].
220
+ */
221
+ struct blaze_user_meta_apk apk;
222
+ /**
223
+ * Valid on [`blaze_user_meta_kind::BLAZE_USER_META_ELF`].
224
+ */
225
+ struct blaze_user_meta_elf elf;
226
+ /**
227
+ * Valid on [`blaze_user_meta_kind::BLAZE_USER_META_UNKNOWN`].
228
+ */
229
+ struct blaze_user_meta_unknown unknown;
230
+ } blaze_user_meta_variant;
231
+
232
+ /**
233
+ * C ABI compatible version of [`UserMeta`].
234
+ */
235
+ typedef struct blaze_user_meta {
236
+ /**
237
+ * The variant kind that is present.
238
+ */
239
+ enum blaze_user_meta_kind kind;
240
+ /**
241
+ * The actual variant with its data.
242
+ */
243
+ union blaze_user_meta_variant variant;
244
+ } blaze_user_meta;
245
+
246
+ /**
247
+ * A file offset or non-normalized address along with an index into the
248
+ * associated [`blaze_user_meta`] array (such as
249
+ * [`blaze_normalized_user_output::metas`]).
250
+ */
251
+ typedef struct blaze_normalized_output {
252
+ /**
253
+ * The file offset or non-normalized address.
254
+ */
255
+ uint64_t output;
256
+ /**
257
+ * The index into the associated [`blaze_user_meta`] array.
258
+ */
259
+ size_t meta_idx;
260
+ } blaze_normalized_output;
261
+
262
+ /**
263
+ * An object representing normalized user addresses.
264
+ *
265
+ * C ABI compatible version of [`UserOutput`].
266
+ */
267
+ typedef struct blaze_normalized_user_output {
268
+ /**
269
+ * The number of [`blaze_user_meta`] objects present in `metas`.
270
+ */
271
+ size_t meta_cnt;
272
+ /**
273
+ * An array of `meta_cnt` objects.
274
+ */
275
+ struct blaze_user_meta *metas;
276
+ /**
277
+ * The number of [`blaze_normalized_output`] objects present in `outputs`.
278
+ */
279
+ size_t output_cnt;
280
+ /**
281
+ * An array of `output_cnt` objects.
282
+ */
283
+ struct blaze_normalized_output *outputs;
284
+ /**
285
+ * Unused member available for future expansion.
286
+ */
287
+ uint8_t reserved[8];
288
+ } blaze_normalized_user_output;
289
+
290
+ /**
291
+ * C ABI compatible version of [`blazesym::symbolize::Symbolizer`].
292
+ *
293
+ * It is returned by [`blaze_symbolizer_new`] and should be free by
294
+ * [`blaze_symbolizer_free`].
295
+ */
296
+ typedef struct blaze_symbolizer blaze_symbolizer;
297
+
298
+ /**
299
+ * Options for configuring [`blaze_symbolizer`] objects.
300
+ */
301
+ typedef struct blaze_symbolizer_opts {
302
+ /**
303
+ * The size of this object's type.
304
+ *
305
+ * Make sure to initialize it to `sizeof(<type>)`. This member is used to
306
+ * ensure compatibility in the presence of member additions.
307
+ */
308
+ size_t type_size;
309
+ /**
310
+ * Whether or not to automatically reload file system based
311
+ * symbolization sources that were updated since the last
312
+ * symbolization operation.
313
+ */
314
+ bool auto_reload;
315
+ /**
316
+ * Whether to attempt to gather source code location information.
317
+ *
318
+ * This setting implies `debug_syms` (and forces it to `true`).
319
+ */
320
+ bool code_info;
321
+ /**
322
+ * Whether to report inlined functions as part of symbolization.
323
+ */
324
+ bool inlined_fns;
325
+ /**
326
+ * Whether or not to transparently demangle symbols.
327
+ *
328
+ * Demangling happens on a best-effort basis. Currently supported
329
+ * languages are Rust and C++ and the flag will have no effect if
330
+ * the underlying language does not mangle symbols (such as C).
331
+ */
332
+ bool demangle;
333
+ /**
334
+ * Unused member available for future expansion. Must be initialized
335
+ * to zero.
336
+ */
337
+ uint8_t reserved[4];
338
+ } blaze_symbolizer_opts;
339
+
340
+ /**
341
+ * Source code location information for a symbol or inlined function.
342
+ */
343
+ typedef struct blaze_symbolize_code_info {
344
+ /**
345
+ * The directory in which the source file resides.
346
+ *
347
+ * This attribute is optional and may be NULL.
348
+ */
349
+ const char *dir;
350
+ /**
351
+ * The file that defines the symbol.
352
+ *
353
+ * This attribute is optional and may be NULL.
354
+ */
355
+ const char *file;
356
+ /**
357
+ * The line number on which the symbol is located in the source
358
+ * code.
359
+ */
360
+ uint32_t line;
361
+ /**
362
+ * The column number of the symbolized instruction in the source
363
+ * code.
364
+ */
365
+ uint16_t column;
366
+ /**
367
+ * Unused member available for future expansion.
368
+ */
369
+ uint8_t reserved[10];
370
+ } blaze_symbolize_code_info;
371
+
372
+ /**
373
+ * Data about an inlined function call.
374
+ */
375
+ typedef struct blaze_symbolize_inlined_fn {
376
+ /**
377
+ * The symbol name of the inlined function.
378
+ */
379
+ const char *name;
380
+ /**
381
+ * Source code location information for the inlined function.
382
+ */
383
+ struct blaze_symbolize_code_info code_info;
384
+ /**
385
+ * Unused member available for future expansion.
386
+ */
387
+ uint8_t reserved[8];
388
+ } blaze_symbolize_inlined_fn;
389
+
390
+ /**
391
+ * The result of symbolization of an address.
392
+ *
393
+ * A `blaze_sym` is the information of a symbol found for an
394
+ * address.
395
+ */
396
+ typedef struct blaze_sym {
397
+ /**
398
+ * The symbol name is where the given address should belong to.
399
+ *
400
+ * If an address could not be symbolized, this member will be NULL.
401
+ */
402
+ const char *name;
403
+ /**
404
+ * The address at which the symbol is located (i.e., its "start").
405
+ *
406
+ * This is the "normalized" address of the symbol, as present in
407
+ * the file (and reported by tools such as `readelf(1)`,
408
+ * `llvm-gsymutil`, or similar).
409
+ */
410
+ uintptr_t addr;
411
+ /**
412
+ * The byte offset of the address that got symbolized from the
413
+ * start of the symbol (i.e., from `addr`).
414
+ *
415
+ * E.g., when normalizing address 0x1337 of a function that starts at
416
+ * 0x1330, the offset will be set to 0x07 (and `addr` will be 0x1330). This
417
+ * member is especially useful in contexts when input addresses are not
418
+ * already normalized, such as when normalizing an address in a process
419
+ * context (which may have been relocated and/or have layout randomizations
420
+ * applied).
421
+ */
422
+ size_t offset;
423
+ /**
424
+ * Source code location information for the symbol.
425
+ */
426
+ struct blaze_symbolize_code_info code_info;
427
+ /**
428
+ * The number of symbolized inlined function calls present.
429
+ */
430
+ size_t inlined_cnt;
431
+ /**
432
+ * An array of `inlined_cnt` symbolized inlined function calls.
433
+ */
434
+ const struct blaze_symbolize_inlined_fn *inlined;
435
+ /**
436
+ * Unused member available for future expansion.
437
+ */
438
+ uint8_t reserved[8];
439
+ } blaze_sym;
440
+
441
+ /**
442
+ * `blaze_result` is the result of symbolization for C API.
443
+ *
444
+ * Instances of [`blaze_result`] are returned by any of the `blaze_symbolize_*`
445
+ * variants. They should be freed by calling [`blaze_result_free`].
446
+ */
447
+ typedef struct blaze_result {
448
+ /**
449
+ * The number of symbols being reported.
450
+ */
451
+ size_t cnt;
452
+ /**
453
+ * The symbols corresponding to input addresses.
454
+ *
455
+ * Symbolization happens based on the ordering of (input) addresses.
456
+ * Therefore, every input address has an associated symbol.
457
+ */
458
+ struct blaze_sym syms[0];
459
+ } blaze_result;
460
+
461
+ /**
462
+ * The parameters to load symbols and debug information from a process.
463
+ *
464
+ * Load all ELF files in a process as the sources of symbols and debug
465
+ * information.
466
+ */
467
+ typedef struct blaze_symbolize_src_process {
468
+ /**
469
+ * The size of this object's type.
470
+ *
471
+ * Make sure to initialize it to `sizeof(<type>)`. This member is used to
472
+ * ensure compatibility in the presence of member additions.
473
+ */
474
+ size_t type_size;
475
+ /**
476
+ * It is the PID of a process to symbolize.
477
+ *
478
+ * blazesym will parse `/proc/<pid>/maps` and load all the object
479
+ * files.
480
+ */
481
+ uint32_t pid;
482
+ /**
483
+ * Whether or not to consult debug symbols to satisfy the request
484
+ * (if present).
485
+ */
486
+ bool debug_syms;
487
+ /**
488
+ * Whether to incorporate a process' perf map file into the symbolization
489
+ * procedure.
490
+ */
491
+ bool perf_map;
492
+ /**
493
+ * Whether to work with `/proc/<pid>/map_files/` entries or with
494
+ * symbolic paths mentioned in `/proc/<pid>/maps` instead.
495
+ * `map_files` usage is generally strongly encouraged, as symbolic
496
+ * path usage is unlikely to work reliably in mount namespace
497
+ * contexts or when files have been deleted from the file system.
498
+ * However, by using symbolic paths the need for requiring the
499
+ * `SYS_ADMIN` capability is eliminated.
500
+ */
501
+ bool map_files;
502
+ /**
503
+ * Unused member available for future expansion. Must be initialized
504
+ * to zero.
505
+ */
506
+ uint8_t reserved[1];
507
+ } blaze_symbolize_src_process;
508
+
509
+ /**
510
+ * The parameters to load symbols and debug information from a kernel.
511
+ *
512
+ * Use a kernel image and a snapshot of its kallsyms as a source of symbols and
513
+ * debug information.
514
+ */
515
+ typedef struct blaze_symbolize_src_kernel {
516
+ /**
517
+ * The size of this object's type.
518
+ *
519
+ * Make sure to initialize it to `sizeof(<type>)`. This member is used to
520
+ * ensure compatibility in the presence of member additions.
521
+ */
522
+ size_t type_size;
523
+ /**
524
+ * The path of a copy of kallsyms.
525
+ *
526
+ * It can be `"/proc/kallsyms"` for the running kernel on the
527
+ * device. However, you can make copies for later. In that situation,
528
+ * you should give the path of a copy.
529
+ * Passing a `NULL`, by default, will result in `"/proc/kallsyms"`.
530
+ */
531
+ const char *kallsyms;
532
+ /**
533
+ * The path of a kernel image.
534
+ *
535
+ * The path of a kernel image should be, for instance,
536
+ * `"/boot/vmlinux-xxxx"`. For a `NULL` value, it will locate the
537
+ * kernel image of the running kernel in `"/boot/"` or
538
+ * `"/usr/lib/debug/boot/"`.
539
+ */
540
+ const char *kernel_image;
541
+ /**
542
+ * Whether or not to consult debug symbols from `kernel_image`
543
+ * to satisfy the request (if present).
544
+ */
545
+ bool debug_syms;
546
+ /**
547
+ * Unused member available for future expansion. Must be initialized
548
+ * to zero.
549
+ */
550
+ uint8_t reserved[7];
551
+ } blaze_symbolize_src_kernel;
552
+
553
+ /**
554
+ * The parameters to load symbols and debug information from an ELF.
555
+ *
556
+ * Describes the path and address of an ELF file loaded in a
557
+ * process.
558
+ */
559
+ typedef struct blaze_symbolize_src_elf {
560
+ /**
561
+ * The size of this object's type.
562
+ *
563
+ * Make sure to initialize it to `sizeof(<type>)`. This member is used to
564
+ * ensure compatibility in the presence of member additions.
565
+ */
566
+ size_t type_size;
567
+ /**
568
+ * The path to the ELF file.
569
+ *
570
+ * The referenced file may be an executable or shared object. For example,
571
+ * passing "/bin/sh" will load symbols and debug information from `sh` and
572
+ * passing "/lib/libc.so.xxx" will load symbols and debug information from
573
+ * libc.
574
+ */
575
+ const char *path;
576
+ /**
577
+ * Whether or not to consult debug symbols to satisfy the request
578
+ * (if present).
579
+ */
580
+ bool debug_syms;
581
+ /**
582
+ * Unused member available for future expansion. Must be initialized
583
+ * to zero.
584
+ */
585
+ uint8_t reserved[7];
586
+ } blaze_symbolize_src_elf;
587
+
588
+ /**
589
+ * The parameters to load symbols and debug information from "raw" Gsym data.
590
+ */
591
+ typedef struct blaze_symbolize_src_gsym_data {
592
+ /**
593
+ * The size of this object's type.
594
+ *
595
+ * Make sure to initialize it to `sizeof(<type>)`. This member is used to
596
+ * ensure compatibility in the presence of member additions.
597
+ */
598
+ size_t type_size;
599
+ /**
600
+ * The Gsym data.
601
+ */
602
+ const uint8_t *data;
603
+ /**
604
+ * The size of the Gsym data.
605
+ */
606
+ size_t data_len;
607
+ } blaze_symbolize_src_gsym_data;
608
+
609
+ /**
610
+ * The parameters to load symbols and debug information from a Gsym file.
611
+ */
612
+ typedef struct blaze_symbolize_src_gsym_file {
613
+ /**
614
+ * The size of this object's type.
615
+ *
616
+ * Make sure to initialize it to `sizeof(<type>)`. This member is used to
617
+ * ensure compatibility in the presence of member additions.
618
+ */
619
+ size_t type_size;
620
+ /**
621
+ * The path to a gsym file.
622
+ */
623
+ const char *path;
624
+ } blaze_symbolize_src_gsym_file;
625
+
626
+ #ifdef __cplusplus
627
+ extern "C" {
628
+ #endif // __cplusplus
629
+
630
+ /**
631
+ * Lookup symbol information in an ELF file.
632
+ *
633
+ * Return an array with the same size as the input names. The caller should
634
+ * free the returned array by calling [`blaze_inspect_syms_free`].
635
+ *
636
+ * Every name in the input name list may have more than one address.
637
+ * The respective entry in the returned array is an array containing
638
+ * all addresses and ended with a null (0x0).
639
+ *
640
+ * The returned pointer should be freed by [`blaze_inspect_syms_free`].
641
+ *
642
+ * # Safety
643
+ * The `inspector` object should have been created using
644
+ * [`blaze_inspector_new`], `src` needs to point to a valid object, and `names`
645
+ * needs to be a valid pointer to `name_cnt` strings.
646
+ */
647
+ const struct blaze_sym_info *const *blaze_inspect_syms_elf(const blaze_inspector *inspector,
648
+ const struct blaze_inspect_elf_src *src,
649
+ const char *const *names,
650
+ size_t name_cnt);
651
+
652
+ /**
653
+ * Free an array returned by [`blaze_inspect_syms_elf`].
654
+ *
655
+ * # Safety
656
+ *
657
+ * The pointer must be returned by [`blaze_inspect_syms_elf`].
658
+ */
659
+ void blaze_inspect_syms_free(const struct blaze_sym_info *const *syms);
660
+
661
+ /**
662
+ * Create an instance of a blazesym inspector.
663
+ *
664
+ * The returned pointer should be released using
665
+ * [`blaze_inspector_free`] once it is no longer needed.
666
+ */
667
+ blaze_inspector *blaze_inspector_new(void);
668
+
669
+ /**
670
+ * Free a blazesym inspector.
671
+ *
672
+ * Release resources associated with a inspector as created by
673
+ * [`blaze_inspector_new`], for example.
674
+ *
675
+ * # Safety
676
+ * The provided inspector should have been created by
677
+ * [`blaze_inspector_new`].
678
+ */
679
+ void blaze_inspector_free(blaze_inspector *inspector);
680
+
681
+ /**
682
+ * Create an instance of a blazesym normalizer.
683
+ *
684
+ * The returned pointer should be released using [`blaze_normalizer_free`] once
685
+ * it is no longer needed.
686
+ */
687
+ blaze_normalizer *blaze_normalizer_new(void);
688
+
689
+ /**
690
+ * Create an instance of a blazesym normalizer.
691
+ *
692
+ * The returned pointer should be released using [`blaze_normalizer_free`] once
693
+ * it is no longer needed.
694
+ *
695
+ * # Safety
696
+ * The provided pointer needs to point to a valid [`blaze_normalizer_opts`]
697
+ * instance.
698
+ */
699
+ blaze_normalizer *blaze_normalizer_new_opts(const struct blaze_normalizer_opts *opts);
700
+
701
+ /**
702
+ * Free a blazesym normalizer.
703
+ *
704
+ * Release resources associated with a normalizer as created by
705
+ * [`blaze_normalizer_new`], for example.
706
+ *
707
+ * # Safety
708
+ * The provided normalizer should have been created by
709
+ * [`blaze_normalizer_new`].
710
+ */
711
+ void blaze_normalizer_free(blaze_normalizer *normalizer);
712
+
713
+ /**
714
+ * Normalize a list of user space addresses.
715
+ *
716
+ * Contrary to [`blaze_normalize_user_addrs_sorted`] the provided
717
+ * `addrs` array does not have to be sorted, but otherwise the
718
+ * functions behave identically. If you happen to know that `addrs` is
719
+ * sorted, using [`blaze_normalize_user_addrs_sorted`] instead will
720
+ * result in slightly faster normalization.
721
+ *
722
+ * C ABI compatible version of [`Normalizer::normalize_user_addrs`].
723
+ * Returns `NULL` on error. The resulting object should be freed using
724
+ * [`blaze_user_output_free`].
725
+ *
726
+ * # Safety
727
+ * Callers need to pass in a valid `addrs` pointer, pointing to memory of
728
+ * `addr_cnt` addresses.
729
+ */
730
+ struct blaze_normalized_user_output *blaze_normalize_user_addrs(const blaze_normalizer *normalizer,
731
+ uint32_t pid,
732
+ const uintptr_t *addrs,
733
+ size_t addr_cnt);
734
+
735
+ /**
736
+ * Normalize a list of user space addresses.
737
+ *
738
+ * The `addrs` array has to be sorted in ascending order. By providing
739
+ * a pre-sorted array the library does not have to sort internally,
740
+ * which will result in quicker normalization. If you don't have sorted
741
+ * addresses, use [`blaze_normalize_user_addrs`] instead.
742
+ *
743
+ * `pid` should describe the PID of the process to which the addresses
744
+ * belongs. It may be `0` if they belong to the calling process.
745
+ *
746
+ * C ABI compatible version of [`Normalizer::normalize_user_addrs_sorted`].
747
+ * Returns `NULL` on error. The resulting object should be freed using
748
+ * [`blaze_user_output_free`].
749
+ *
750
+ * # Safety
751
+ * Callers need to pass in a valid `addrs` pointer, pointing to memory of
752
+ * `addr_cnt` addresses.
753
+ */
754
+ struct blaze_normalized_user_output *blaze_normalize_user_addrs_sorted(const blaze_normalizer *normalizer,
755
+ uint32_t pid,
756
+ const uintptr_t *addrs,
757
+ size_t addr_cnt);
758
+
759
+ /**
760
+ * Free an object as returned by [`blaze_normalize_user_addrs`] or
761
+ * [`blaze_normalize_user_addrs_sorted`].
762
+ *
763
+ * # Safety
764
+ * The provided object should have been created by
765
+ * [`blaze_normalize_user_addrs`] or [`blaze_normalize_user_addrs_sorted`].
766
+ */
767
+ void blaze_user_output_free(struct blaze_normalized_user_output *output);
768
+
769
+ /**
770
+ * Create an instance of a symbolizer.
771
+ */
772
+ blaze_symbolizer *blaze_symbolizer_new(void);
773
+
774
+ /**
775
+ * Create an instance of a symbolizer with configurable options.
776
+ *
777
+ * # Safety
778
+ * `opts` needs to be a valid pointer.
779
+ */
780
+ blaze_symbolizer *blaze_symbolizer_new_opts(const struct blaze_symbolizer_opts *opts);
781
+
782
+ /**
783
+ * Free an instance of blazesym a symbolizer for C API.
784
+ *
785
+ * # Safety
786
+ *
787
+ * The pointer must have been returned by [`blaze_symbolizer_new`] or
788
+ * [`blaze_symbolizer_new_opts`].
789
+ */
790
+ void blaze_symbolizer_free(blaze_symbolizer *symbolizer);
791
+
792
+ /**
793
+ * Symbolize a list of process absolute addresses.
794
+ *
795
+ * Return an array of [`blaze_result`] with the same size as the number
796
+ * of input addresses. The caller should free the returned array by
797
+ * calling [`blaze_result_free`].
798
+ *
799
+ * # Safety
800
+ * `symbolizer` must have been allocated using [`blaze_symbolizer_new`] or
801
+ * [`blaze_symbolizer_new_opts`]. `src` must point to a valid
802
+ * [`blaze_symbolize_src_process`] object. `addrs` must represent an array of
803
+ * `addr_cnt` objects.
804
+ */
805
+ const struct blaze_result *blaze_symbolize_process_abs_addrs(blaze_symbolizer *symbolizer,
806
+ const struct blaze_symbolize_src_process *src,
807
+ const uintptr_t *abs_addrs,
808
+ size_t abs_addr_cnt);
809
+
810
+ /**
811
+ * Symbolize a list of kernel absolute addresses.
812
+ *
813
+ * Return an array of [`blaze_result`] with the same size as the number
814
+ * of input addresses. The caller should free the returned array by
815
+ * calling [`blaze_result_free`].
816
+ *
817
+ * # Safety
818
+ * `symbolizer` must have been allocated using [`blaze_symbolizer_new`] or
819
+ * [`blaze_symbolizer_new_opts`]. `src` must point to a valid
820
+ * [`blaze_symbolize_src_kernel`] object. `addrs` must represent an array of
821
+ * `addr_cnt` objects.
822
+ */
823
+ const struct blaze_result *blaze_symbolize_kernel_abs_addrs(blaze_symbolizer *symbolizer,
824
+ const struct blaze_symbolize_src_kernel *src,
825
+ const uintptr_t *abs_addrs,
826
+ size_t abs_addr_cnt);
827
+
828
+ /**
829
+ * Symbolize virtual offsets in an ELF file.
830
+ *
831
+ * Return an array of [`blaze_result`] with the same size as the number
832
+ * of input addresses. The caller should free the returned array by
833
+ * calling [`blaze_result_free`].
834
+ *
835
+ * # Safety
836
+ * `symbolizer` must have been allocated using [`blaze_symbolizer_new`] or
837
+ * [`blaze_symbolizer_new_opts`]. `src` must point to a valid
838
+ * [`blaze_symbolize_src_elf`] object. `addrs` must represent an array of
839
+ * `addr_cnt` objects.
840
+ */
841
+ const struct blaze_result *blaze_symbolize_elf_virt_offsets(blaze_symbolizer *symbolizer,
842
+ const struct blaze_symbolize_src_elf *src,
843
+ const uintptr_t *virt_offsets,
844
+ size_t virt_offset_cnt);
845
+
846
+ /**
847
+ * Symbolize virtual offsets using "raw" Gsym data.
848
+ *
849
+ * Return an array of [`blaze_result`] with the same size as the
850
+ * number of input addresses. The caller should free the returned array by
851
+ * calling [`blaze_result_free`].
852
+ *
853
+ * # Safety
854
+ * `symbolizer` must have been allocated using [`blaze_symbolizer_new`] or
855
+ * [`blaze_symbolizer_new_opts`]. `src` must point to a valid
856
+ * [`blaze_symbolize_src_gsym_data`] object. `addrs` must represent an array of
857
+ * `addr_cnt` objects.
858
+ */
859
+ const struct blaze_result *blaze_symbolize_gsym_data_virt_offsets(blaze_symbolizer *symbolizer,
860
+ const struct blaze_symbolize_src_gsym_data *src,
861
+ const uintptr_t *virt_offsets,
862
+ size_t virt_offset_cnt);
863
+
864
+ /**
865
+ * Symbolize virtual offsets in a Gsym file.
866
+ *
867
+ * Return an array of [`blaze_result`] with the same size as the number
868
+ * of input addresses. The caller should free the returned array by
869
+ * calling [`blaze_result_free`].
870
+ *
871
+ * # Safety
872
+ * `symbolizer` must have been allocated using [`blaze_symbolizer_new`] or
873
+ * [`blaze_symbolizer_new_opts`]. `src` must point to a valid
874
+ * [`blaze_symbolize_src_gsym_file`] object. `addrs` must represent an array of
875
+ * `addr_cnt` objects.
876
+ */
877
+ const struct blaze_result *blaze_symbolize_gsym_file_virt_offsets(blaze_symbolizer *symbolizer,
878
+ const struct blaze_symbolize_src_gsym_file *src,
879
+ const uintptr_t *virt_offsets,
880
+ size_t virt_offset_cnt);
881
+
882
+ /**
883
+ * Free an array returned by any of the `blaze_symbolize_*` variants.
884
+ *
885
+ * # Safety
886
+ * The pointer must have been returned by any of the `blaze_symbolize_*`
887
+ * variants.
888
+ */
889
+ void blaze_result_free(const struct blaze_result *results);
890
+
891
+ #ifdef __cplusplus
892
+ } // extern "C"
893
+ #endif // __cplusplus
894
+
895
+ #endif /* __blazesym_h_ */