diff options
author | Joshua T <joshua@sonofone.net> | 2017-01-07 14:01:21 -0600 |
---|---|---|
committer | Joshua T <joshua@sonofone.net> | 2017-01-07 14:01:21 -0600 |
commit | 8f8d10475956a17953f6db4db3f3b50bd795c0d8 (patch) | |
tree | 90c80474baa080e5743ee745ec98254e1a2faadd /quantum/variable_trace.h | |
parent | b7b44dc481430438552d91b7069d5e37a5e3a649 (diff) | |
parent | e7df488a92da56cf160ac64c8cc7302ab717e145 (diff) | |
download | qmk_firmware-8f8d10475956a17953f6db4db3f3b50bd795c0d8.tar.gz qmk_firmware-8f8d10475956a17953f6db4db3f3b50bd795c0d8.zip |
Merged from upstream
Diffstat (limited to 'quantum/variable_trace.h')
-rw-r--r-- | quantum/variable_trace.h | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/quantum/variable_trace.h b/quantum/variable_trace.h new file mode 100644 index 0000000000..46bd827861 --- /dev/null +++ b/quantum/variable_trace.h @@ -0,0 +1,34 @@ +#ifndef VARIABLE_TRACE_H +#define VARIABLE_TRACE_H + +// For more information about the variable tracing see the readme. + +#include "print.h" + +#ifdef NUM_TRACED_VARIABLES + +// Start tracing a variable at the memory address addr +// The name can be anything and is used only for reporting +// The size should usually be the same size as the variable you are interested in +#define ADD_TRACED_VARIABLE(name, addr, size) \ + add_traced_variable(PSTR(name), (void*)addr, size, PSTR(__FILE__), __LINE__) + +// Stop tracing the variable with the given name +#define REMOVE_TRACED_VARIABLE(name) remove_traced_variable(PSTR(name), PSTR(__FILE__), __LINE__) + +// Call to get messages when the variable has been changed +#define VERIFY_TRACED_VARIABLES() verify_traced_variables(PSTR(__FILE__), __LINE__) + +#else + +#define ADD_TRACED_VARIABLE(name, addr, size) +#define REMOVE_TRACED_VARIABLE(name) +#define VERIFY_TRACED_VARIABLES() + +#endif + +// Don't call directly, use the macros instead +void add_traced_variable(const char* name, void* addr, unsigned size, const char* func, int line); +void remove_traced_variable(const char* name, const char* func, int line); +void verify_traced_variables(const char* func, int line); +#endif |