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