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 
33 #define CPU_HAS_UNALIGNED_ACCESS
34 
38 __attribute__((always_inline)) static inline void cpu_print_last_instruction(void)
39 {
40  /* __builtin_return_address will return the address the calling function
41  * will return to - since cpu_print_last_instruction is forced inline,
42  * it is the return address of the user of this function */
43  printf("%p\n", __builtin_return_address(0));
44 }
45 
46 #ifdef __cplusplus
47 }
48 #endif
49 
51 #endif /* CPU_H */
cpu_print_last_instruction
static void cpu_print_last_instruction(void)
Prints the address the callee will return to.
Definition: cpu.h:38