native/include/cpu.h
1 /*
2  * Copyright (C) 2013 - 2016 Ludwig Knüpfer <ludwig.knuepfer@fu-berlin.de>
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser
5  * General Public License v2.1. See the file LICENSE in the top level
6  * directory for more details.
7  */
8 
20 #ifndef CPU_H
21 #define CPU_H
22 
23 #include <stdio.h>
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
32 __attribute__((always_inline)) static inline void cpu_print_last_instruction(void)
33 {
34  /* __builtin_return_address will return the address the calling function
35  * will return to - since cpu_print_last_instruction is forced inline,
36  * it is the return address of the user of this function */
37  printf("%p\n", __builtin_return_address(0));
38 }
39 
40 #ifdef __cplusplus
41 }
42 #endif
43 
45 #endif /* CPU_H */
static void cpu_print_last_instruction(void)
Prints the address the callee will return to.
stdio.h wrapper for MSP430