Commit | Line | Data |
---|---|---|
808cb744 JR |
1 | /* |
2 | * Copyright (C) 2020 Jonathan Rajotte <jonathan.rajotte-julien@efficios.com> | |
3 | * | |
4 | * SPDX-License-Identifier: LGPL-2.1-only | |
5 | * | |
6 | */ | |
7 | ||
8 | #ifndef LTTNG_KERNEL_PROBE_H | |
9 | #define LTTNG_KERNEL_PROBE_H | |
10 | ||
4bd69c5f | 11 | #include <lttng/lttng-export.h> |
808cb744 JR |
12 | #include <stdint.h> |
13 | ||
14 | #ifdef __cplusplus | |
15 | extern "C" { | |
16 | #endif | |
17 | ||
18 | struct lttng_kernel_probe_location; | |
19 | ||
20 | enum lttng_kernel_probe_location_status { | |
21 | LTTNG_KERNEL_PROBE_LOCATION_STATUS_OK = 0, | |
22 | /* Invalid parameters provided. */ | |
23 | LTTNG_KERNEL_PROBE_LOCATION_STATUS_INVALID = -1, | |
24 | }; | |
25 | ||
26 | enum lttng_kernel_probe_location_type { | |
27 | LTTNG_KERNEL_PROBE_LOCATION_TYPE_UNKNOWN = -1, | |
28 | /* Location derived from a symbol and an offset. */ | |
29 | LTTNG_KERNEL_PROBE_LOCATION_TYPE_SYMBOL_OFFSET = 0, | |
30 | /* Location derived from an address. */ | |
31 | LTTNG_KERNEL_PROBE_LOCATION_TYPE_ADDRESS = 1, | |
32 | }; | |
33 | ||
34 | /* | |
35 | * Get the type of the kernel probe location. | |
36 | */ | |
4bd69c5f | 37 | LTTNG_EXPORT extern enum lttng_kernel_probe_location_type |
808cb744 JR |
38 | lttng_kernel_probe_location_get_type( |
39 | const struct lttng_kernel_probe_location *location); | |
40 | ||
41 | /* | |
42 | * Destroy the kernel probe location. | |
43 | */ | |
4bd69c5f | 44 | LTTNG_EXPORT extern void lttng_kernel_probe_location_destroy( |
808cb744 JR |
45 | struct lttng_kernel_probe_location *location); |
46 | ||
47 | /* | |
48 | * Create a symbol derived probe location. | |
49 | * On failure, NULL is returned. | |
50 | */ | |
4bd69c5f | 51 | LTTNG_EXPORT extern struct lttng_kernel_probe_location * |
808cb744 JR |
52 | lttng_kernel_probe_location_symbol_create(const char *symbol_name, |
53 | uint64_t offset); | |
54 | ||
55 | /* | |
56 | * Get the symbol name of a symbol derived probe location. | |
57 | */ | |
4bd69c5f | 58 | LTTNG_EXPORT extern const char *lttng_kernel_probe_location_symbol_get_name( |
808cb744 JR |
59 | const struct lttng_kernel_probe_location *location); |
60 | ||
61 | /* | |
62 | * Get the offset of a symbol derived location. | |
63 | */ | |
4bd69c5f | 64 | LTTNG_EXPORT extern enum lttng_kernel_probe_location_status |
808cb744 JR |
65 | lttng_kernel_probe_location_symbol_get_offset( |
66 | const struct lttng_kernel_probe_location *location, | |
67 | uint64_t *offset); | |
68 | ||
69 | /* | |
70 | * Create an address derived probe location. | |
71 | * On failure, NULL is returned. | |
72 | */ | |
4bd69c5f | 73 | LTTNG_EXPORT extern struct lttng_kernel_probe_location * |
808cb744 JR |
74 | lttng_kernel_probe_location_address_create(uint64_t address); |
75 | ||
76 | /* | |
77 | * Get the address of an address derived probe location. | |
78 | */ | |
4bd69c5f | 79 | LTTNG_EXPORT extern enum lttng_kernel_probe_location_status |
808cb744 JR |
80 | lttng_kernel_probe_location_address_get_address( |
81 | const struct lttng_kernel_probe_location *location, | |
82 | uint64_t *offset); | |
83 | ||
84 | #ifdef __cplusplus | |
85 | } | |
86 | #endif | |
87 | ||
88 | #endif /* LTTNG_KERNEL_PROBE_H */ |