TrustworthySystems | 073f53b | 2014-07-22 14:12:18 +1000 | [diff] [blame] | 1 | /* |
Gerwin Klein | 600fe15 | 2021-02-10 19:19:17 +1100 | [diff] [blame] | 2 | * Copyright 2017, Data61, CSIRO (ABN 41 687 119 230) |
TrustworthySystems | 073f53b | 2014-07-22 14:12:18 +1000 | [diff] [blame] | 3 | * |
Gerwin Klein | 600fe15 | 2021-02-10 19:19:17 +1100 | [diff] [blame] | 4 | * SPDX-License-Identifier: BSD-2-Clause |
TrustworthySystems | 073f53b | 2014-07-22 14:12:18 +1000 | [diff] [blame] | 5 | */ |
| 6 | |
Matthew Fernandez | 6bd0116 | 2015-02-07 14:05:37 +1100 | [diff] [blame] | 7 | #include <autoconf.h> |
Yu Hou | e23dc54 | 2019-05-20 15:29:15 +1000 | [diff] [blame] | 8 | #include <sel4debug/gen_config.h> |
Adrian Danis | 6db5f21 | 2014-09-02 11:12:18 +1000 | [diff] [blame] | 9 | #include <sel4debug/debug.h> |
Matthew Fernandez | 6bd0116 | 2015-02-07 14:05:37 +1100 | [diff] [blame] | 10 | #include <sel4debug/instrumentation.h> |
| 11 | |
| 12 | #ifdef CONFIG_LIBSEL4DEBUG_FUNCTION_INSTRUMENTATION_TRACE |
TrustworthySystems | 073f53b | 2014-07-22 14:12:18 +1000 | [diff] [blame] | 13 | |
| 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 Lyons | ad6ba95 | 2014-09-02 18:26:14 +1000 | [diff] [blame] | 19 | * -finstrument-functions-exclude-function-list=seL4_MessageInfo_get_length |
TrustworthySystems | 073f53b | 2014-07-22 14:12:18 +1000 | [diff] [blame] | 20 | * If you don't exclude seL4_MessageInfo_get_length, you will most likely find |
Anna Lyons | ad6ba95 | 2014-09-02 18:26:14 +1000 | [diff] [blame] | 21 | * that __seL4_*WithMRs will not function correctly because calls to |
TrustworthySystems | 073f53b | 2014-07-22 14:12:18 +1000 | [diff] [blame] | 22 | * seL4_MessageInfo_get_length will be instrumented and clobber necessary |
| 23 | * registers for the following syscall. |
| 24 | */ |
| 25 | void __cyg_profile_func_enter(void *func, void *caller) |
Anna Lyons | ad6ba95 | 2014-09-02 18:26:14 +1000 | [diff] [blame] | 26 | { |
TrustworthySystems | 073f53b | 2014-07-22 14:12:18 +1000 | [diff] [blame] | 27 | debug_safe_printf("ENTER: %p called from %p\n", func, caller); |
| 28 | } |
| 29 | |
| 30 | void __cyg_profile_func_exit(void *func, void *caller) |
Anna Lyons | ad6ba95 | 2014-09-02 18:26:14 +1000 | [diff] [blame] | 31 | { |
TrustworthySystems | 073f53b | 2014-07-22 14:12:18 +1000 | [diff] [blame] | 32 | debug_safe_printf("EXIT: %p returning to %p\n", func, caller); |
| 33 | } |
Matthew Fernandez | 6bd0116 | 2015-02-07 14:05:37 +1100 | [diff] [blame] | 34 | |
| 35 | #endif |