blob: fd76511ed22eeeb1f0094c56b9d6c2eb33bd21f1 [file] [log] [blame]
TrustworthySystems073f53b2014-07-22 14:12:18 +10001/*
Gerwin Klein600fe152021-02-10 19:19:17 +11002 * Copyright 2017, Data61, CSIRO (ABN 41 687 119 230)
TrustworthySystems073f53b2014-07-22 14:12:18 +10003 *
Gerwin Klein600fe152021-02-10 19:19:17 +11004 * SPDX-License-Identifier: BSD-2-Clause
TrustworthySystems073f53b2014-07-22 14:12:18 +10005 */
6
Matthew Fernandez6bd01162015-02-07 14:05:37 +11007#include <autoconf.h>
Yu Houe23dc542019-05-20 15:29:15 +10008#include <sel4debug/gen_config.h>
Adrian Danis6db5f212014-09-02 11:12:18 +10009#include <sel4debug/debug.h>
Matthew Fernandez6bd01162015-02-07 14:05:37 +110010#include <sel4debug/instrumentation.h>
11
12#ifdef CONFIG_LIBSEL4DEBUG_FUNCTION_INSTRUMENTATION_TRACE
TrustworthySystems073f53b2014-07-22 14:12:18 +100013
14/* Function entry and exit printing. Useful for low effort tracing of
15 * execution.
16 *
17 * Enable this in your app by including:
18 * NK_CFLAGS += -finstrument-functions \
Anna Lyonsad6ba952014-09-02 18:26:14 +100019 * -finstrument-functions-exclude-function-list=seL4_MessageInfo_get_length
TrustworthySystems073f53b2014-07-22 14:12:18 +100020 * If you don't exclude seL4_MessageInfo_get_length, you will most likely find
Anna Lyonsad6ba952014-09-02 18:26:14 +100021 * that __seL4_*WithMRs will not function correctly because calls to
TrustworthySystems073f53b2014-07-22 14:12:18 +100022 * seL4_MessageInfo_get_length will be instrumented and clobber necessary
23 * registers for the following syscall.
24 */
25void __cyg_profile_func_enter(void *func, void *caller)
Anna Lyonsad6ba952014-09-02 18:26:14 +100026{
TrustworthySystems073f53b2014-07-22 14:12:18 +100027 debug_safe_printf("ENTER: %p called from %p\n", func, caller);
28}
29
30void __cyg_profile_func_exit(void *func, void *caller)
Anna Lyonsad6ba952014-09-02 18:26:14 +100031{
TrustworthySystems073f53b2014-07-22 14:12:18 +100032 debug_safe_printf("EXIT: %p returning to %p\n", func, caller);
33}
Matthew Fernandez6bd01162015-02-07 14:05:37 +110034
35#endif