tp_debug.h
1 /******************************************************************** 2 * Description: tc_debug.h 3 * 4 * 5 * Author: Robert W. Ellenberg 6 * License: GPL Version 2 7 * System: Linux 8 * 9 * Copyright (c) 2013 All rights reserved. 10 * 11 * Last change: 12 ********************************************************************/ 13 #ifndef TP_DEBUG_H 14 #define TP_DEBUG_H 15 16 #include "rtapi.h" /* printing functions */ 17 18 /** TP debug stuff */ 19 #ifdef TP_DEBUG 20 //Kludge because I didn't know any better at the time 21 //FIXME replace these with better names? 22 #define tp_debug_print(...) rtapi_print(__VA_ARGS__) 23 #elif defined(UNIT_TEST) 24 #include <stdio.h> 25 #define tp_debug_print(...) printf(__VA_ARGS__) 26 #else 27 #define tp_debug_print(...) 28 #endif 29 30 // Verbose but effective wrappers for building faux-JSON debug output for a function 31 #define tp_debug_json_double(varname_) tp_debug_print("%s: %g, ", #varname_, varname_) 32 #define tp_debug_json_start(fname_) tp_debug_print("%s: {", #fname_) 33 #define tp_debug_json_end() tp_debug_print("}\n") 34 35 /** Use for profiling to make static function names visible */ 36 #ifdef TP_PROFILE 37 #define STATIC 38 #else 39 #define STATIC static 40 #endif 41 42 /** "TC" debug info for inspecting trajectory planner output at each timestep */ 43 #ifdef TC_DEBUG 44 #define tc_debug_print(...) rtapi_print(__VA_ARGS__) 45 #else 46 #define tc_debug_print(...) 47 #endif 48 49 /** TP position data output to debug acceleration spikes */ 50 #ifdef TP_POSEMATH_DEBUG 51 #define tp_posemath_debug(...) rtapi_print(__VA_ARGS__) 52 #else 53 #define tp_posemath_debug(...) 54 #endif 55 56 /** TP misc data logging */ 57 #ifdef TP_INFO_LOGGING 58 #define tp_info_print(...) rtapi_print(__VA_ARGS__) 59 #else 60 #define tp_info_print(...) 61 #endif 62 63 int gdb_fake_catch(int condition); 64 int gdb_fake_assert(int condition); 65 #endif