libdatadog 18.1.0.1.0-x86_64-linux → 19.1.0.1.0-x86_64-linux

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. checksums.yaml +4 -4
  2. data/lib/libdatadog/version.rb +1 -1
  3. data/vendor/{libdatadog-18.1.0 → libdatadog-19.1.0}/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/LICENSE-3rdparty.yml +4544 -1382
  4. data/vendor/{libdatadog-18.1.0 → libdatadog-19.1.0}/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/include/datadog/blazesym.h +435 -229
  5. data/vendor/{libdatadog-18.1.0 → libdatadog-19.1.0}/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/include/datadog/common.h +113 -12
  6. data/vendor/{libdatadog-18.1.0/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl → libdatadog-19.1.0/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu}/include/datadog/crashtracker.h +10 -0
  7. data/vendor/{libdatadog-18.1.0/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl → libdatadog-19.1.0/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu}/include/datadog/data-pipeline.h +16 -1
  8. data/vendor/libdatadog-19.1.0/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/include/datadog/log.h +63 -0
  9. data/vendor/{libdatadog-18.1.0/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl → libdatadog-19.1.0/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu}/include/datadog/profiling.h +1 -1
  10. data/vendor/{libdatadog-18.1.0 → libdatadog-19.1.0}/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/lib/libdatadog_profiling.so +0 -0
  11. data/vendor/{libdatadog-18.1.0 → libdatadog-19.1.0}/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl/LICENSE-3rdparty.yml +4544 -1382
  12. data/vendor/{libdatadog-18.1.0 → libdatadog-19.1.0}/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl/bin/libdatadog-crashtracking-receiver +0 -0
  13. data/vendor/{libdatadog-18.1.0 → libdatadog-19.1.0}/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl/include/datadog/blazesym.h +435 -229
  14. data/vendor/{libdatadog-18.1.0 → libdatadog-19.1.0}/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl/include/datadog/common.h +113 -12
  15. data/vendor/{libdatadog-18.1.0/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu → libdatadog-19.1.0/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl}/include/datadog/crashtracker.h +10 -0
  16. data/vendor/{libdatadog-18.1.0/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu → libdatadog-19.1.0/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl}/include/datadog/data-pipeline.h +16 -1
  17. data/vendor/libdatadog-19.1.0/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl/include/datadog/log.h +63 -0
  18. data/vendor/{libdatadog-18.1.0/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu → libdatadog-19.1.0/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl}/include/datadog/profiling.h +1 -1
  19. data/vendor/{libdatadog-18.1.0 → libdatadog-19.1.0}/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl/lib/libdatadog_profiling.so +0 -0
  20. metadata +29 -27
  21. /data/vendor/{libdatadog-18.1.0 → libdatadog-19.1.0}/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/LICENSE +0 -0
  22. /data/vendor/{libdatadog-18.1.0 → libdatadog-19.1.0}/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/NOTICE +0 -0
  23. /data/vendor/{libdatadog-18.1.0 → libdatadog-19.1.0}/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/bin/libdatadog-crashtracking-receiver +0 -0
  24. /data/vendor/{libdatadog-18.1.0 → libdatadog-19.1.0}/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/include/datadog/library-config.h +0 -0
  25. /data/vendor/{libdatadog-18.1.0 → libdatadog-19.1.0}/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/include/datadog/telemetry.h +0 -0
  26. /data/vendor/{libdatadog-18.1.0 → libdatadog-19.1.0}/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/lib/pkgconfig/datadog_profiling_with_rpath.pc +0 -0
  27. /data/vendor/{libdatadog-18.1.0 → libdatadog-19.1.0}/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl/LICENSE +0 -0
  28. /data/vendor/{libdatadog-18.1.0 → libdatadog-19.1.0}/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl/NOTICE +0 -0
  29. /data/vendor/{libdatadog-18.1.0 → libdatadog-19.1.0}/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl/include/datadog/library-config.h +0 -0
  30. /data/vendor/{libdatadog-18.1.0 → libdatadog-19.1.0}/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl/include/datadog/telemetry.h +0 -0
  31. /data/vendor/{libdatadog-18.1.0 → libdatadog-19.1.0}/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl/lib/pkgconfig/datadog_profiling_with_rpath.pc +0 -0
@@ -1,10 +1,10 @@
1
1
  // BSD-3-Clause License
2
2
  // Synchronized from blazesym repository
3
- // https://github.com/libbpf/blazesym/blob/capi-v0.1.0-rc.2/capi/include/blazesym.h
3
+ // https://github.com/libbpf/blazesym/blob/capi-v0.1.1/capi/include/blazesym.h
4
4
  /*
5
5
  * Please refer to the documentation hosted at
6
6
  *
7
- * https://docs.rs/blazesym-c/0.1.0-rc.2
7
+ * https://docs.rs/blazesym-c/0.1.1
8
8
  */
9
9
 
10
10
 
@@ -22,195 +22,89 @@
22
22
  *
23
23
  * C ABI compatible version of [`blazesym::ErrorKind`].
24
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
-
25
+ typedef int16_t blaze_err;
89
26
  /**
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.
27
+ * The operation was successful.
95
28
  */
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
29
+ #define BLAZE_ERR_OK 0
30
+ /**
31
+ * An entity was not found, often a file.
32
+ */
33
+ #define BLAZE_ERR_NOT_FOUND -2
34
+ /**
35
+ * The operation lacked the necessary privileges to complete.
36
+ */
37
+ #define BLAZE_ERR_PERMISSION_DENIED -1
38
+ /**
39
+ * An entity already exists, often a file.
40
+ */
41
+ #define 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
+ #define BLAZE_ERR_WOULD_BLOCK -11
47
+ /**
48
+ * Data not valid for the operation were encountered.
49
+ */
50
+ #define BLAZE_ERR_INVALID_DATA -22
51
+ /**
52
+ * The I/O operation's timeout expired, causing it to be canceled.
53
+ */
54
+ #define BLAZE_ERR_TIMED_OUT -110
55
+ /**
56
+ * This operation is unsupported on this platform.
57
+ */
58
+ #define BLAZE_ERR_UNSUPPORTED -95
59
+ /**
60
+ * An operation could not be completed, because it failed
61
+ * to allocate enough memory.
62
+ */
63
+ #define BLAZE_ERR_OUT_OF_MEMORY -12
64
+ /**
65
+ * A parameter was incorrect.
66
+ */
67
+ #define 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
+ #define BLAZE_ERR_WRITE_ZERO -257
73
+ /**
74
+ * An error returned when an operation ould not be completed
75
+ * because an "end of file" was reached prematurely.
76
+ */
77
+ #define BLAZE_ERR_UNEXPECTED_EOF -258
78
+ /**
79
+ * DWARF input data was invalid.
80
+ */
81
+ #define BLAZE_ERR_INVALID_DWARF -259
82
+ /**
83
+ * A custom error that does not fall under any other I/O error
84
+ * kind.
85
+ */
86
+ #define BLAZE_ERR_OTHER -260
119
87
 
120
88
  /**
121
89
  * The type of a symbol.
122
90
  */
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
91
  typedef uint8_t blaze_sym_type;
147
- #endif // __cplusplus
148
-
149
92
  /**
150
- * The reason why symbolization failed.
93
+ * The symbol type is unspecified or unknown.
151
94
  *
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.
95
+ * In input contexts this variant can be used to encompass all
96
+ * other variants (functions and variables), whereas in output
97
+ * contexts it means that the type is not known.
155
98
  */
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
-
99
+ #define BLAZE_SYM_TYPE_UNDEF 0
197
100
  /**
198
- * The valid variant kind in [`blaze_user_meta`].
101
+ * The symbol is a function.
199
102
  */
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;
103
+ #define BLAZE_SYM_TYPE_FUNC 1
104
+ /**
105
+ * The symbol is a variable.
106
+ */
107
+ #define BLAZE_SYM_TYPE_VAR 2
214
108
 
215
109
  /**
216
110
  * Information about a looked up symbol.
@@ -226,16 +120,21 @@ typedef struct blaze_sym_info {
226
120
  uint64_t addr;
227
121
  /**
228
122
  * See [`inspect::SymInfo::size`].
123
+ *
124
+ * If the symbol's size is not available, this member will be `-1`.
125
+ * Note that some symbol sources may not distinguish between
126
+ * "unknown" size and `0`. In that case the size will be reported
127
+ * as `0` here as well.
229
128
  */
230
- size_t size;
129
+ ptrdiff_t size;
231
130
  /**
232
131
  * See [`inspect::SymInfo::file_offset`].
233
132
  */
234
133
  uint64_t file_offset;
235
134
  /**
236
- * See [`inspect::SymInfo::obj_file_name`].
135
+ * See [`inspect::SymInfo::module`].
237
136
  */
238
- const char *obj_file_name;
137
+ const char *module;
239
138
  /**
240
139
  * See [`inspect::SymInfo::sym_type`].
241
140
  */
@@ -243,7 +142,7 @@ typedef struct blaze_sym_info {
243
142
  /**
244
143
  * Unused member available for future expansion.
245
144
  */
246
- uint8_t reserved[15];
145
+ uint8_t reserved[23];
247
146
  } blaze_sym_info;
248
147
 
249
148
  /**
@@ -254,7 +153,7 @@ typedef struct blaze_inspector blaze_inspector;
254
153
  /**
255
154
  * An object representing an ELF inspection source.
256
155
  *
257
- * C ABI compatible version of [`inspect::Elf`].
156
+ * C ABI compatible version of [`inspect::source::Elf`].
258
157
  */
259
158
  typedef struct blaze_inspect_elf_src {
260
159
  /**
@@ -277,7 +176,7 @@ typedef struct blaze_inspect_elf_src {
277
176
  * Unused member available for future expansion. Must be initialized
278
177
  * to zero.
279
178
  */
280
- uint8_t reserved[7];
179
+ uint8_t reserved[23];
281
180
  } blaze_inspect_elf_src;
282
181
 
283
182
  /**
@@ -343,9 +242,49 @@ typedef struct blaze_normalizer_opts {
343
242
  * Unused member available for future expansion. Must be initialized
344
243
  * to zero.
345
244
  */
346
- uint8_t reserved[4];
245
+ uint8_t reserved[20];
347
246
  } blaze_normalizer_opts;
348
247
 
248
+ /**
249
+ * The reason why normalization failed.
250
+ *
251
+ * The reason is generally only meant as a hint. Reasons reported may change
252
+ * over time and, hence, should not be relied upon for the correctness of the
253
+ * application.
254
+ */
255
+ typedef uint8_t blaze_normalize_reason;
256
+ /**
257
+ * The absolute address was not found in the corresponding process' virtual
258
+ * memory map.
259
+ */
260
+ #define BLAZE_NORMALIZE_REASON_UNMAPPED 0
261
+ /**
262
+ * The `/proc/<pid>/maps` entry corresponding to the address does not have
263
+ * a component (file system path, object, ...) associated with it.
264
+ */
265
+ #define BLAZE_NORMALIZE_REASON_MISSING_COMPONENT 1
266
+ /**
267
+ * The address belonged to an entity that is currently unsupported.
268
+ */
269
+ #define BLAZE_NORMALIZE_REASON_UNSUPPORTED 2
270
+
271
+ /**
272
+ * The valid variant kind in [`blaze_user_meta`].
273
+ */
274
+ typedef uint8_t blaze_user_meta_kind;
275
+ /**
276
+ * [`blaze_user_meta_variant::unknown`] is valid.
277
+ */
278
+ #define BLAZE_USER_META_KIND_BLAZE_USER_META_UNKNOWN 0
279
+ /**
280
+ * [`blaze_user_meta_variant::apk`] is valid.
281
+ */
282
+ #define BLAZE_USER_META_KIND_BLAZE_USER_META_APK 1
283
+ /**
284
+ * [`blaze_user_meta_variant::elf`] is valid.
285
+ */
286
+ #define BLAZE_USER_META_KIND_BLAZE_USER_META_ELF 2
287
+
349
288
  /**
350
289
  * C compatible version of [`Apk`].
351
290
  */
@@ -358,7 +297,7 @@ typedef struct blaze_user_meta_apk {
358
297
  /**
359
298
  * Unused member available for future expansion.
360
299
  */
361
- uint8_t reserved[8];
300
+ uint8_t reserved[16];
362
301
  } blaze_user_meta_apk;
363
302
 
364
303
  /**
@@ -366,7 +305,13 @@ typedef struct blaze_user_meta_apk {
366
305
  */
367
306
  typedef struct blaze_user_meta_elf {
368
307
  /**
369
- * The path to the ELF file. This member is always present.
308
+ * Ordinarily, the canonical absolute path to the ELF file,
309
+ * including its name. In case of an ELF file contained inside an
310
+ * APK (see [`blaze_normalize_opts::apk_to_elf`]) this will be an
311
+ * Android style path of the form `<apk>!<elf-in-apk>`. E.g.,
312
+ * `/root/test.apk!/lib/libc.so`.
313
+ *
314
+ * This member is always present.
370
315
  */
371
316
  char *path;
372
317
  /**
@@ -380,7 +325,7 @@ typedef struct blaze_user_meta_elf {
380
325
  /**
381
326
  * Unused member available for future expansion.
382
327
  */
383
- uint8_t reserved[8];
328
+ uint8_t reserved[16];
384
329
  } blaze_user_meta_elf;
385
330
 
386
331
  /**
@@ -397,7 +342,7 @@ typedef struct blaze_user_meta_unknown {
397
342
  /**
398
343
  * Unused member available for future expansion.
399
344
  */
400
- uint8_t reserved[7];
345
+ uint8_t reserved[15];
401
346
  } blaze_user_meta_unknown;
402
347
 
403
348
  /**
@@ -425,11 +370,20 @@ typedef struct blaze_user_meta {
425
370
  /**
426
371
  * The variant kind that is present.
427
372
  */
428
- enum blaze_user_meta_kind kind;
373
+ blaze_user_meta_kind kind;
374
+ /**
375
+ * Currently unused bytes.
376
+ */
377
+ uint8_t unused[7];
429
378
  /**
430
379
  * The actual variant with its data.
431
380
  */
432
381
  union blaze_user_meta_variant variant;
382
+ /**
383
+ * Unused member available for future expansion. Must be initialized
384
+ * to zero.
385
+ */
386
+ uint8_t reserved[16];
433
387
  } blaze_user_meta;
434
388
 
435
389
  /**
@@ -446,6 +400,11 @@ typedef struct blaze_normalized_output {
446
400
  * The index into the associated [`blaze_user_meta`] array.
447
401
  */
448
402
  size_t meta_idx;
403
+ /**
404
+ * Unused member available for future expansion. Must be initialized
405
+ * to zero.
406
+ */
407
+ uint8_t reserved[16];
449
408
  } blaze_normalized_output;
450
409
 
451
410
  /**
@@ -473,7 +432,7 @@ typedef struct blaze_normalized_user_output {
473
432
  /**
474
433
  * Unused member available for future expansion.
475
434
  */
476
- uint8_t reserved[8];
435
+ uint8_t reserved[16];
477
436
  } blaze_normalized_user_output;
478
437
 
479
438
  /**
@@ -507,13 +466,63 @@ typedef struct blaze_normalize_opts {
507
466
  * better choice.
508
467
  */
509
468
  bool map_files;
469
+ /**
470
+ * Normalize addresses inside APKs to the contained ELF file and
471
+ * report a regular
472
+ * [`BLAZE_USER_META_ELF`][blaze_user_meta_kind::BLAZE_USER_META_ELF]
473
+ * meta data entry instead of an
474
+ * [`BLAZE_USER_META_APK`][blaze_user_meta_kind::BLAZE_USER_META_APK]
475
+ * one. As a result, the reported file offset will also be relative
476
+ * to the contained ELF file and not to the APK itself.
477
+ */
478
+ bool apk_to_elf;
510
479
  /**
511
480
  * Unused member available for future expansion. Must be initialized
512
481
  * to zero.
513
482
  */
514
- uint8_t reserved[6];
483
+ uint8_t reserved[21];
515
484
  } blaze_normalize_opts;
516
485
 
486
+ /**
487
+ * The reason why symbolization failed.
488
+ *
489
+ * The reason is generally only meant as a hint. Reasons reported may
490
+ * change over time and, hence, should not be relied upon for the
491
+ * correctness of the application.
492
+ */
493
+ typedef uint8_t blaze_symbolize_reason;
494
+ /**
495
+ * Symbolization was successful.
496
+ */
497
+ #define BLAZE_SYMBOLIZE_REASON_SUCCESS 0
498
+ /**
499
+ * The absolute address was not found in the corresponding process'
500
+ * virtual memory map.
501
+ */
502
+ #define BLAZE_SYMBOLIZE_REASON_UNMAPPED 1
503
+ /**
504
+ * The file offset does not map to a valid piece of code/data.
505
+ */
506
+ #define BLAZE_SYMBOLIZE_REASON_INVALID_FILE_OFFSET 2
507
+ /**
508
+ * The `/proc/<pid>/maps` entry corresponding to the address does
509
+ * not have a component (file system path, object, ...) associated
510
+ * with it.
511
+ */
512
+ #define BLAZE_SYMBOLIZE_REASON_MISSING_COMPONENT 3
513
+ /**
514
+ * The symbolization source has no or no relevant symbols.
515
+ */
516
+ #define BLAZE_SYMBOLIZE_REASON_MISSING_SYMS 4
517
+ /**
518
+ * The address could not be found in the symbolization source.
519
+ */
520
+ #define BLAZE_SYMBOLIZE_REASON_UNKNOWN_ADDR 5
521
+ /**
522
+ * The address belonged to an entity that is currently unsupported.
523
+ */
524
+ #define BLAZE_SYMBOLIZE_REASON_UNSUPPORTED 6
525
+
517
526
  /**
518
527
  * C ABI compatible version of [`blazesym::symbolize::Symbolizer`].
519
528
  *
@@ -578,9 +587,74 @@ typedef struct blaze_symbolizer_opts {
578
587
  * Unused member available for future expansion. Must be initialized
579
588
  * to zero.
580
589
  */
581
- uint8_t reserved[4];
590
+ uint8_t reserved[20];
582
591
  } blaze_symbolizer_opts;
583
592
 
593
+ /**
594
+ * Configuration for caching of ELF symbolization data.
595
+ */
596
+ typedef struct blaze_cache_src_elf {
597
+ /**
598
+ * The size of this object's type.
599
+ *
600
+ * Make sure to initialize it to `sizeof(<type>)`. This member is used to
601
+ * ensure compatibility in the presence of member additions.
602
+ */
603
+ size_t type_size;
604
+ /**
605
+ * The path to the ELF file.
606
+ */
607
+ const char *path;
608
+ /**
609
+ * Unused member available for future expansion. Must be initialized
610
+ * to zero.
611
+ */
612
+ uint8_t reserved[16];
613
+ } blaze_cache_src_elf;
614
+
615
+ /**
616
+ * Configuration for caching of process-level data.
617
+ */
618
+ typedef struct blaze_cache_src_process {
619
+ /**
620
+ * The size of this object's type.
621
+ *
622
+ * Make sure to initialize it to `sizeof(<type>)`. This member is used to
623
+ * ensure compatibility in the presence of member additions.
624
+ */
625
+ size_t type_size;
626
+ /**
627
+ * The referenced process' ID.
628
+ */
629
+ uint32_t pid;
630
+ /**
631
+ * Whether to cache the process' VMAs for later use.
632
+ *
633
+ * Caching VMAs can be useful, because it conceptually enables the
634
+ * library to serve a symbolization request targeting a process
635
+ * even if said process has since exited the system.
636
+ *
637
+ * Note that once VMAs have been cached this way, the library will
638
+ * refrain from re-reading updated VMAs unless instructed to.
639
+ * Hence, if you have reason to believe that a process may have
640
+ * changed its memory regions (by loading a new shared object, for
641
+ * example), you would have to make another request to cache them
642
+ * yourself.
643
+ *
644
+ * Note furthermore that if you cache VMAs to later symbolize
645
+ * addresses after the original process has already exited, you
646
+ * will have to opt-out of usage of `/proc/<pid>/map_files/` as
647
+ * part of the symbolization request. Refer to
648
+ * [`blaze_symbolize_src_process::no_map_files`].
649
+ */
650
+ bool cache_vmas;
651
+ /**
652
+ * Unused member available for future expansion. Must be initialized
653
+ * to zero.
654
+ */
655
+ uint8_t reserved[19];
656
+ } blaze_cache_src_process;
657
+
584
658
  /**
585
659
  * Source code location information for a symbol or inlined function.
586
660
  */
@@ -642,8 +716,21 @@ typedef struct blaze_sym {
642
716
  * The symbol name is where the given address should belong to.
643
717
  *
644
718
  * If an address could not be symbolized, this member will be NULL.
719
+ * Check the `reason` member for additional information pertaining
720
+ * the failure.
645
721
  */
646
722
  const char *name;
723
+ /**
724
+ * The path to or name of the module containing the symbol.
725
+ *
726
+ * Typically this would be the path to a executable or shared
727
+ * object. Depending on the symbol source this member may not be
728
+ * present or it could also just be a file name without path. In
729
+ * case of an ELF file contained inside an APK, this will be an
730
+ * Android style path of the form `<apk>!<elf-in-apk>`. E.g.,
731
+ * `/root/test.apk!/lib/libc.so`.
732
+ */
733
+ const char *module;
647
734
  /**
648
735
  * The address at which the symbol is located (i.e., its "start").
649
736
  *
@@ -664,6 +751,15 @@ typedef struct blaze_sym {
664
751
  * applied).
665
752
  */
666
753
  size_t offset;
754
+ /**
755
+ * The size of the symbol.
756
+ *
757
+ * If the symbol's size is not available, this member will be `-1`.
758
+ * Note that some symbol sources may not distinguish between
759
+ * "unknown" size and `0`. In that case the size will be reported
760
+ * as `0` here as well.
761
+ */
762
+ ptrdiff_t size;
667
763
  /**
668
764
  * Source code location information for the symbol.
669
765
  */
@@ -684,7 +780,7 @@ typedef struct blaze_sym {
684
780
  /**
685
781
  * Unused member available for future expansion.
686
782
  */
687
- uint8_t reserved[7];
783
+ uint8_t reserved[15];
688
784
  } blaze_sym;
689
785
 
690
786
  /**
@@ -722,10 +818,7 @@ typedef struct blaze_symbolize_src_process {
722
818
  */
723
819
  size_t type_size;
724
820
  /**
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.
821
+ * The referenced process' ID.
729
822
  */
730
823
  uint32_t pid;
731
824
  /**
@@ -741,25 +834,23 @@ typedef struct blaze_symbolize_src_process {
741
834
  /**
742
835
  * Whether to work with `/proc/<pid>/map_files/` entries or with
743
836
  * 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.
837
+ *
838
+ * `no_map_files` usage is generally discouraged, as symbolic paths
839
+ * are unlikely to work reliably in mount namespace contexts or
840
+ * when files have been deleted from the file system. However, by
841
+ * using symbolic paths (i.e., with `no_map_files` being `true`)
842
+ * the need for requiring the `SYS_ADMIN` capability is eliminated.
749
843
  */
750
- bool map_files;
844
+ bool no_map_files;
751
845
  /**
752
846
  * Unused member available for future expansion. Must be initialized
753
847
  * to zero.
754
848
  */
755
- uint8_t reserved[1];
849
+ uint8_t reserved[17];
756
850
  } blaze_symbolize_src_process;
757
851
 
758
852
  /**
759
853
  * 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
854
  */
764
855
  typedef struct blaze_symbolize_src_kernel {
765
856
  /**
@@ -770,33 +861,45 @@ typedef struct blaze_symbolize_src_kernel {
770
861
  */
771
862
  size_t type_size;
772
863
  /**
773
- * The path of a copy of kallsyms.
864
+ * The path of a `kallsyms` file to use.
865
+ *
866
+ * When `NULL`, this will refer to `kallsyms` of the running kernel.
867
+ * If set to `'\0'` (`""`) usage of `kallsyms` will be disabled.
868
+ * Otherwise the copy at the given path will be used.
774
869
  *
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"`.
870
+ * If both a `vmlinux` as well as a `kallsyms` file are found,
871
+ * `vmlinux` will generally be given preference and `kallsyms` acts
872
+ * as a fallback.
779
873
  */
780
874
  const char *kallsyms;
781
875
  /**
782
- * The path of a kernel image.
876
+ * The path of the `vmlinux` file to use.
783
877
  *
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/"`.
878
+ * `vmlinux` is generally an uncompressed and unstripped object
879
+ * file that is typically used in debugging, profiling, and
880
+ * similar use cases.
881
+ *
882
+ * When `NULL`, the library will search for `vmlinux` candidates in
883
+ * various locations, taking into account the currently running
884
+ * kernel version. If set to `'\0'` (`""`) discovery and usage of a
885
+ * `vmlinux` will be disabled. Otherwise the copy at the given path
886
+ * will be used.
887
+ *
888
+ * If both a `vmlinux` as well as a `kallsyms` file are found,
889
+ * `vmlinux` will generally be given preference and `kallsyms` acts
890
+ * as a fallback.
788
891
  */
789
- const char *kernel_image;
892
+ const char *vmlinux;
790
893
  /**
791
- * Whether or not to consult debug symbols from `kernel_image`
792
- * to satisfy the request (if present).
894
+ * Whether or not to consult debug symbols from `vmlinux` to
895
+ * satisfy the request (if present).
793
896
  */
794
897
  bool debug_syms;
795
898
  /**
796
899
  * Unused member available for future expansion. Must be initialized
797
900
  * to zero.
798
901
  */
799
- uint8_t reserved[7];
902
+ uint8_t reserved[23];
800
903
  } blaze_symbolize_src_kernel;
801
904
 
802
905
  /**
@@ -831,7 +934,7 @@ typedef struct blaze_symbolize_src_elf {
831
934
  * Unused member available for future expansion. Must be initialized
832
935
  * to zero.
833
936
  */
834
- uint8_t reserved[7];
937
+ uint8_t reserved[23];
835
938
  } blaze_symbolize_src_elf;
836
939
 
837
940
  /**
@@ -853,6 +956,11 @@ typedef struct blaze_symbolize_src_gsym_data {
853
956
  * The size of the Gsym data.
854
957
  */
855
958
  size_t data_len;
959
+ /**
960
+ * Unused member available for future expansion. Must be initialized
961
+ * to zero.
962
+ */
963
+ uint8_t reserved[16];
856
964
  } blaze_symbolize_src_gsym_data;
857
965
 
858
966
  /**
@@ -870,8 +978,46 @@ typedef struct blaze_symbolize_src_gsym_file {
870
978
  * The path to a gsym file.
871
979
  */
872
980
  const char *path;
981
+ /**
982
+ * Unused member available for future expansion. Must be initialized
983
+ * to zero.
984
+ */
985
+ uint8_t reserved[16];
873
986
  } blaze_symbolize_src_gsym_file;
874
987
 
988
+ /**
989
+ * The level at which to emit traces.
990
+ */
991
+ typedef uint8_t blaze_trace_lvl;
992
+ /**
993
+ * Emit all trace events.
994
+ *
995
+ * This is the most verbose level and includes all others.
996
+ */
997
+ #define BLAZE_TRACE_LVL_TRACE 0
998
+ /**
999
+ * Emit debug traces and above.
1000
+ *
1001
+ * This level excludes traces emitted with "TRACE" verbosity.
1002
+ */
1003
+ #define BLAZE_TRACE_LVL_DEBUG 1
1004
+ /**
1005
+ * Emit info level traces and above.
1006
+ *
1007
+ * This level excludes traces emitted with "TRACE" or "DEBUG"
1008
+ * verbosity.
1009
+ */
1010
+ #define BLAZE_TRACE_LVL_INFO 2
1011
+ /**
1012
+ * Only emit warnings.
1013
+ */
1014
+ #define BLAZE_TRACE_LVL_WARN 3
1015
+
1016
+ /**
1017
+ * The signature of a callback function as passed to [`blaze_trace`].
1018
+ */
1019
+ typedef void (*blaze_trace_cb)(const char*);
1020
+
875
1021
  #ifdef __cplusplus
876
1022
  extern "C" {
877
1023
  #endif // __cplusplus
@@ -879,12 +1025,12 @@ extern "C" {
879
1025
  /**
880
1026
  * Retrieve the error reported by the last fallible API function invoked.
881
1027
  */
882
- enum blaze_err blaze_err_last(void);
1028
+ blaze_err blaze_err_last(void);
883
1029
 
884
1030
  /**
885
1031
  * Retrieve a textual representation of the error code.
886
1032
  */
887
- const char *blaze_err_str(enum blaze_err err);
1033
+ const char *blaze_err_str(blaze_err err);
888
1034
 
889
1035
  /**
890
1036
  * Check whether the `PROCMAP_QUERY` ioctl is supported by the system.
@@ -915,7 +1061,7 @@ bool blaze_supports_procmap_query(void);
915
1061
  * retrieve this error.
916
1062
  *
917
1063
  * 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].
1064
+ * error will be set to [`blaze_err::OK`].
919
1065
  *
920
1066
  * # Safety
921
1067
  * - `path` needs to be a valid pointer to a NUL terminated string
@@ -1137,12 +1283,52 @@ blaze_symbolizer *blaze_symbolizer_new_opts(const struct blaze_symbolizer_opts *
1137
1283
  * Free an instance of blazesym a symbolizer for C API.
1138
1284
  *
1139
1285
  * # Safety
1140
- *
1141
1286
  * The pointer must have been returned by [`blaze_symbolizer_new`] or
1142
1287
  * [`blaze_symbolizer_new_opts`].
1143
1288
  */
1144
1289
  void blaze_symbolizer_free(blaze_symbolizer *symbolizer);
1145
1290
 
1291
+ /**
1292
+ * Cache an ELF symbolization source.
1293
+ *
1294
+ * Cache symbolization data of an ELF file.
1295
+ *
1296
+ * The function sets the thread's last error to either
1297
+ * [`blaze_err::OK`] to indicate success or a different error code
1298
+ * associated with the problem encountered. Use [`blaze_err_last`] to
1299
+ * retrieve this error.
1300
+ *
1301
+ * # Safety
1302
+ * - `symbolizer` needs to point to a valid [`blaze_symbolizer`] object
1303
+ * - `cache` needs to point to a valid [`blaze_cache_src_process`] object
1304
+ */
1305
+ void blaze_symbolize_cache_elf(blaze_symbolizer *symbolizer,
1306
+ const struct blaze_cache_src_elf *cache);
1307
+
1308
+ /**
1309
+ * Cache VMA meta data associated with a process.
1310
+ *
1311
+ * Cache VMA meta data associated with a process. This will speed up
1312
+ * subsequent symbolization requests while also enabling symbolization
1313
+ * of addresses belonging to processes that exited after being cache
1314
+ * this way.
1315
+ *
1316
+ * If this method fails, any previously cached data is left untouched
1317
+ * and will be used subsequently as if no failure occurred. Put
1318
+ * differently, this method is only effectful on the happy path.
1319
+ *
1320
+ * The function sets the thread's last error to either
1321
+ * [`blaze_err::OK`] to indicate success or a different error code
1322
+ * associated with the problem encountered. Use [`blaze_err_last`] to
1323
+ * retrieve this error.
1324
+ *
1325
+ * # Safety
1326
+ * - `symbolizer` needs to point to a valid [`blaze_symbolizer`] object
1327
+ * - `cache` needs to point to a valid [`blaze_cache_src_process`] object
1328
+ */
1329
+ void blaze_symbolize_cache_process(blaze_symbolizer *symbolizer,
1330
+ const struct blaze_cache_src_process *cache);
1331
+
1146
1332
  /**
1147
1333
  * Symbolize a list of process absolute addresses.
1148
1334
  *
@@ -1284,8 +1470,28 @@ const struct blaze_syms *blaze_symbolize_gsym_file_virt_offsets(blaze_symbolizer
1284
1470
  */
1285
1471
  void blaze_syms_free(const struct blaze_syms *syms);
1286
1472
 
1473
+ /**
1474
+ * Enable the main library's tracing infrastructure and invoke a
1475
+ * callback function for each emitted trace line.
1476
+ *
1477
+ * The provided [`blaze_trace_lvl`] determines what kind of traces are
1478
+ * emitted.
1479
+ *
1480
+ * This function should be invoked at most once. Subsequent invocations
1481
+ * will not affect tracing behavior.
1482
+ *
1483
+ * On error the function sets the thread's last error to indicate the
1484
+ * problem encountered. Use [`blaze_err_last`] to retrieve this error.
1485
+ *
1486
+ * # Notes
1487
+ * - the format of emitted lines is unspecified and subject to change; it is
1488
+ * meant for human consumption and not programmatic evaluation
1489
+ */
1490
+ void blaze_trace(blaze_trace_lvl lvl,
1491
+ blaze_trace_cb cb);
1492
+
1287
1493
  #ifdef __cplusplus
1288
1494
  } // extern "C"
1289
1495
  #endif // __cplusplus
1290
1496
 
1291
- #endif /* __blazesym_h_ */
1497
+ #endif /* __blazesym_h_ */