1 /* 2 * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. 3 * Distributed under the terms of the MIT License. 4 */ 5 #ifndef TRACING_H 6 #define TRACING_H 7 8 9 #include <stdio.h> 10 11 #include "apps_debugger_config.h" 12 13 14 #define WARNING(x...) fprintf(stderr, x) 15 #define ERROR(x...) fprintf(stderr, x) 16 17 18 #if APPS_DEBUGGER_TRACE_DWARF_DIE 19 # define TRACE_DIE(x...) printf(x) 20 # define TRACE_DIE_ONLY(x) x 21 #else 22 # define TRACE_DIE(x...) (void)0 23 # define TRACE_DIE_ONLY(x) 24 #endif 25 26 #if APPS_DEBUGGER_TRACE_DWARF_LINE_INFO 27 # define TRACE_LINES(x...) printf(x) 28 # define TRACE_LINES_ONLY(x) x 29 #else 30 # define TRACE_LINES(x...) (void)0 31 # define TRACE_LINES_ONLY(x) 32 #endif 33 34 #if APPS_DEBUGGER_TRACE_DWARF_LINE_INFO >= 2 35 # define TRACE_LINES2(x...) printf(x) 36 # define TRACE_LINES2_ONLY(x) x 37 #else 38 # define TRACE_LINES2(x...) (void)0 39 # define TRACE_LINES2_ONLY(x) 40 #endif 41 42 #if APPS_DEBUGGER_TRACE_DWARF_EXPRESSIONS 43 # define TRACE_EXPR(x...) printf(x) 44 # define TRACE_EXPR_ONLY(x) x 45 #else 46 # define TRACE_EXPR(x...) (void)0 47 # define TRACE_EXPR_ONLY(x) 48 #endif 49 50 #if APPS_DEBUGGER_TRACE_DWARF_PUBLIC_TYPES 51 # define TRACE_PUBTYPES(x...) printf(x) 52 # define TRACE_PUBTYPES_ONLY(x) x 53 #else 54 # define TRACE_PUBTYPES(x...) (void)0 55 # define TRACE_PUBTYPES_ONLY(x) 56 #endif 57 58 #if APPS_DEBUGGER_TRACE_CFI 59 # define TRACE_CFI(x...) printf(x) 60 # define TRACE_CFI_ONLY(x) x 61 #else 62 # define TRACE_CFI(x...) (void)0 63 # define TRACE_CFI_ONLY(x) 64 #endif 65 66 #if APPS_DEBUGGER_TRACE_STACK_FRAME_LOCALS 67 # define TRACE_LOCALS(x...) printf(x) 68 # define TRACE_LOCALS_ONLY(x) x 69 #else 70 # define TRACE_LOCALS(x...) (void)0 71 # define TRACE_LOCALS_ONLY(x) 72 #endif 73 74 #if APPS_DEBUGGER_TRACE_IMAGES 75 # define TRACE_IMAGES(x...) printf(x) 76 # define TRACE_IMAGES_ONLY(x) x 77 #else 78 # define TRACE_IMAGES(x...) (void)0 79 # define TRACE_IMAGES_ONLY(x) 80 #endif 81 82 #if APPS_DEBUGGER_TRACE_CODE 83 # define TRACE_CODE(x...) printf(x) 84 # define TRACE_CODE_ONLY(x) x 85 #else 86 # define TRACE_CODE(x...) (void)0 87 # define TRACE_CODE_ONLY(x) 88 #endif 89 90 #if APPS_DEBUGGER_TRACE_JOBS 91 # define TRACE_JOBS(x...) printf(x) 92 # define TRACE_JOBS_ONLY(x) x 93 #else 94 # define TRACE_JOBS(x...) (void)0 95 # define TRACE_JOBS_ONLY(x) 96 #endif 97 98 #if APPS_DEBUGGER_TRACE_DEBUG_EVENTS 99 # define TRACE_EVENTS(x...) printf(x) 100 # define TRACE_EVENTS_ONLY(x) x 101 #else 102 # define TRACE_EVENTS(x...) (void)0 103 # define TRACE_EVENTS_ONLY(x) 104 #endif 105 106 #if APPS_DEBUGGER_TRACE_TEAM_CONTROL 107 # define TRACE_CONTROL(x...) printf(x) 108 # define TRACE_CONTROL_ONLY(x) x 109 #else 110 # define TRACE_CONTROL(x...) (void)0 111 # define TRACE_CONTROL_ONLY(x) 112 #endif 113 114 #if APPS_DEBUGGER_TRACE_GUI 115 # define TRACE_GUI(x...) printf(x) 116 # define TRACE_GUI_ONLY(x) x 117 #else 118 # define TRACE_GUI(x...) (void)0 119 # define TRACE_GUI_ONLY(x) 120 #endif 121 122 123 #endif // TRACING_H 124