2 * Copyright (C) 2020 Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
4 * SPDX-License-Identifier: LGPL-2.1-only
8 #ifndef LTTNG_KERNEL_PROBE_H
9 #define LTTNG_KERNEL_PROBE_H
11 #include <lttng/lttng-export.h>
19 struct lttng_kernel_probe_location
;
21 enum lttng_kernel_probe_location_status
{
22 LTTNG_KERNEL_PROBE_LOCATION_STATUS_OK
= 0,
23 /* Invalid parameters provided. */
24 LTTNG_KERNEL_PROBE_LOCATION_STATUS_INVALID
= -1,
27 enum lttng_kernel_probe_location_type
{
28 LTTNG_KERNEL_PROBE_LOCATION_TYPE_UNKNOWN
= -1,
29 /* Location derived from a symbol and an offset. */
30 LTTNG_KERNEL_PROBE_LOCATION_TYPE_SYMBOL_OFFSET
= 0,
31 /* Location derived from an address. */
32 LTTNG_KERNEL_PROBE_LOCATION_TYPE_ADDRESS
= 1,
36 * Get the type of the kernel probe location.
38 LTTNG_EXPORT
extern enum lttng_kernel_probe_location_type
39 lttng_kernel_probe_location_get_type(const struct lttng_kernel_probe_location
*location
);
42 * Destroy the kernel probe location.
44 LTTNG_EXPORT
extern void
45 lttng_kernel_probe_location_destroy(struct lttng_kernel_probe_location
*location
);
48 * Create a symbol derived probe location.
49 * On failure, NULL is returned.
51 LTTNG_EXPORT
extern struct lttng_kernel_probe_location
*
52 lttng_kernel_probe_location_symbol_create(const char *symbol_name
, uint64_t offset
);
55 * Get the symbol name of a symbol derived probe location.
57 LTTNG_EXPORT
extern const char *
58 lttng_kernel_probe_location_symbol_get_name(const struct lttng_kernel_probe_location
*location
);
61 * Get the offset of a symbol derived location.
63 LTTNG_EXPORT
extern enum lttng_kernel_probe_location_status
64 lttng_kernel_probe_location_symbol_get_offset(const struct lttng_kernel_probe_location
*location
,
68 * Create an address derived probe location.
69 * On failure, NULL is returned.
71 LTTNG_EXPORT
extern struct lttng_kernel_probe_location
*
72 lttng_kernel_probe_location_address_create(uint64_t address
);
75 * Get the address of an address derived probe location.
77 LTTNG_EXPORT
extern enum lttng_kernel_probe_location_status
78 lttng_kernel_probe_location_address_get_address(const struct lttng_kernel_probe_location
*location
,
85 #endif /* LTTNG_KERNEL_PROBE_H */