libdatadog 25.0.0.1.0 → 26.0.0.1.0
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.
- checksums.yaml +4 -4
- data/lib/libdatadog/version.rb +1 -1
- data/lib/libdatadog.rb +6 -0
- data/vendor/{libdatadog-25.0.0/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl → libdatadog-26.0.0/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu}/LICENSE-3rdparty.yml +11292 -5944
- data/vendor/{libdatadog-25.0.0/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl → libdatadog-26.0.0/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu}/include/datadog/common.h +156 -179
- data/vendor/{libdatadog-25.0.0 → libdatadog-26.0.0}/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu/include/datadog/profiling.h +32 -62
- data/vendor/{libdatadog-25.0.0 → libdatadog-26.0.0}/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu/lib/libdatadog_profiling.so +0 -0
- data/vendor/{libdatadog-25.0.0 → libdatadog-26.0.0}/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu/lib/pkgconfig/datadog_profiling_with_rpath.pc +1 -1
- data/vendor/{libdatadog-25.0.0/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu → libdatadog-26.0.0/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl}/LICENSE-3rdparty.yml +11292 -5944
- data/vendor/{libdatadog-25.0.0/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl → libdatadog-26.0.0/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl}/include/datadog/common.h +156 -179
- data/vendor/{libdatadog-25.0.0/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl → libdatadog-26.0.0/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl}/include/datadog/profiling.h +32 -62
- data/vendor/{libdatadog-25.0.0 → libdatadog-26.0.0}/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl/lib/libdatadog_profiling.so +0 -0
- data/vendor/{libdatadog-25.0.0 → libdatadog-26.0.0}/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl/lib/pkgconfig/datadog_profiling_with_rpath.pc +1 -1
- data/vendor/{libdatadog-25.0.0/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu → libdatadog-26.0.0/arm64-darwin/libdatadog-aarch64-apple-darwin}/LICENSE-3rdparty.yml +11292 -5944
- data/vendor/libdatadog-26.0.0/arm64-darwin/libdatadog-aarch64-apple-darwin/bin/libdatadog-crashtracking-receiver +0 -0
- data/vendor/{libdatadog-25.0.0/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu → libdatadog-26.0.0/arm64-darwin/libdatadog-aarch64-apple-darwin}/include/datadog/common.h +156 -179
- data/vendor/{libdatadog-25.0.0/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu → libdatadog-26.0.0/arm64-darwin/libdatadog-aarch64-apple-darwin}/include/datadog/profiling.h +32 -62
- data/vendor/libdatadog-26.0.0/arm64-darwin/libdatadog-aarch64-apple-darwin/lib/libdatadog_profiling.dylib +0 -0
- data/vendor/{libdatadog-25.0.0/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl → libdatadog-26.0.0/arm64-darwin/libdatadog-aarch64-apple-darwin}/lib/pkgconfig/datadog_profiling_with_rpath.pc +1 -1
- data/vendor/libdatadog-26.0.0/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/LICENSE +202 -0
- data/vendor/libdatadog-26.0.0/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/LICENSE-3rdparty.yml +55070 -0
- data/vendor/libdatadog-26.0.0/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/NOTICE +4 -0
- data/vendor/libdatadog-26.0.0/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/include/datadog/blazesym.h +1497 -0
- data/vendor/libdatadog-26.0.0/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/include/datadog/common.h +2651 -0
- data/vendor/libdatadog-26.0.0/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/include/datadog/crashtracker.h +953 -0
- data/vendor/libdatadog-26.0.0/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/include/datadog/data-pipeline.h +183 -0
- data/vendor/libdatadog-26.0.0/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/include/datadog/ddsketch.h +89 -0
- data/vendor/libdatadog-26.0.0/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/include/datadog/ffe.h +175 -0
- data/vendor/libdatadog-26.0.0/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/include/datadog/library-config.h +113 -0
- data/vendor/libdatadog-26.0.0/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/include/datadog/log.h +63 -0
- data/vendor/libdatadog-26.0.0/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/include/datadog/profiling.h +941 -0
- data/vendor/libdatadog-26.0.0/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/include/datadog/telemetry.h +286 -0
- data/vendor/{libdatadog-25.0.0 → libdatadog-26.0.0}/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/lib/libdatadog_profiling.so +0 -0
- data/vendor/libdatadog-26.0.0/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/lib/pkgconfig/datadog_profiling_with_rpath.pc +15 -0
- data/vendor/{libdatadog-25.0.0 → libdatadog-26.0.0}/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl/LICENSE-3rdparty.yml +11292 -5944
- data/vendor/{libdatadog-25.0.0/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu → libdatadog-26.0.0/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl}/include/datadog/common.h +156 -179
- data/vendor/{libdatadog-25.0.0/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl → libdatadog-26.0.0/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl}/include/datadog/profiling.h +32 -62
- data/vendor/{libdatadog-25.0.0 → libdatadog-26.0.0}/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl/lib/libdatadog_profiling.so +0 -0
- data/vendor/{libdatadog-25.0.0/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu → libdatadog-26.0.0/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl}/lib/pkgconfig/datadog_profiling_with_rpath.pc +1 -1
- metadata +81 -65
- /data/vendor/{libdatadog-25.0.0 → libdatadog-26.0.0}/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu/LICENSE +0 -0
- /data/vendor/{libdatadog-25.0.0 → libdatadog-26.0.0}/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu/NOTICE +0 -0
- /data/vendor/{libdatadog-25.0.0 → libdatadog-26.0.0}/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu/bin/libdatadog-crashtracking-receiver +0 -0
- /data/vendor/{libdatadog-25.0.0 → libdatadog-26.0.0}/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu/include/datadog/blazesym.h +0 -0
- /data/vendor/{libdatadog-25.0.0 → libdatadog-26.0.0}/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu/include/datadog/crashtracker.h +0 -0
- /data/vendor/{libdatadog-25.0.0 → libdatadog-26.0.0}/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu/include/datadog/data-pipeline.h +0 -0
- /data/vendor/{libdatadog-25.0.0 → libdatadog-26.0.0}/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu/include/datadog/ddsketch.h +0 -0
- /data/vendor/{libdatadog-25.0.0 → libdatadog-26.0.0}/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu/include/datadog/ffe.h +0 -0
- /data/vendor/{libdatadog-25.0.0 → libdatadog-26.0.0}/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu/include/datadog/library-config.h +0 -0
- /data/vendor/{libdatadog-25.0.0 → libdatadog-26.0.0}/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu/include/datadog/log.h +0 -0
- /data/vendor/{libdatadog-25.0.0 → libdatadog-26.0.0}/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu/include/datadog/telemetry.h +0 -0
- /data/vendor/{libdatadog-25.0.0 → libdatadog-26.0.0}/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl/LICENSE +0 -0
- /data/vendor/{libdatadog-25.0.0 → libdatadog-26.0.0}/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl/NOTICE +0 -0
- /data/vendor/{libdatadog-25.0.0 → libdatadog-26.0.0}/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl/bin/libdatadog-crashtracking-receiver +0 -0
- /data/vendor/{libdatadog-25.0.0 → libdatadog-26.0.0}/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl/include/datadog/blazesym.h +0 -0
- /data/vendor/{libdatadog-25.0.0 → libdatadog-26.0.0}/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl/include/datadog/crashtracker.h +0 -0
- /data/vendor/{libdatadog-25.0.0 → libdatadog-26.0.0}/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl/include/datadog/data-pipeline.h +0 -0
- /data/vendor/{libdatadog-25.0.0 → libdatadog-26.0.0}/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl/include/datadog/ddsketch.h +0 -0
- /data/vendor/{libdatadog-25.0.0 → libdatadog-26.0.0}/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl/include/datadog/ffe.h +0 -0
- /data/vendor/{libdatadog-25.0.0 → libdatadog-26.0.0}/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl/include/datadog/library-config.h +0 -0
- /data/vendor/{libdatadog-25.0.0 → libdatadog-26.0.0}/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl/include/datadog/log.h +0 -0
- /data/vendor/{libdatadog-25.0.0 → libdatadog-26.0.0}/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl/include/datadog/telemetry.h +0 -0
- /data/vendor/{libdatadog-25.0.0/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl → libdatadog-26.0.0/arm64-darwin/libdatadog-aarch64-apple-darwin}/LICENSE +0 -0
- /data/vendor/{libdatadog-25.0.0/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl → libdatadog-26.0.0/arm64-darwin/libdatadog-aarch64-apple-darwin}/NOTICE +0 -0
- /data/vendor/{libdatadog-25.0.0/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl → libdatadog-26.0.0/arm64-darwin/libdatadog-aarch64-apple-darwin}/include/datadog/blazesym.h +0 -0
- /data/vendor/{libdatadog-25.0.0/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl → libdatadog-26.0.0/arm64-darwin/libdatadog-aarch64-apple-darwin}/include/datadog/crashtracker.h +0 -0
- /data/vendor/{libdatadog-25.0.0/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl → libdatadog-26.0.0/arm64-darwin/libdatadog-aarch64-apple-darwin}/include/datadog/data-pipeline.h +0 -0
- /data/vendor/{libdatadog-25.0.0/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl → libdatadog-26.0.0/arm64-darwin/libdatadog-aarch64-apple-darwin}/include/datadog/ddsketch.h +0 -0
- /data/vendor/{libdatadog-25.0.0/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl → libdatadog-26.0.0/arm64-darwin/libdatadog-aarch64-apple-darwin}/include/datadog/ffe.h +0 -0
- /data/vendor/{libdatadog-25.0.0/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl → libdatadog-26.0.0/arm64-darwin/libdatadog-aarch64-apple-darwin}/include/datadog/library-config.h +0 -0
- /data/vendor/{libdatadog-25.0.0/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl → libdatadog-26.0.0/arm64-darwin/libdatadog-aarch64-apple-darwin}/include/datadog/log.h +0 -0
- /data/vendor/{libdatadog-25.0.0/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl → libdatadog-26.0.0/arm64-darwin/libdatadog-aarch64-apple-darwin}/include/datadog/telemetry.h +0 -0
- /data/vendor/{libdatadog-25.0.0 → libdatadog-26.0.0}/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/bin/libdatadog-crashtracking-receiver +0 -0
- /data/vendor/{libdatadog-25.0.0/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu → libdatadog-26.0.0/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl}/LICENSE +0 -0
- /data/vendor/{libdatadog-25.0.0/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu → libdatadog-26.0.0/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl}/NOTICE +0 -0
- /data/vendor/{libdatadog-25.0.0 → libdatadog-26.0.0}/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl/bin/libdatadog-crashtracking-receiver +0 -0
- /data/vendor/{libdatadog-25.0.0/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu → libdatadog-26.0.0/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl}/include/datadog/blazesym.h +0 -0
- /data/vendor/{libdatadog-25.0.0/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu → libdatadog-26.0.0/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl}/include/datadog/crashtracker.h +0 -0
- /data/vendor/{libdatadog-25.0.0/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu → libdatadog-26.0.0/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl}/include/datadog/data-pipeline.h +0 -0
- /data/vendor/{libdatadog-25.0.0/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu → libdatadog-26.0.0/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl}/include/datadog/ddsketch.h +0 -0
- /data/vendor/{libdatadog-25.0.0/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu → libdatadog-26.0.0/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl}/include/datadog/ffe.h +0 -0
- /data/vendor/{libdatadog-25.0.0/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu → libdatadog-26.0.0/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl}/include/datadog/library-config.h +0 -0
- /data/vendor/{libdatadog-25.0.0/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu → libdatadog-26.0.0/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl}/include/datadog/log.h +0 -0
- /data/vendor/{libdatadog-25.0.0/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu → libdatadog-26.0.0/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl}/include/datadog/telemetry.h +0 -0
|
@@ -0,0 +1,1497 @@
|
|
|
1
|
+
// BSD-3-Clause License
|
|
2
|
+
// Synchronized from blazesym repository
|
|
3
|
+
// https://github.com/libbpf/blazesym/blob/capi-v0.1.1/capi/include/blazesym.h
|
|
4
|
+
/*
|
|
5
|
+
* Please refer to the documentation hosted at
|
|
6
|
+
*
|
|
7
|
+
* https://docs.rs/blazesym-c/0.1.1
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
#ifndef __blazesym_h_
|
|
12
|
+
#define __blazesym_h_
|
|
13
|
+
|
|
14
|
+
#include <stdarg.h>
|
|
15
|
+
#include <stdbool.h>
|
|
16
|
+
#include <stddef.h>
|
|
17
|
+
#include <stdint.h>
|
|
18
|
+
#include <stdlib.h>
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* An enum providing a rough classification of errors.
|
|
22
|
+
*
|
|
23
|
+
* C ABI compatible version of [`blazesym::ErrorKind`].
|
|
24
|
+
*/
|
|
25
|
+
typedef int16_t blaze_err;
|
|
26
|
+
/**
|
|
27
|
+
* The operation was successful.
|
|
28
|
+
*/
|
|
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
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* The type of a symbol.
|
|
90
|
+
*/
|
|
91
|
+
typedef uint8_t blaze_sym_type;
|
|
92
|
+
/**
|
|
93
|
+
* The symbol type is unspecified or unknown.
|
|
94
|
+
*
|
|
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.
|
|
98
|
+
*/
|
|
99
|
+
#define BLAZE_SYM_TYPE_UNDEF 0
|
|
100
|
+
/**
|
|
101
|
+
* The symbol is a function.
|
|
102
|
+
*/
|
|
103
|
+
#define BLAZE_SYM_TYPE_FUNC 1
|
|
104
|
+
/**
|
|
105
|
+
* The symbol is a variable.
|
|
106
|
+
*/
|
|
107
|
+
#define BLAZE_SYM_TYPE_VAR 2
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Information about a looked up symbol.
|
|
111
|
+
*/
|
|
112
|
+
typedef struct blaze_sym_info {
|
|
113
|
+
/**
|
|
114
|
+
* See [`inspect::SymInfo::name`].
|
|
115
|
+
*/
|
|
116
|
+
const char *name;
|
|
117
|
+
/**
|
|
118
|
+
* See [`inspect::SymInfo::addr`].
|
|
119
|
+
*/
|
|
120
|
+
uint64_t addr;
|
|
121
|
+
/**
|
|
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.
|
|
128
|
+
*/
|
|
129
|
+
ptrdiff_t size;
|
|
130
|
+
/**
|
|
131
|
+
* See [`inspect::SymInfo::file_offset`].
|
|
132
|
+
*/
|
|
133
|
+
uint64_t file_offset;
|
|
134
|
+
/**
|
|
135
|
+
* See [`inspect::SymInfo::module`].
|
|
136
|
+
*/
|
|
137
|
+
const char *module;
|
|
138
|
+
/**
|
|
139
|
+
* See [`inspect::SymInfo::sym_type`].
|
|
140
|
+
*/
|
|
141
|
+
blaze_sym_type sym_type;
|
|
142
|
+
/**
|
|
143
|
+
* Unused member available for future expansion.
|
|
144
|
+
*/
|
|
145
|
+
uint8_t reserved[23];
|
|
146
|
+
} blaze_sym_info;
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* C ABI compatible version of [`blazesym::inspect::Inspector`].
|
|
150
|
+
*/
|
|
151
|
+
typedef struct blaze_inspector blaze_inspector;
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* An object representing an ELF inspection source.
|
|
155
|
+
*
|
|
156
|
+
* C ABI compatible version of [`inspect::source::Elf`].
|
|
157
|
+
*/
|
|
158
|
+
typedef struct blaze_inspect_elf_src {
|
|
159
|
+
/**
|
|
160
|
+
* The size of this object's type.
|
|
161
|
+
*
|
|
162
|
+
* Make sure to initialize it to `sizeof(<type>)`. This member is used to
|
|
163
|
+
* ensure compatibility in the presence of member additions.
|
|
164
|
+
*/
|
|
165
|
+
size_t type_size;
|
|
166
|
+
/**
|
|
167
|
+
* The path to the ELF file. This member is always present.
|
|
168
|
+
*/
|
|
169
|
+
const char *path;
|
|
170
|
+
/**
|
|
171
|
+
* Whether or not to consult debug symbols to satisfy the request
|
|
172
|
+
* (if present).
|
|
173
|
+
*/
|
|
174
|
+
bool debug_syms;
|
|
175
|
+
/**
|
|
176
|
+
* Unused member available for future expansion. Must be initialized
|
|
177
|
+
* to zero.
|
|
178
|
+
*/
|
|
179
|
+
uint8_t reserved[23];
|
|
180
|
+
} blaze_inspect_elf_src;
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* C ABI compatible version of [`blazesym::normalize::Normalizer`].
|
|
184
|
+
*/
|
|
185
|
+
typedef struct blaze_normalizer blaze_normalizer;
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* Options for configuring [`blaze_normalizer`] objects.
|
|
189
|
+
*/
|
|
190
|
+
typedef struct blaze_normalizer_opts {
|
|
191
|
+
/**
|
|
192
|
+
* The size of this object's type.
|
|
193
|
+
*
|
|
194
|
+
* Make sure to initialize it to `sizeof(<type>)`. This member is used to
|
|
195
|
+
* ensure compatibility in the presence of member additions.
|
|
196
|
+
*/
|
|
197
|
+
size_t type_size;
|
|
198
|
+
/**
|
|
199
|
+
* Whether or not to use the `PROCMAP_QUERY` ioctl instead of
|
|
200
|
+
* parsing `/proc/<pid>/maps` for getting available VMA ranges.
|
|
201
|
+
*
|
|
202
|
+
* Refer to
|
|
203
|
+
* [`blaze_supports_procmap_query`][crate::helper::blaze_supports_procmap_query]
|
|
204
|
+
* as a way to check whether your system supports this
|
|
205
|
+
* functionality.
|
|
206
|
+
*
|
|
207
|
+
* # Notes
|
|
208
|
+
*
|
|
209
|
+
* Support for this ioctl is only present in very recent kernels
|
|
210
|
+
* (likely: 6.11+). See <https://lwn.net/Articles/979931/> for
|
|
211
|
+
* details.
|
|
212
|
+
*
|
|
213
|
+
* Furthermore, the ioctl will also be used for retrieving build
|
|
214
|
+
* IDs (if enabled). Build ID reading logic in the kernel is known
|
|
215
|
+
* to be incomplete, with a fix slated to be included only with
|
|
216
|
+
* 6.12.
|
|
217
|
+
*/
|
|
218
|
+
bool use_procmap_query;
|
|
219
|
+
/**
|
|
220
|
+
* Whether or not to cache `/proc/<pid>/maps` contents.
|
|
221
|
+
*
|
|
222
|
+
* Setting this flag to `true` is not generally recommended, because it
|
|
223
|
+
* could result in addresses corresponding to mappings added after caching
|
|
224
|
+
* may not be normalized successfully, as there is no reasonable way of
|
|
225
|
+
* detecting staleness.
|
|
226
|
+
*/
|
|
227
|
+
bool cache_vmas;
|
|
228
|
+
/**
|
|
229
|
+
* Whether to read and report build IDs as part of the normalization
|
|
230
|
+
* process.
|
|
231
|
+
*
|
|
232
|
+
* Note that build ID read failures will be swallowed without
|
|
233
|
+
* failing the normalization operation.
|
|
234
|
+
*/
|
|
235
|
+
bool build_ids;
|
|
236
|
+
/**
|
|
237
|
+
* Whether or not to cache build IDs. This flag only has an effect
|
|
238
|
+
* if build ID reading is enabled in the first place.
|
|
239
|
+
*/
|
|
240
|
+
bool cache_build_ids;
|
|
241
|
+
/**
|
|
242
|
+
* Unused member available for future expansion. Must be initialized
|
|
243
|
+
* to zero.
|
|
244
|
+
*/
|
|
245
|
+
uint8_t reserved[20];
|
|
246
|
+
} blaze_normalizer_opts;
|
|
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
|
+
|
|
288
|
+
/**
|
|
289
|
+
* C compatible version of [`Apk`].
|
|
290
|
+
*/
|
|
291
|
+
typedef struct blaze_user_meta_apk {
|
|
292
|
+
/**
|
|
293
|
+
* The canonical absolute path to the APK, including its name.
|
|
294
|
+
* This member is always present.
|
|
295
|
+
*/
|
|
296
|
+
char *path;
|
|
297
|
+
/**
|
|
298
|
+
* Unused member available for future expansion.
|
|
299
|
+
*/
|
|
300
|
+
uint8_t reserved[16];
|
|
301
|
+
} blaze_user_meta_apk;
|
|
302
|
+
|
|
303
|
+
/**
|
|
304
|
+
* C compatible version of [`Elf`].
|
|
305
|
+
*/
|
|
306
|
+
typedef struct blaze_user_meta_elf {
|
|
307
|
+
/**
|
|
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.
|
|
315
|
+
*/
|
|
316
|
+
char *path;
|
|
317
|
+
/**
|
|
318
|
+
* The length of the build ID, in bytes.
|
|
319
|
+
*/
|
|
320
|
+
size_t build_id_len;
|
|
321
|
+
/**
|
|
322
|
+
* The optional build ID of the ELF file, if found and readable.
|
|
323
|
+
*/
|
|
324
|
+
uint8_t *build_id;
|
|
325
|
+
/**
|
|
326
|
+
* Unused member available for future expansion.
|
|
327
|
+
*/
|
|
328
|
+
uint8_t reserved[16];
|
|
329
|
+
} blaze_user_meta_elf;
|
|
330
|
+
|
|
331
|
+
/**
|
|
332
|
+
* C compatible version of [`Unknown`].
|
|
333
|
+
*/
|
|
334
|
+
typedef struct blaze_user_meta_unknown {
|
|
335
|
+
/**
|
|
336
|
+
* The reason why normalization failed.
|
|
337
|
+
*
|
|
338
|
+
* The provided reason is a best guess, hinting at what ultimately
|
|
339
|
+
* prevented the normalization from being successful.
|
|
340
|
+
*/
|
|
341
|
+
blaze_normalize_reason reason;
|
|
342
|
+
/**
|
|
343
|
+
* Unused member available for future expansion.
|
|
344
|
+
*/
|
|
345
|
+
uint8_t reserved[15];
|
|
346
|
+
} blaze_user_meta_unknown;
|
|
347
|
+
|
|
348
|
+
/**
|
|
349
|
+
* The actual variant data in [`blaze_user_meta`].
|
|
350
|
+
*/
|
|
351
|
+
typedef union blaze_user_meta_variant {
|
|
352
|
+
/**
|
|
353
|
+
* Valid on [`blaze_user_meta_kind::BLAZE_USER_META_APK`].
|
|
354
|
+
*/
|
|
355
|
+
struct blaze_user_meta_apk apk;
|
|
356
|
+
/**
|
|
357
|
+
* Valid on [`blaze_user_meta_kind::BLAZE_USER_META_ELF`].
|
|
358
|
+
*/
|
|
359
|
+
struct blaze_user_meta_elf elf;
|
|
360
|
+
/**
|
|
361
|
+
* Valid on [`blaze_user_meta_kind::BLAZE_USER_META_UNKNOWN`].
|
|
362
|
+
*/
|
|
363
|
+
struct blaze_user_meta_unknown unknown;
|
|
364
|
+
} blaze_user_meta_variant;
|
|
365
|
+
|
|
366
|
+
/**
|
|
367
|
+
* C ABI compatible version of [`UserMeta`].
|
|
368
|
+
*/
|
|
369
|
+
typedef struct blaze_user_meta {
|
|
370
|
+
/**
|
|
371
|
+
* The variant kind that is present.
|
|
372
|
+
*/
|
|
373
|
+
blaze_user_meta_kind kind;
|
|
374
|
+
/**
|
|
375
|
+
* Currently unused bytes.
|
|
376
|
+
*/
|
|
377
|
+
uint8_t unused[7];
|
|
378
|
+
/**
|
|
379
|
+
* The actual variant with its data.
|
|
380
|
+
*/
|
|
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];
|
|
387
|
+
} blaze_user_meta;
|
|
388
|
+
|
|
389
|
+
/**
|
|
390
|
+
* A file offset or non-normalized address along with an index into the
|
|
391
|
+
* associated [`blaze_user_meta`] array (such as
|
|
392
|
+
* [`blaze_normalized_user_output::metas`]).
|
|
393
|
+
*/
|
|
394
|
+
typedef struct blaze_normalized_output {
|
|
395
|
+
/**
|
|
396
|
+
* The file offset or non-normalized address.
|
|
397
|
+
*/
|
|
398
|
+
uint64_t output;
|
|
399
|
+
/**
|
|
400
|
+
* The index into the associated [`blaze_user_meta`] array.
|
|
401
|
+
*/
|
|
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];
|
|
408
|
+
} blaze_normalized_output;
|
|
409
|
+
|
|
410
|
+
/**
|
|
411
|
+
* An object representing normalized user addresses.
|
|
412
|
+
*
|
|
413
|
+
* C ABI compatible version of [`UserOutput`].
|
|
414
|
+
*/
|
|
415
|
+
typedef struct blaze_normalized_user_output {
|
|
416
|
+
/**
|
|
417
|
+
* The number of [`blaze_user_meta`] objects present in `metas`.
|
|
418
|
+
*/
|
|
419
|
+
size_t meta_cnt;
|
|
420
|
+
/**
|
|
421
|
+
* An array of `meta_cnt` objects.
|
|
422
|
+
*/
|
|
423
|
+
struct blaze_user_meta *metas;
|
|
424
|
+
/**
|
|
425
|
+
* The number of [`blaze_normalized_output`] objects present in `outputs`.
|
|
426
|
+
*/
|
|
427
|
+
size_t output_cnt;
|
|
428
|
+
/**
|
|
429
|
+
* An array of `output_cnt` objects.
|
|
430
|
+
*/
|
|
431
|
+
struct blaze_normalized_output *outputs;
|
|
432
|
+
/**
|
|
433
|
+
* Unused member available for future expansion.
|
|
434
|
+
*/
|
|
435
|
+
uint8_t reserved[16];
|
|
436
|
+
} blaze_normalized_user_output;
|
|
437
|
+
|
|
438
|
+
/**
|
|
439
|
+
* Options influencing the address normalization process.
|
|
440
|
+
*/
|
|
441
|
+
typedef struct blaze_normalize_opts {
|
|
442
|
+
/**
|
|
443
|
+
* The size of this object's type.
|
|
444
|
+
*
|
|
445
|
+
* Make sure to initialize it to `sizeof(<type>)`. This member is used to
|
|
446
|
+
* ensure compatibility in the presence of member additions.
|
|
447
|
+
*/
|
|
448
|
+
size_t type_size;
|
|
449
|
+
/**
|
|
450
|
+
* Whether or not addresses are sorted (in ascending order) already.
|
|
451
|
+
*
|
|
452
|
+
* Normalization always happens on sorted addresses and if the addresses
|
|
453
|
+
* are sorted already, the library does not need to sort and later restore
|
|
454
|
+
* original ordering, speeding up the normalization process.
|
|
455
|
+
*/
|
|
456
|
+
bool sorted_addrs;
|
|
457
|
+
/**
|
|
458
|
+
* Whether to report `/proc/<pid>/map_files/` entry paths or work
|
|
459
|
+
* with symbolic paths mentioned in `/proc/<pid>/maps` instead.
|
|
460
|
+
*
|
|
461
|
+
* Relying on `map_files` may make sense in cases where
|
|
462
|
+
* symbolization happens on the local system and the reported paths
|
|
463
|
+
* can be worked with directly. In most other cases where one wants
|
|
464
|
+
* to attach meaning to symbolic paths on a remote system (e.g., by
|
|
465
|
+
* using them for file look up) symbolic paths are probably the
|
|
466
|
+
* better choice.
|
|
467
|
+
*/
|
|
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;
|
|
479
|
+
/**
|
|
480
|
+
* Unused member available for future expansion. Must be initialized
|
|
481
|
+
* to zero.
|
|
482
|
+
*/
|
|
483
|
+
uint8_t reserved[21];
|
|
484
|
+
} blaze_normalize_opts;
|
|
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
|
+
|
|
526
|
+
/**
|
|
527
|
+
* C ABI compatible version of [`blazesym::symbolize::Symbolizer`].
|
|
528
|
+
*
|
|
529
|
+
* It is returned by [`blaze_symbolizer_new`] and should be free by
|
|
530
|
+
* [`blaze_symbolizer_free`].
|
|
531
|
+
*/
|
|
532
|
+
typedef struct blaze_symbolizer blaze_symbolizer;
|
|
533
|
+
|
|
534
|
+
/**
|
|
535
|
+
* Options for configuring [`blaze_symbolizer`] objects.
|
|
536
|
+
*/
|
|
537
|
+
typedef struct blaze_symbolizer_opts {
|
|
538
|
+
/**
|
|
539
|
+
* The size of this object's type.
|
|
540
|
+
*
|
|
541
|
+
* Make sure to initialize it to `sizeof(<type>)`. This member is used to
|
|
542
|
+
* ensure compatibility in the presence of member additions.
|
|
543
|
+
*/
|
|
544
|
+
size_t type_size;
|
|
545
|
+
/**
|
|
546
|
+
* Array of debug directories to search for split debug information.
|
|
547
|
+
*
|
|
548
|
+
* These directories will be consulted (in given order) when resolving
|
|
549
|
+
* debug links in binaries. By default and when this member is NULL,
|
|
550
|
+
* `/usr/lib/debug` and `/lib/debug/` will be searched. Setting an array
|
|
551
|
+
* here will overwrite these defaults, so make sure to include these
|
|
552
|
+
* directories as desired.
|
|
553
|
+
*
|
|
554
|
+
* Note that the directory containing a symbolization source is always an
|
|
555
|
+
* implicit candidate target directory of the highest precedence.
|
|
556
|
+
*/
|
|
557
|
+
const char *const *debug_dirs;
|
|
558
|
+
/**
|
|
559
|
+
* The number of array elements in `debug_dirs`.
|
|
560
|
+
*/
|
|
561
|
+
size_t debug_dirs_len;
|
|
562
|
+
/**
|
|
563
|
+
* Whether or not to automatically reload file system based
|
|
564
|
+
* symbolization sources that were updated since the last
|
|
565
|
+
* symbolization operation.
|
|
566
|
+
*/
|
|
567
|
+
bool auto_reload;
|
|
568
|
+
/**
|
|
569
|
+
* Whether to attempt to gather source code location information.
|
|
570
|
+
*
|
|
571
|
+
* This setting implies `debug_syms` (and forces it to `true`).
|
|
572
|
+
*/
|
|
573
|
+
bool code_info;
|
|
574
|
+
/**
|
|
575
|
+
* Whether to report inlined functions as part of symbolization.
|
|
576
|
+
*/
|
|
577
|
+
bool inlined_fns;
|
|
578
|
+
/**
|
|
579
|
+
* Whether or not to transparently demangle symbols.
|
|
580
|
+
*
|
|
581
|
+
* Demangling happens on a best-effort basis. Currently supported
|
|
582
|
+
* languages are Rust and C++ and the flag will have no effect if
|
|
583
|
+
* the underlying language does not mangle symbols (such as C).
|
|
584
|
+
*/
|
|
585
|
+
bool demangle;
|
|
586
|
+
/**
|
|
587
|
+
* Unused member available for future expansion. Must be initialized
|
|
588
|
+
* to zero.
|
|
589
|
+
*/
|
|
590
|
+
uint8_t reserved[20];
|
|
591
|
+
} blaze_symbolizer_opts;
|
|
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
|
+
|
|
658
|
+
/**
|
|
659
|
+
* Source code location information for a symbol or inlined function.
|
|
660
|
+
*/
|
|
661
|
+
typedef struct blaze_symbolize_code_info {
|
|
662
|
+
/**
|
|
663
|
+
* The directory in which the source file resides.
|
|
664
|
+
*
|
|
665
|
+
* This attribute is optional and may be NULL.
|
|
666
|
+
*/
|
|
667
|
+
const char *dir;
|
|
668
|
+
/**
|
|
669
|
+
* The file that defines the symbol.
|
|
670
|
+
*
|
|
671
|
+
* This attribute is optional and may be NULL.
|
|
672
|
+
*/
|
|
673
|
+
const char *file;
|
|
674
|
+
/**
|
|
675
|
+
* The line number on which the symbol is located in the source
|
|
676
|
+
* code.
|
|
677
|
+
*/
|
|
678
|
+
uint32_t line;
|
|
679
|
+
/**
|
|
680
|
+
* The column number of the symbolized instruction in the source
|
|
681
|
+
* code.
|
|
682
|
+
*/
|
|
683
|
+
uint16_t column;
|
|
684
|
+
/**
|
|
685
|
+
* Unused member available for future expansion.
|
|
686
|
+
*/
|
|
687
|
+
uint8_t reserved[10];
|
|
688
|
+
} blaze_symbolize_code_info;
|
|
689
|
+
|
|
690
|
+
/**
|
|
691
|
+
* Data about an inlined function call.
|
|
692
|
+
*/
|
|
693
|
+
typedef struct blaze_symbolize_inlined_fn {
|
|
694
|
+
/**
|
|
695
|
+
* The symbol name of the inlined function.
|
|
696
|
+
*/
|
|
697
|
+
const char *name;
|
|
698
|
+
/**
|
|
699
|
+
* Source code location information for the inlined function.
|
|
700
|
+
*/
|
|
701
|
+
struct blaze_symbolize_code_info code_info;
|
|
702
|
+
/**
|
|
703
|
+
* Unused member available for future expansion.
|
|
704
|
+
*/
|
|
705
|
+
uint8_t reserved[8];
|
|
706
|
+
} blaze_symbolize_inlined_fn;
|
|
707
|
+
|
|
708
|
+
/**
|
|
709
|
+
* The result of symbolization of an address.
|
|
710
|
+
*
|
|
711
|
+
* A `blaze_sym` is the information of a symbol found for an
|
|
712
|
+
* address.
|
|
713
|
+
*/
|
|
714
|
+
typedef struct blaze_sym {
|
|
715
|
+
/**
|
|
716
|
+
* The symbol name is where the given address should belong to.
|
|
717
|
+
*
|
|
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.
|
|
721
|
+
*/
|
|
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;
|
|
734
|
+
/**
|
|
735
|
+
* The address at which the symbol is located (i.e., its "start").
|
|
736
|
+
*
|
|
737
|
+
* This is the "normalized" address of the symbol, as present in
|
|
738
|
+
* the file (and reported by tools such as `readelf(1)`,
|
|
739
|
+
* `llvm-gsymutil`, or similar).
|
|
740
|
+
*/
|
|
741
|
+
uint64_t addr;
|
|
742
|
+
/**
|
|
743
|
+
* The byte offset of the address that got symbolized from the
|
|
744
|
+
* start of the symbol (i.e., from `addr`).
|
|
745
|
+
*
|
|
746
|
+
* E.g., when symbolizing address 0x1337 of a function that starts at
|
|
747
|
+
* 0x1330, the offset will be set to 0x07 (and `addr` will be 0x1330). This
|
|
748
|
+
* member is especially useful in contexts when input addresses are not
|
|
749
|
+
* already normalized, such as when symbolizing an address in a process
|
|
750
|
+
* context (which may have been relocated and/or have layout randomizations
|
|
751
|
+
* applied).
|
|
752
|
+
*/
|
|
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;
|
|
763
|
+
/**
|
|
764
|
+
* Source code location information for the symbol.
|
|
765
|
+
*/
|
|
766
|
+
struct blaze_symbolize_code_info code_info;
|
|
767
|
+
/**
|
|
768
|
+
* The number of symbolized inlined function calls present.
|
|
769
|
+
*/
|
|
770
|
+
size_t inlined_cnt;
|
|
771
|
+
/**
|
|
772
|
+
* An array of `inlined_cnt` symbolized inlined function calls.
|
|
773
|
+
*/
|
|
774
|
+
const struct blaze_symbolize_inlined_fn *inlined;
|
|
775
|
+
/**
|
|
776
|
+
* On error (i.e., if `name` is NULL), a reason trying to explain
|
|
777
|
+
* why symbolization failed.
|
|
778
|
+
*/
|
|
779
|
+
blaze_symbolize_reason reason;
|
|
780
|
+
/**
|
|
781
|
+
* Unused member available for future expansion.
|
|
782
|
+
*/
|
|
783
|
+
uint8_t reserved[15];
|
|
784
|
+
} blaze_sym;
|
|
785
|
+
|
|
786
|
+
/**
|
|
787
|
+
* `blaze_syms` is the result of symbolization of a list of addresses.
|
|
788
|
+
*
|
|
789
|
+
* Instances of [`blaze_syms`] are returned by any of the `blaze_symbolize_*`
|
|
790
|
+
* variants. They should be freed by calling [`blaze_syms_free`].
|
|
791
|
+
*/
|
|
792
|
+
typedef struct blaze_syms {
|
|
793
|
+
/**
|
|
794
|
+
* The number of symbols being reported.
|
|
795
|
+
*/
|
|
796
|
+
size_t cnt;
|
|
797
|
+
/**
|
|
798
|
+
* The symbols corresponding to input addresses.
|
|
799
|
+
*
|
|
800
|
+
* Symbolization happens based on the ordering of (input) addresses.
|
|
801
|
+
* Therefore, every input address has an associated symbol.
|
|
802
|
+
*/
|
|
803
|
+
struct blaze_sym syms[0];
|
|
804
|
+
} blaze_syms;
|
|
805
|
+
|
|
806
|
+
/**
|
|
807
|
+
* The parameters to load symbols and debug information from a process.
|
|
808
|
+
*
|
|
809
|
+
* Load all ELF files in a process as the sources of symbols and debug
|
|
810
|
+
* information.
|
|
811
|
+
*/
|
|
812
|
+
typedef struct blaze_symbolize_src_process {
|
|
813
|
+
/**
|
|
814
|
+
* The size of this object's type.
|
|
815
|
+
*
|
|
816
|
+
* Make sure to initialize it to `sizeof(<type>)`. This member is used to
|
|
817
|
+
* ensure compatibility in the presence of member additions.
|
|
818
|
+
*/
|
|
819
|
+
size_t type_size;
|
|
820
|
+
/**
|
|
821
|
+
* The referenced process' ID.
|
|
822
|
+
*/
|
|
823
|
+
uint32_t pid;
|
|
824
|
+
/**
|
|
825
|
+
* Whether or not to consult debug symbols to satisfy the request
|
|
826
|
+
* (if present).
|
|
827
|
+
*/
|
|
828
|
+
bool debug_syms;
|
|
829
|
+
/**
|
|
830
|
+
* Whether to incorporate a process' perf map file into the symbolization
|
|
831
|
+
* procedure.
|
|
832
|
+
*/
|
|
833
|
+
bool perf_map;
|
|
834
|
+
/**
|
|
835
|
+
* Whether to work with `/proc/<pid>/map_files/` entries or with
|
|
836
|
+
* symbolic paths mentioned in `/proc/<pid>/maps` instead.
|
|
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.
|
|
843
|
+
*/
|
|
844
|
+
bool no_map_files;
|
|
845
|
+
/**
|
|
846
|
+
* Unused member available for future expansion. Must be initialized
|
|
847
|
+
* to zero.
|
|
848
|
+
*/
|
|
849
|
+
uint8_t reserved[17];
|
|
850
|
+
} blaze_symbolize_src_process;
|
|
851
|
+
|
|
852
|
+
/**
|
|
853
|
+
* The parameters to load symbols and debug information from a kernel.
|
|
854
|
+
*/
|
|
855
|
+
typedef struct blaze_symbolize_src_kernel {
|
|
856
|
+
/**
|
|
857
|
+
* The size of this object's type.
|
|
858
|
+
*
|
|
859
|
+
* Make sure to initialize it to `sizeof(<type>)`. This member is used to
|
|
860
|
+
* ensure compatibility in the presence of member additions.
|
|
861
|
+
*/
|
|
862
|
+
size_t type_size;
|
|
863
|
+
/**
|
|
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.
|
|
869
|
+
*
|
|
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.
|
|
873
|
+
*/
|
|
874
|
+
const char *kallsyms;
|
|
875
|
+
/**
|
|
876
|
+
* The path of the `vmlinux` file to use.
|
|
877
|
+
*
|
|
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.
|
|
891
|
+
*/
|
|
892
|
+
const char *vmlinux;
|
|
893
|
+
/**
|
|
894
|
+
* Whether or not to consult debug symbols from `vmlinux` to
|
|
895
|
+
* satisfy the request (if present).
|
|
896
|
+
*/
|
|
897
|
+
bool debug_syms;
|
|
898
|
+
/**
|
|
899
|
+
* Unused member available for future expansion. Must be initialized
|
|
900
|
+
* to zero.
|
|
901
|
+
*/
|
|
902
|
+
uint8_t reserved[23];
|
|
903
|
+
} blaze_symbolize_src_kernel;
|
|
904
|
+
|
|
905
|
+
/**
|
|
906
|
+
* The parameters to load symbols and debug information from an ELF.
|
|
907
|
+
*
|
|
908
|
+
* Describes the path and address of an ELF file loaded in a
|
|
909
|
+
* process.
|
|
910
|
+
*/
|
|
911
|
+
typedef struct blaze_symbolize_src_elf {
|
|
912
|
+
/**
|
|
913
|
+
* The size of this object's type.
|
|
914
|
+
*
|
|
915
|
+
* Make sure to initialize it to `sizeof(<type>)`. This member is used to
|
|
916
|
+
* ensure compatibility in the presence of member additions.
|
|
917
|
+
*/
|
|
918
|
+
size_t type_size;
|
|
919
|
+
/**
|
|
920
|
+
* The path to the ELF file.
|
|
921
|
+
*
|
|
922
|
+
* The referenced file may be an executable or shared object. For example,
|
|
923
|
+
* passing "/bin/sh" will load symbols and debug information from `sh` and
|
|
924
|
+
* passing "/lib/libc.so.xxx" will load symbols and debug information from
|
|
925
|
+
* libc.
|
|
926
|
+
*/
|
|
927
|
+
const char *path;
|
|
928
|
+
/**
|
|
929
|
+
* Whether or not to consult debug symbols to satisfy the request
|
|
930
|
+
* (if present).
|
|
931
|
+
*/
|
|
932
|
+
bool debug_syms;
|
|
933
|
+
/**
|
|
934
|
+
* Unused member available for future expansion. Must be initialized
|
|
935
|
+
* to zero.
|
|
936
|
+
*/
|
|
937
|
+
uint8_t reserved[23];
|
|
938
|
+
} blaze_symbolize_src_elf;
|
|
939
|
+
|
|
940
|
+
/**
|
|
941
|
+
* The parameters to load symbols and debug information from "raw" Gsym data.
|
|
942
|
+
*/
|
|
943
|
+
typedef struct blaze_symbolize_src_gsym_data {
|
|
944
|
+
/**
|
|
945
|
+
* The size of this object's type.
|
|
946
|
+
*
|
|
947
|
+
* Make sure to initialize it to `sizeof(<type>)`. This member is used to
|
|
948
|
+
* ensure compatibility in the presence of member additions.
|
|
949
|
+
*/
|
|
950
|
+
size_t type_size;
|
|
951
|
+
/**
|
|
952
|
+
* The Gsym data.
|
|
953
|
+
*/
|
|
954
|
+
const uint8_t *data;
|
|
955
|
+
/**
|
|
956
|
+
* The size of the Gsym data.
|
|
957
|
+
*/
|
|
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];
|
|
964
|
+
} blaze_symbolize_src_gsym_data;
|
|
965
|
+
|
|
966
|
+
/**
|
|
967
|
+
* The parameters to load symbols and debug information from a Gsym file.
|
|
968
|
+
*/
|
|
969
|
+
typedef struct blaze_symbolize_src_gsym_file {
|
|
970
|
+
/**
|
|
971
|
+
* The size of this object's type.
|
|
972
|
+
*
|
|
973
|
+
* Make sure to initialize it to `sizeof(<type>)`. This member is used to
|
|
974
|
+
* ensure compatibility in the presence of member additions.
|
|
975
|
+
*/
|
|
976
|
+
size_t type_size;
|
|
977
|
+
/**
|
|
978
|
+
* The path to a gsym file.
|
|
979
|
+
*/
|
|
980
|
+
const char *path;
|
|
981
|
+
/**
|
|
982
|
+
* Unused member available for future expansion. Must be initialized
|
|
983
|
+
* to zero.
|
|
984
|
+
*/
|
|
985
|
+
uint8_t reserved[16];
|
|
986
|
+
} blaze_symbolize_src_gsym_file;
|
|
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
|
+
|
|
1021
|
+
#ifdef __cplusplus
|
|
1022
|
+
extern "C" {
|
|
1023
|
+
#endif // __cplusplus
|
|
1024
|
+
|
|
1025
|
+
/**
|
|
1026
|
+
* Retrieve the error reported by the last fallible API function invoked.
|
|
1027
|
+
*/
|
|
1028
|
+
blaze_err blaze_err_last(void);
|
|
1029
|
+
|
|
1030
|
+
/**
|
|
1031
|
+
* Retrieve a textual representation of the error code.
|
|
1032
|
+
*/
|
|
1033
|
+
const char *blaze_err_str(blaze_err err);
|
|
1034
|
+
|
|
1035
|
+
/**
|
|
1036
|
+
* Check whether the `PROCMAP_QUERY` ioctl is supported by the system.
|
|
1037
|
+
*
|
|
1038
|
+
* This function returns `true` if the system supports the
|
|
1039
|
+
* `PROCMAP_QUERY` ioctl and `false` in all other cases, including when
|
|
1040
|
+
* an error occurred. Use [`blaze_err_last`] to optionally retrieve
|
|
1041
|
+
* this error.
|
|
1042
|
+
*/
|
|
1043
|
+
bool blaze_supports_procmap_query(void);
|
|
1044
|
+
|
|
1045
|
+
/**
|
|
1046
|
+
* Read the build ID of an ELF file located at the given path.
|
|
1047
|
+
*
|
|
1048
|
+
* Build IDs can have variable length, depending on which flavor is
|
|
1049
|
+
* used (e.g., 20 bytes for `sha1` flavor). Build IDs are
|
|
1050
|
+
* reported as "raw" bytes. If you need a hexadecimal representation as
|
|
1051
|
+
* reported by tools such as `readelf(1)`, a post processing step is
|
|
1052
|
+
* necessary.
|
|
1053
|
+
*
|
|
1054
|
+
* On success and when a build ID present, the function returns a
|
|
1055
|
+
* pointer to the "raw" build ID bytes and `len`, if provided, is set
|
|
1056
|
+
* to the build ID's length. The resulting buffer should be released
|
|
1057
|
+
* using libc's `free` function once it is no longer needed.
|
|
1058
|
+
*
|
|
1059
|
+
* On error, the function returns `NULL` and sets the thread's last
|
|
1060
|
+
* error to indicate the problem encountered. Use [`blaze_err_last`] to
|
|
1061
|
+
* retrieve this error.
|
|
1062
|
+
*
|
|
1063
|
+
* Similarly, if no build ID is present `NULL` is returned and the last
|
|
1064
|
+
* error will be set to [`blaze_err::OK`].
|
|
1065
|
+
*
|
|
1066
|
+
* # Safety
|
|
1067
|
+
* - `path` needs to be a valid pointer to a NUL terminated string
|
|
1068
|
+
*/
|
|
1069
|
+
uint8_t *blaze_read_elf_build_id(const char *path,
|
|
1070
|
+
size_t *len);
|
|
1071
|
+
|
|
1072
|
+
/**
|
|
1073
|
+
* Lookup symbol information in an ELF file.
|
|
1074
|
+
*
|
|
1075
|
+
* On success, returns an array with `name_cnt` elements. Each such element, in
|
|
1076
|
+
* turn, is NULL terminated array comprised of each symbol found. The returned
|
|
1077
|
+
* object should be released using [`blaze_inspect_syms_free`] once it is no
|
|
1078
|
+
* longer needed.
|
|
1079
|
+
*
|
|
1080
|
+
* On error, the function returns `NULL` and sets the thread's last error to
|
|
1081
|
+
* indicate the problem encountered. Use [`blaze_err_last`] to retrieve this
|
|
1082
|
+
* error.
|
|
1083
|
+
*
|
|
1084
|
+
* # Safety
|
|
1085
|
+
* - `inspector` needs to point to an initialized [`blaze_inspector`] object
|
|
1086
|
+
* - `src` needs to point to an initialized [`blaze_inspect_syms_elf`] object
|
|
1087
|
+
* - `names` needs to be a valid pointer to `name_cnt` NUL terminated strings
|
|
1088
|
+
*/
|
|
1089
|
+
const struct blaze_sym_info *const *blaze_inspect_syms_elf(const blaze_inspector *inspector,
|
|
1090
|
+
const struct blaze_inspect_elf_src *src,
|
|
1091
|
+
const char *const *names,
|
|
1092
|
+
size_t name_cnt);
|
|
1093
|
+
|
|
1094
|
+
/**
|
|
1095
|
+
* Free an array returned by [`blaze_inspect_syms_elf`].
|
|
1096
|
+
*
|
|
1097
|
+
* # Safety
|
|
1098
|
+
*
|
|
1099
|
+
* The pointer must be returned by [`blaze_inspect_syms_elf`].
|
|
1100
|
+
*/
|
|
1101
|
+
void blaze_inspect_syms_free(const struct blaze_sym_info *const *syms);
|
|
1102
|
+
|
|
1103
|
+
/**
|
|
1104
|
+
* Create an instance of a blazesym inspector.
|
|
1105
|
+
*
|
|
1106
|
+
* C ABI compatible version of [`blazesym::inspect::Inspector::new()`].
|
|
1107
|
+
* Please refer to its documentation for the default configuration in
|
|
1108
|
+
* use.
|
|
1109
|
+
*
|
|
1110
|
+
* On success, the function creates a new [`blaze_inspector`] object
|
|
1111
|
+
* and returns it. The resulting object should be released using
|
|
1112
|
+
* [`blaze_inspector_free`] once it is no longer needed.
|
|
1113
|
+
*
|
|
1114
|
+
* On error, the function returns `NULL` and sets the thread's last error to
|
|
1115
|
+
* indicate the problem encountered. Use [`blaze_err_last`] to retrieve this
|
|
1116
|
+
* error.
|
|
1117
|
+
*/
|
|
1118
|
+
blaze_inspector *blaze_inspector_new(void);
|
|
1119
|
+
|
|
1120
|
+
/**
|
|
1121
|
+
* Free a blazesym inspector.
|
|
1122
|
+
*
|
|
1123
|
+
* Release resources associated with a inspector as created by
|
|
1124
|
+
* [`blaze_inspector_new`], for example.
|
|
1125
|
+
*
|
|
1126
|
+
* # Safety
|
|
1127
|
+
* The provided inspector should have been created by
|
|
1128
|
+
* [`blaze_inspector_new`].
|
|
1129
|
+
*/
|
|
1130
|
+
void blaze_inspector_free(blaze_inspector *inspector);
|
|
1131
|
+
|
|
1132
|
+
/**
|
|
1133
|
+
* Create an instance of a blazesym normalizer in the default
|
|
1134
|
+
* configuration.
|
|
1135
|
+
*
|
|
1136
|
+
* C ABI compatible version of [`blazesym::normalize::Normalizer::new()`].
|
|
1137
|
+
* Please refer to its documentation for the default configuration in use.
|
|
1138
|
+
*
|
|
1139
|
+
* On success, the function creates a new [`blaze_normalizer`] object and
|
|
1140
|
+
* returns it. The resulting object should be released using
|
|
1141
|
+
* [`blaze_normalizer_free`] once it is no longer needed.
|
|
1142
|
+
*
|
|
1143
|
+
* On error, the function returns `NULL` and sets the thread's last error to
|
|
1144
|
+
* indicate the problem encountered. Use [`blaze_err_last`] to retrieve this
|
|
1145
|
+
* error.
|
|
1146
|
+
*/
|
|
1147
|
+
blaze_normalizer *blaze_normalizer_new(void);
|
|
1148
|
+
|
|
1149
|
+
/**
|
|
1150
|
+
* Create an instance of a blazesym normalizer.
|
|
1151
|
+
*
|
|
1152
|
+
* On success, the function creates a new [`blaze_normalizer`] object and
|
|
1153
|
+
* returns it. The resulting object should be released using
|
|
1154
|
+
* [`blaze_normalizer_free`] once it is no longer needed.
|
|
1155
|
+
*
|
|
1156
|
+
* On error, the function returns `NULL` and sets the thread's last error to
|
|
1157
|
+
* indicate the problem encountered. Use [`blaze_err_last`] to retrieve this
|
|
1158
|
+
* error.
|
|
1159
|
+
*
|
|
1160
|
+
* # Safety
|
|
1161
|
+
* - `opts` needs to point to a valid [`blaze_normalizer_opts`] object
|
|
1162
|
+
*/
|
|
1163
|
+
blaze_normalizer *blaze_normalizer_new_opts(const struct blaze_normalizer_opts *opts);
|
|
1164
|
+
|
|
1165
|
+
/**
|
|
1166
|
+
* Free a blazesym normalizer.
|
|
1167
|
+
*
|
|
1168
|
+
* Release resources associated with a normalizer as created by
|
|
1169
|
+
* [`blaze_normalizer_new`], for example.
|
|
1170
|
+
*
|
|
1171
|
+
* # Safety
|
|
1172
|
+
* The provided normalizer should have been created by
|
|
1173
|
+
* [`blaze_normalizer_new`].
|
|
1174
|
+
*/
|
|
1175
|
+
void blaze_normalizer_free(blaze_normalizer *normalizer);
|
|
1176
|
+
|
|
1177
|
+
/**
|
|
1178
|
+
* Retrieve a textual representation of the reason of a normalization failure.
|
|
1179
|
+
*/
|
|
1180
|
+
const char *blaze_normalize_reason_str(blaze_normalize_reason err);
|
|
1181
|
+
|
|
1182
|
+
/**
|
|
1183
|
+
* Normalize a list of user space addresses.
|
|
1184
|
+
*
|
|
1185
|
+
* C ABI compatible version of [`Normalizer::normalize_user_addrs`].
|
|
1186
|
+
*
|
|
1187
|
+
* `pid` should describe the PID of the process to which the addresses
|
|
1188
|
+
* belongs. It may be `0` if they belong to the calling process.
|
|
1189
|
+
*
|
|
1190
|
+
* On success, the function creates a new [`blaze_normalized_user_output`]
|
|
1191
|
+
* object and returns it. The resulting object should be released using
|
|
1192
|
+
* [`blaze_user_output_free`] once it is no longer needed.
|
|
1193
|
+
*
|
|
1194
|
+
* On error, the function returns `NULL` and sets the thread's last error to
|
|
1195
|
+
* indicate the problem encountered. Use [`blaze_err_last`] to retrieve this
|
|
1196
|
+
* error.
|
|
1197
|
+
*
|
|
1198
|
+
* # Safety
|
|
1199
|
+
* - `addrs` needs to be a valid pointer to `addr_cnt` addresses
|
|
1200
|
+
*/
|
|
1201
|
+
struct blaze_normalized_user_output *blaze_normalize_user_addrs(const blaze_normalizer *normalizer,
|
|
1202
|
+
uint32_t pid,
|
|
1203
|
+
const uint64_t *addrs,
|
|
1204
|
+
size_t addr_cnt);
|
|
1205
|
+
|
|
1206
|
+
/**
|
|
1207
|
+
* Normalize a list of user space addresses.
|
|
1208
|
+
*
|
|
1209
|
+
* C ABI compatible version of [`Normalizer::normalize_user_addrs_opts`].
|
|
1210
|
+
*
|
|
1211
|
+
* `pid` should describe the PID of the process to which the addresses
|
|
1212
|
+
* belongs. It may be `0` if they belong to the calling process.
|
|
1213
|
+
*
|
|
1214
|
+
* `opts` should point to a valid [`blaze_normalize_opts`] object.
|
|
1215
|
+
*
|
|
1216
|
+
* On success, the function creates a new [`blaze_normalized_user_output`]
|
|
1217
|
+
* object and returns it. The resulting object should be released using
|
|
1218
|
+
* [`blaze_user_output_free`] once it is no longer needed.
|
|
1219
|
+
*
|
|
1220
|
+
* On error, the function returns `NULL` and sets the thread's last error to
|
|
1221
|
+
* indicate the problem encountered. Use [`blaze_err_last`] to retrieve this
|
|
1222
|
+
* error.
|
|
1223
|
+
*
|
|
1224
|
+
* # Safety
|
|
1225
|
+
* - `addrs` needs to be a valid pointer to `addr_cnt` addresses
|
|
1226
|
+
*/
|
|
1227
|
+
struct blaze_normalized_user_output *blaze_normalize_user_addrs_opts(const blaze_normalizer *normalizer,
|
|
1228
|
+
uint32_t pid,
|
|
1229
|
+
const uint64_t *addrs,
|
|
1230
|
+
size_t addr_cnt,
|
|
1231
|
+
const struct blaze_normalize_opts *opts);
|
|
1232
|
+
|
|
1233
|
+
/**
|
|
1234
|
+
* Free an object as returned by [`blaze_normalize_user_addrs`] or
|
|
1235
|
+
* [`blaze_normalize_user_addrs_opts`].
|
|
1236
|
+
*
|
|
1237
|
+
* # Safety
|
|
1238
|
+
* The provided object should have been created by
|
|
1239
|
+
* [`blaze_normalize_user_addrs`] or
|
|
1240
|
+
* [`blaze_normalize_user_addrs_opts`].
|
|
1241
|
+
*/
|
|
1242
|
+
void blaze_user_output_free(struct blaze_normalized_user_output *output);
|
|
1243
|
+
|
|
1244
|
+
/**
|
|
1245
|
+
* Retrieve a textual representation of the reason of a symbolization
|
|
1246
|
+
* failure.
|
|
1247
|
+
*/
|
|
1248
|
+
const char *blaze_symbolize_reason_str(blaze_symbolize_reason err);
|
|
1249
|
+
|
|
1250
|
+
/**
|
|
1251
|
+
* Create an instance of a symbolizer.
|
|
1252
|
+
*
|
|
1253
|
+
* C ABI compatible version of [`blazesym::symbolize::Symbolizer::new()`].
|
|
1254
|
+
* Please refer to its documentation for the default configuration in use.
|
|
1255
|
+
*
|
|
1256
|
+
* On success, the function creates a new [`blaze_symbolizer`] object
|
|
1257
|
+
* and returns it. The resulting object should be released using
|
|
1258
|
+
* [`blaze_symbolizer_free`] once it is no longer needed.
|
|
1259
|
+
*
|
|
1260
|
+
* On error, the function returns `NULL` and sets the thread's last error to
|
|
1261
|
+
* indicate the problem encountered. Use [`blaze_err_last`] to retrieve this
|
|
1262
|
+
* error.
|
|
1263
|
+
*/
|
|
1264
|
+
blaze_symbolizer *blaze_symbolizer_new(void);
|
|
1265
|
+
|
|
1266
|
+
/**
|
|
1267
|
+
* Create an instance of a symbolizer with configurable options.
|
|
1268
|
+
*
|
|
1269
|
+
* On success, the function creates a new [`blaze_symbolizer`] object
|
|
1270
|
+
* and returns it. The resulting object should be released using
|
|
1271
|
+
* [`blaze_symbolizer_free`] once it is no longer needed.
|
|
1272
|
+
*
|
|
1273
|
+
* On error, the function returns `NULL` and sets the thread's last error to
|
|
1274
|
+
* indicate the problem encountered. Use [`blaze_err_last`] to retrieve this
|
|
1275
|
+
* error.
|
|
1276
|
+
*
|
|
1277
|
+
* # Safety
|
|
1278
|
+
* - `opts` needs to point to a valid [`blaze_symbolizer_opts`] object
|
|
1279
|
+
*/
|
|
1280
|
+
blaze_symbolizer *blaze_symbolizer_new_opts(const struct blaze_symbolizer_opts *opts);
|
|
1281
|
+
|
|
1282
|
+
/**
|
|
1283
|
+
* Free an instance of blazesym a symbolizer for C API.
|
|
1284
|
+
*
|
|
1285
|
+
* # Safety
|
|
1286
|
+
* The pointer must have been returned by [`blaze_symbolizer_new`] or
|
|
1287
|
+
* [`blaze_symbolizer_new_opts`].
|
|
1288
|
+
*/
|
|
1289
|
+
void blaze_symbolizer_free(blaze_symbolizer *symbolizer);
|
|
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
|
+
|
|
1332
|
+
/**
|
|
1333
|
+
* Symbolize a list of process absolute addresses.
|
|
1334
|
+
*
|
|
1335
|
+
* On success, the function returns a [`blaze_syms`] containing an
|
|
1336
|
+
* array of `abs_addr_cnt` [`blaze_sym`] objects. The returned object
|
|
1337
|
+
* should be released using [`blaze_syms_free`] once it is no longer
|
|
1338
|
+
* needed.
|
|
1339
|
+
*
|
|
1340
|
+
* On error, the function returns `NULL` and sets the thread's last error to
|
|
1341
|
+
* indicate the problem encountered. Use [`blaze_err_last`] to retrieve this
|
|
1342
|
+
* error.
|
|
1343
|
+
*
|
|
1344
|
+
* # Safety
|
|
1345
|
+
* - `symbolizer` needs to point to a valid [`blaze_symbolizer`] object
|
|
1346
|
+
* - `src` needs to point to a valid [`blaze_symbolize_src_process`] object
|
|
1347
|
+
* - `abs_addrs` point to an array of `abs_addr_cnt` addresses
|
|
1348
|
+
*/
|
|
1349
|
+
const struct blaze_syms *blaze_symbolize_process_abs_addrs(blaze_symbolizer *symbolizer,
|
|
1350
|
+
const struct blaze_symbolize_src_process *src,
|
|
1351
|
+
const uint64_t *abs_addrs,
|
|
1352
|
+
size_t abs_addr_cnt);
|
|
1353
|
+
|
|
1354
|
+
/**
|
|
1355
|
+
* Symbolize a list of kernel absolute addresses.
|
|
1356
|
+
*
|
|
1357
|
+
* On success, the function returns a [`blaze_syms`] containing an
|
|
1358
|
+
* array of `abs_addr_cnt` [`blaze_sym`] objects. The returned object
|
|
1359
|
+
* should be released using [`blaze_syms_free`] once it is no longer
|
|
1360
|
+
* needed.
|
|
1361
|
+
*
|
|
1362
|
+
* On error, the function returns `NULL` and sets the thread's last error to
|
|
1363
|
+
* indicate the problem encountered. Use [`blaze_err_last`] to retrieve this
|
|
1364
|
+
* error.
|
|
1365
|
+
*
|
|
1366
|
+
* # Safety
|
|
1367
|
+
* - `symbolizer` needs to point to a valid [`blaze_symbolizer`] object
|
|
1368
|
+
* - `src` needs to point to a valid [`blaze_symbolize_src_kernel`] object
|
|
1369
|
+
* - `abs_addrs` point to an array of `abs_addr_cnt` addresses
|
|
1370
|
+
*/
|
|
1371
|
+
const struct blaze_syms *blaze_symbolize_kernel_abs_addrs(blaze_symbolizer *symbolizer,
|
|
1372
|
+
const struct blaze_symbolize_src_kernel *src,
|
|
1373
|
+
const uint64_t *abs_addrs,
|
|
1374
|
+
size_t abs_addr_cnt);
|
|
1375
|
+
|
|
1376
|
+
/**
|
|
1377
|
+
* Symbolize virtual offsets in an ELF file.
|
|
1378
|
+
*
|
|
1379
|
+
* On success, the function returns a [`blaze_syms`] containing an
|
|
1380
|
+
* array of `virt_offset_cnt` [`blaze_sym`] objects. The returned
|
|
1381
|
+
* object should be released using [`blaze_syms_free`] once it is no
|
|
1382
|
+
* longer needed.
|
|
1383
|
+
*
|
|
1384
|
+
* On error, the function returns `NULL` and sets the thread's last error to
|
|
1385
|
+
* indicate the problem encountered. Use [`blaze_err_last`] to retrieve this
|
|
1386
|
+
* error.
|
|
1387
|
+
*
|
|
1388
|
+
* # Safety
|
|
1389
|
+
* - `symbolizer` needs to point to a valid [`blaze_symbolizer`] object
|
|
1390
|
+
* - `src` needs to point to a valid [`blaze_symbolize_src_elf`] object
|
|
1391
|
+
* - `virt_offsets` point to an array of `virt_offset_cnt` addresses
|
|
1392
|
+
*/
|
|
1393
|
+
const struct blaze_syms *blaze_symbolize_elf_virt_offsets(blaze_symbolizer *symbolizer,
|
|
1394
|
+
const struct blaze_symbolize_src_elf *src,
|
|
1395
|
+
const uint64_t *virt_offsets,
|
|
1396
|
+
size_t virt_offset_cnt);
|
|
1397
|
+
|
|
1398
|
+
/**
|
|
1399
|
+
* Symbolize file offsets in an ELF file.
|
|
1400
|
+
*
|
|
1401
|
+
* On success, the function returns a [`blaze_syms`] containing an
|
|
1402
|
+
* array of `file_offset_cnt` [`blaze_sym`] objects. The returned
|
|
1403
|
+
* object should be released using [`blaze_syms_free`] once it is no
|
|
1404
|
+
* longer needed.
|
|
1405
|
+
*
|
|
1406
|
+
* On error, the function returns `NULL` and sets the thread's last error to
|
|
1407
|
+
* indicate the problem encountered. Use [`blaze_err_last`] to retrieve this
|
|
1408
|
+
* error.
|
|
1409
|
+
*
|
|
1410
|
+
* # Safety
|
|
1411
|
+
* - `symbolizer` needs to point to a valid [`blaze_symbolizer`] object
|
|
1412
|
+
* - `src` needs to point to a valid [`blaze_symbolize_src_elf`] object
|
|
1413
|
+
* - `file_offsets` point to an array of `file_offset_cnt` addresses
|
|
1414
|
+
*/
|
|
1415
|
+
const struct blaze_syms *blaze_symbolize_elf_file_offsets(blaze_symbolizer *symbolizer,
|
|
1416
|
+
const struct blaze_symbolize_src_elf *src,
|
|
1417
|
+
const uint64_t *file_offsets,
|
|
1418
|
+
size_t file_offset_cnt);
|
|
1419
|
+
|
|
1420
|
+
/**
|
|
1421
|
+
* Symbolize virtual offsets using "raw" Gsym data.
|
|
1422
|
+
*
|
|
1423
|
+
* On success, the function returns a [`blaze_syms`] containing an
|
|
1424
|
+
* array of `virt_offset_cnt` [`blaze_sym`] objects. The returned
|
|
1425
|
+
* object should be released using [`blaze_syms_free`] once it is no
|
|
1426
|
+
* longer needed.
|
|
1427
|
+
*
|
|
1428
|
+
* On error, the function returns `NULL` and sets the thread's last error to
|
|
1429
|
+
* indicate the problem encountered. Use [`blaze_err_last`] to retrieve this
|
|
1430
|
+
* error.
|
|
1431
|
+
*
|
|
1432
|
+
* # Safety
|
|
1433
|
+
* - `symbolizer` needs to point to a valid [`blaze_symbolizer`] object
|
|
1434
|
+
* - `src` needs to point to a valid [`blaze_symbolize_src_gsym_data`] object
|
|
1435
|
+
* - `virt_offsets` point to an array of `virt_offset_cnt` addresses
|
|
1436
|
+
*/
|
|
1437
|
+
const struct blaze_syms *blaze_symbolize_gsym_data_virt_offsets(blaze_symbolizer *symbolizer,
|
|
1438
|
+
const struct blaze_symbolize_src_gsym_data *src,
|
|
1439
|
+
const uint64_t *virt_offsets,
|
|
1440
|
+
size_t virt_offset_cnt);
|
|
1441
|
+
|
|
1442
|
+
/**
|
|
1443
|
+
* Symbolize virtual offsets in a Gsym file.
|
|
1444
|
+
*
|
|
1445
|
+
* On success, the function returns a [`blaze_syms`] containing an
|
|
1446
|
+
* array of `virt_offset_cnt` [`blaze_sym`] objects. The returned
|
|
1447
|
+
* object should be released using [`blaze_syms_free`] once it is no
|
|
1448
|
+
* longer needed.
|
|
1449
|
+
*
|
|
1450
|
+
* On error, the function returns `NULL` and sets the thread's last error to
|
|
1451
|
+
* indicate the problem encountered. Use [`blaze_err_last`] to retrieve this
|
|
1452
|
+
* error.
|
|
1453
|
+
*
|
|
1454
|
+
* # Safety
|
|
1455
|
+
* - `symbolizer` needs to point to a valid [`blaze_symbolizer`] object
|
|
1456
|
+
* - `src` needs to point to a valid [`blaze_symbolize_src_gsym_file`] object
|
|
1457
|
+
* - `virt_offsets` point to an array of `virt_offset_cnt` addresses
|
|
1458
|
+
*/
|
|
1459
|
+
const struct blaze_syms *blaze_symbolize_gsym_file_virt_offsets(blaze_symbolizer *symbolizer,
|
|
1460
|
+
const struct blaze_symbolize_src_gsym_file *src,
|
|
1461
|
+
const uint64_t *virt_offsets,
|
|
1462
|
+
size_t virt_offset_cnt);
|
|
1463
|
+
|
|
1464
|
+
/**
|
|
1465
|
+
* Free an array returned by any of the `blaze_symbolize_*` variants.
|
|
1466
|
+
*
|
|
1467
|
+
* # Safety
|
|
1468
|
+
* The pointer must have been returned by any of the `blaze_symbolize_*`
|
|
1469
|
+
* variants.
|
|
1470
|
+
*/
|
|
1471
|
+
void blaze_syms_free(const struct blaze_syms *syms);
|
|
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
|
+
|
|
1493
|
+
#ifdef __cplusplus
|
|
1494
|
+
} // extern "C"
|
|
1495
|
+
#endif // __cplusplus
|
|
1496
|
+
|
|
1497
|
+
#endif /* __blazesym_h_ */
|