Debian Codegraph @

ext/GOTCHA/src/translations.c

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 #include "translations.h"
16
17 #include <gotcha/gotcha.h>
18
19 #include "gotcha_utils.h"
20
21 int main_wrapped;
22 gotcha_wrappee_handle_t gotcha_internal_libc_main_wrappee_handle;
23 gotcha_wrappee_handle_t gotcha_internal_main_wrappee_handle;
24 /**
25 * This function is excluded from coverage as this is only required for our
26 * wrapper to call main.
27 */
28 // GCOV_EXCL_START
29 int gotcha_internal_main(int argc, char **argv, char **envp) {
30 main_t underlying_main =
31 gotcha_get_wrappee(gotcha_internal_main_wrappee_handle);
32 return underlying_main(argc, argv, envp);
33 }
34 // GCOV_EXCL_STOP
35 int gotcha_internal_libc_start_main(int (*main_arg)(int, char **, char **)
36 KNOWN_UNUSED,
37 int argc, char **argv, void (*init)(),
38 void (*fini)(), void (*rtld_fini)(),
39 void *stack_end) {
40 libc_start_main_t underlying_libc_main =
41 gotcha_get_wrappee(gotcha_internal_libc_main_wrappee_handle);
42 main_t underlying_main =
43 gotcha_get_wrappee(gotcha_internal_main_wrappee_handle);
44 return underlying_libc_main(underlying_main, argc, argv, init, fini,
45 rtld_fini, stack_end);
46 }
47
48 struct gotcha_binding_t libc_main_wrappers[] = {
49 {"__libc_start_main", gotcha_internal_libc_start_main,
50 &gotcha_internal_libc_main_wrappee_handle}};
51 struct gotcha_binding_t main_wrappers[] = {
52 {"main", gotcha_internal_main, &gotcha_internal_main_wrappee_handle}};