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> |
28f23191 | 12 | |
808cb744 JR |
13 | #include <stdint.h> |
14 | ||
15 | #ifdef __cplusplus | |
16 | extern "C" { | |
17 | #endif | |
18 | ||
19 | struct lttng_kernel_probe_location; | |
20 | ||
21 | enum lttng_kernel_probe_location_status { | |
28f23191 | 22 | LTTNG_KERNEL_PROBE_LOCATION_STATUS_OK = 0, |
808cb744 | 23 | /* Invalid parameters provided. */ |
28f23191 | 24 | LTTNG_KERNEL_PROBE_LOCATION_STATUS_INVALID = -1, |
808cb744 JR |
25 | }; |
26 | ||
27 | enum lttng_kernel_probe_location_type { | |
28f23191 | 28 | LTTNG_KERNEL_PROBE_LOCATION_TYPE_UNKNOWN = -1, |
808cb744 | 29 | /* Location derived from a symbol and an offset. */ |
28f23191 | 30 | LTTNG_KERNEL_PROBE_LOCATION_TYPE_SYMBOL_OFFSET = 0, |
808cb744 | 31 | /* Location derived from an address. */ |
28f23191 | 32 | LTTNG_KERNEL_PROBE_LOCATION_TYPE_ADDRESS = 1, |
808cb744 JR |
33 | }; |
34 | ||
35 | /* | |
36 | * Get the type of the kernel probe location. | |
37 | */ | |
4bd69c5f | 38 | LTTNG_EXPORT extern enum lttng_kernel_probe_location_type |
28f23191 | 39 | lttng_kernel_probe_location_get_type(const struct lttng_kernel_probe_location *location); |
808cb744 JR |
40 | |
41 | /* | |
42 | * Destroy the kernel probe location. | |
43 | */ | |
28f23191 JG |
44 | LTTNG_EXPORT extern void |
45 | lttng_kernel_probe_location_destroy(struct lttng_kernel_probe_location *location); | |
808cb744 JR |
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 * |
28f23191 | 52 | lttng_kernel_probe_location_symbol_create(const char *symbol_name, uint64_t offset); |
808cb744 JR |
53 | |
54 | /* | |
55 | * Get the symbol name of a symbol derived probe location. | |
56 | */ | |
28f23191 JG |
57 | LTTNG_EXPORT extern const char * |
58 | lttng_kernel_probe_location_symbol_get_name(const struct lttng_kernel_probe_location *location); | |
808cb744 JR |
59 | |
60 | /* | |
61 | * Get the offset of a symbol derived location. | |
62 | */ | |
4bd69c5f | 63 | LTTNG_EXPORT extern enum lttng_kernel_probe_location_status |
28f23191 JG |
64 | lttng_kernel_probe_location_symbol_get_offset(const struct lttng_kernel_probe_location *location, |
65 | uint64_t *offset); | |
808cb744 JR |
66 | |
67 | /* | |
68 | * Create an address derived probe location. | |
69 | * On failure, NULL is returned. | |
70 | */ | |
4bd69c5f | 71 | LTTNG_EXPORT extern struct lttng_kernel_probe_location * |
808cb744 JR |
72 | lttng_kernel_probe_location_address_create(uint64_t address); |
73 | ||
74 | /* | |
75 | * Get the address of an address derived probe location. | |
76 | */ | |
4bd69c5f | 77 | LTTNG_EXPORT extern enum lttng_kernel_probe_location_status |
28f23191 JG |
78 | lttng_kernel_probe_location_address_get_address(const struct lttng_kernel_probe_location *location, |
79 | uint64_t *offset); | |
808cb744 JR |
80 | |
81 | #ifdef __cplusplus | |
82 | } | |
83 | #endif | |
84 | ||
85 | #endif /* LTTNG_KERNEL_PROBE_H */ |