1 | /* |
---|
2 | * COPYRIGHT (c) 2012-2014 Chris Johns <chrisj@rtems.org> |
---|
3 | * |
---|
4 | * The license and distribution terms for this file may be |
---|
5 | * found in the file LICENSE in this distribution or at |
---|
6 | * http://www.rtems.org/license/LICENSE. |
---|
7 | */ |
---|
8 | /** |
---|
9 | * @file |
---|
10 | * |
---|
11 | * @ingroup rtems_rtl |
---|
12 | * |
---|
13 | * @brief RTEMS Run-Time Linker ELF Trace Support. |
---|
14 | */ |
---|
15 | |
---|
16 | #if !defined (_RTEMS_RTL_TRACE_H_) |
---|
17 | #define _RTEMS_RTL_TRACE_H_ |
---|
18 | |
---|
19 | #ifdef __cplusplus |
---|
20 | extern "C" { |
---|
21 | #endif /* __cplusplus */ |
---|
22 | |
---|
23 | #include <stdbool.h> |
---|
24 | #include <stdint.h> |
---|
25 | |
---|
26 | /** |
---|
27 | * Set to 1 to build trace support in to the RTL code. |
---|
28 | */ |
---|
29 | #define RTEMS_RTL_TRACE 1 |
---|
30 | |
---|
31 | /** |
---|
32 | * The type of the mask. |
---|
33 | */ |
---|
34 | typedef uint32_t rtems_rtl_trace_mask; |
---|
35 | |
---|
36 | /** |
---|
37 | * List of tracing bits for the various parts of the link editor. |
---|
38 | */ |
---|
39 | #define RTEMS_RTL_TRACE_DETAIL (1UL << 0) |
---|
40 | #define RTEMS_RTL_TRACE_WARNING (1UL << 1) |
---|
41 | #define RTEMS_RTL_TRACE_LOAD (1UL << 2) |
---|
42 | #define RTEMS_RTL_TRACE_UNLOAD (1UL << 3) |
---|
43 | #define RTEMS_RTL_TRACE_SECTION (1UL << 4) |
---|
44 | #define RTEMS_RTL_TRACE_SYMBOL (1UL << 5) |
---|
45 | #define RTEMS_RTL_TRACE_RELOC (1UL << 6) |
---|
46 | #define RTEMS_RTL_TRACE_GLOBAL_SYM (1UL << 7) |
---|
47 | #define RTEMS_RTL_TRACE_LOAD_SECT (1UL << 8) |
---|
48 | #define RTEMS_RTL_TRACE_ALLOCATOR (1UL << 9) |
---|
49 | #define RTEMS_RTL_TRACE_UNRESOLVED (1UL << 10) |
---|
50 | #define RTEMS_RTL_TRACE_CACHE (1UL << 11) |
---|
51 | #define RTEMS_RTL_TRACE_ARCHIVES (1UL << 12) |
---|
52 | #define RTEMS_RTL_TRACE_DEPENDENCY (1UL << 13) |
---|
53 | #define RTEMS_RTL_TRACE_ALL (0xffffffffUL & ~(RTEMS_RTL_TRACE_CACHE)) |
---|
54 | |
---|
55 | /** |
---|
56 | * Call to check if this part is bring traced. If RTEMS_RTL_TRACE is defined to |
---|
57 | * 0 the code is dead code elminiated when built with -Os, -O2, or higher. |
---|
58 | * |
---|
59 | * @param mask The part of the API to trace. |
---|
60 | * @retval true Tracing is active for the mask. |
---|
61 | * @retval false Do not trace. |
---|
62 | */ |
---|
63 | #if RTEMS_RTL_TRACE |
---|
64 | bool rtems_rtl_trace (rtems_rtl_trace_mask mask); |
---|
65 | #else |
---|
66 | #define rtems_rtl_trace(_m) (0) |
---|
67 | #endif |
---|
68 | |
---|
69 | /** |
---|
70 | * Set the mask. |
---|
71 | * |
---|
72 | * @param mask The mask bits to set. |
---|
73 | * @return The previous mask. |
---|
74 | */ |
---|
75 | #if RTEMS_RTL_TRACE |
---|
76 | rtems_rtl_trace_mask rtems_rtl_trace_set_mask (rtems_rtl_trace_mask mask); |
---|
77 | #else |
---|
78 | #define rtems_rtl_trace_set_mask(_m) |
---|
79 | #endif |
---|
80 | |
---|
81 | /** |
---|
82 | * Clear the mask. |
---|
83 | * |
---|
84 | * @param mask The mask bits to clear. |
---|
85 | * @return The previous mask. |
---|
86 | */ |
---|
87 | #if RTEMS_RTL_TRACE |
---|
88 | rtems_rtl_trace_mask rtems_rtl_trace_clear_mask (rtems_rtl_trace_mask mask); |
---|
89 | #else |
---|
90 | #define rtems_rtl_trace_clear_mask(_m) |
---|
91 | #endif |
---|
92 | |
---|
93 | /** |
---|
94 | * Add shell trace shell command. |
---|
95 | */ |
---|
96 | #if RTEMS_RTL_TRACE |
---|
97 | int rtems_rtl_trace_shell_command (int argc, char *argv[]); |
---|
98 | #endif |
---|
99 | |
---|
100 | #ifdef __cplusplus |
---|
101 | } |
---|
102 | #endif /* __cplusplus */ |
---|
103 | |
---|
104 | #endif |
---|