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