Debian Codegraph @

ext/GOTCHA/include/gotcha/gotcha.h

raw symbols SCIP
1 /*
2 This file is part of GOTCHA. For copyright information see the COPYRIGHT
3 file in the top level directory, or at
4 https://github.com/LLNL/gotcha/blob/master/COPYRIGHT
5 This program is free software; you can redistribute it and/or modify it under
6 the terms of the GNU Lesser General Public License (as published by the Free
7 Software Foundation) version 2.1 dated February 1999. This program is
8 distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
9 without even the IMPLIED WARRANTY OF MERCHANTABILITY or FITNESS FOR A PARTICULAR
10 PURPOSE. See the terms and conditions of the GNU Lesser General Public License
11 for more details. You should have received a copy of the GNU Lesser General
12 Public License along with this program; if not, write to the Free Software
13 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
14 */
15
16 /*!
17 ******************************************************************************
18 *
19 * \file gotcha.h
20 *
21 * \brief Header file containing the external gotcha interface
22 *
23 * The intended use pattern is as follows
24 *
25 * TODO ON-INTERFACE-SOLID: document the
26 *interface usage
27 *
28 ******************************************************************************
29 */
30 #ifndef GOTCHA_H
31 #define GOTCHA_H
32
33 #include <gotcha/gotcha_config.h>
34 #include <gotcha/gotcha_types.h>
35 #include <link.h>
36
37 #if defined(__cplusplus)
38 extern "C" {
39 #endif
40
41 /*!
42 ******************************************************************************
43 * \def GOTCHA_MAKE_FUNCTION_PTR(name, ret_type, ...)
44 * \brief Makes a function pointer with a given name, return type, and
45 * parameters
46 * \param name The name of the function you want to get a pointer to
47 * \param ret_type The return type of the function you want a pointer to
48 * \param ... A comma separated list of the types of the parameters
49 * to the function you're getting a pointer to
50 ******************************************************************************
51 */
52
53 #define GOTCHA_MAKE_FUNCTION_PTR(name, ret_type, ...) \
54 ret_type (*name)(__VA_ARGS__)
55
56 #define GOTCHA_EXPORT __attribute__((__visibility__("default")))
57
58 /*!
59 ******************************************************************************
60 *
61 * \fn enum gotcha_error_t gotcha_wrap(struct gotcha_binding_t* bindings,
62 * void** wrappers, void*** originals,
63 * int num_actions);
64 *
65 * \brief Makes GOTCHA wrap the functions picked in gotcha_prepare_symbols
66 *
67 * \param bindings A list of bindings to wrap
68 * \param num_actions The number of items in the bindings table
69 * \param tool_name A name you use to represent your tool when
70 * stacking multiple tools (currently unused).
71 *
72 ******************************************************************************
73 */
74
75 GOTCHA_EXPORT enum gotcha_error_t gotcha_wrap(struct gotcha_binding_t *bindings,
76 int num_actions,
77 const char *tool_name);
78
79 /*!
80 ******************************************************************************
81 *
82 * \fn enum gotcha_error_t gotcha_set_priority(const char *tool_name,
83 * int value);
84 *
85 * \brief Set the tool priority, which controls how multiple tools stack
86 * wrappings over the same functions.
87 *
88 * \param tool_name The tool name to set the priority of
89 * \param priority The new priority value for the tool. Lower values
90 * are called innermost.
91 *
92 ******************************************************************************
93 */
94 GOTCHA_EXPORT enum gotcha_error_t gotcha_set_priority(const char *tool_name,
95 int priority);
96
97 /*!
98 ******************************************************************************
99 *
100 * \fn enum gotcha_error_t gotcha_get_priority(const char *tool_name,
101 * int *value);
102 *
103 * \brief Gets the tool priority, which controls how multiple tools stack
104 * wrappings over the same functions.
105 *
106 * \param tool_name The tool name to get the priority of
107 * \param num_actions Output parameters with the priority for the tool.
108 *
109 ******************************************************************************
110 */
111 GOTCHA_EXPORT enum gotcha_error_t gotcha_get_priority(const char *tool_name,
112 int *priority);
113
114 /*!
115 ******************************************************************************
116 *
117 * \fn enum void* gotcha_get_wrappee(gotcha_wrappee_handle_t)
118 *
119 * \brief Given a GOTCHA wrapper's handle, returns the wrapped function for it
120 *to call
121 *
122 * \param handle The wrappee handle to return the function pointer for
123 *
124 ******************************************************************************
125 */
126 GOTCHA_EXPORT void *gotcha_get_wrappee(gotcha_wrappee_handle_t handle);
127
128 GOTCHA_EXPORT void gotcha_filter_libraries_by_name(const char *nameFilter);
129 GOTCHA_EXPORT void gotcha_only_filter_last();
130 GOTCHA_EXPORT void gotcha_set_library_filter_func(
131 int (*new_func)(struct link_map *));
132 GOTCHA_EXPORT void gotcha_restore_library_filter_func();
133
134 #if defined(__cplusplus)
135 }
136 #endif
137
138 #endif