SoW-2020-0003: Trace Hit Counters
[lttng-tools.git] / include / lttng / kernel-function.h
CommitLineData
ebdb334b
JR
1/*
2 * Copyright (C) 2021 Francis Deslauriers <francis.deslauriers@efficios.com>
3 *
4 * SPDX-License-Identifier: LGPL-2.1-only
5 *
6 */
7
8#ifndef LTTNG_KERNEL_FUNCTION_H
9#define LTTNG_KERNEL_FUNCTION_H
10
11#include <stdint.h>
12
13#ifdef __cplusplus
14extern "C" {
15#endif
16
17struct lttng_kernel_function_location;
18
19enum lttng_kernel_function_location_status {
20 LTTNG_KERNEL_FUNCTION_LOCATION_STATUS_OK = 0,
21 /* Invalid parameters provided. */
22 LTTNG_KERNEL_FUNCTION_LOCATION_STATUS_INVALID = -1,
23};
24
25enum lttng_kernel_function_location_type {
26 LTTNG_KERNEL_FUNCTION_LOCATION_TYPE_UNKNOWN = -1,
27 /* Location derived from a symbol and an offset. */
28 LTTNG_KERNEL_FUNCTION_LOCATION_TYPE_SYMBOL_OFFSET = 0,
29 /* Location derived from an address. */
30 LTTNG_KERNEL_FUNCTION_LOCATION_TYPE_ADDRESS = 1,
31};
32
33/*
34 * Get the type of the kernel function location.
35 */
36extern enum lttng_kernel_function_location_type
37lttng_kernel_function_location_get_type(
38 const struct lttng_kernel_function_location *location);
39
40/*
41 * Destroy the kernel function location.
42 */
43extern void lttng_kernel_function_location_destroy(
44 struct lttng_kernel_function_location *location);
45
46/*
47 * Create a symbol derived function location.
48 * On failure, NULL is returned.
49 */
50extern struct lttng_kernel_function_location *
51lttng_kernel_function_location_symbol_create(const char *symbol_name,
52 uint64_t offset);
53
54/*
55 * Get the symbol name of a symbol derived function location.
56 */
57extern const char *lttng_kernel_function_location_symbol_get_name(
58 const struct lttng_kernel_function_location *location);
59
60/*
61 * Get the offset of a symbol derived location.
62 */
63extern enum lttng_kernel_function_location_status
64lttng_kernel_function_location_symbol_get_offset(
65 const struct lttng_kernel_function_location *location,
66 uint64_t *offset);
67
68/*
69 * Create an address derived function location.
70 * On failure, NULL is returned.
71 */
72extern struct lttng_kernel_function_location *
73lttng_kernel_function_location_address_create(uint64_t address);
74
75/*
76 * Get the address of an address derived function location.
77 */
78extern enum lttng_kernel_function_location_status
79lttng_kernel_function_location_address_get_address(
80 const struct lttng_kernel_function_location *location,
81 uint64_t *offset);
82
83#ifdef __cplusplus
84}
85#endif
86
87#endif /* LTTNG_KERNEL_FUNCTION_H */
This page took 0.026297 seconds and 5 git commands to generate.