A simple function to call in random places when debugging expression-related code. Signed-off-by: Phil Sutter --- include/utils.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/include/utils.h b/include/utils.h index 6a0e494607c93..1c227f6849a22 100644 --- a/include/utils.h +++ b/include/utils.h @@ -27,6 +27,15 @@ #define pr_gmp_debug(fmt, arg...) ({ if (false) {}; 0; }) #endif +#define expr_print_debug(expr) \ +{ \ + struct output_ctx octx = { .output_fp = stdout }; \ + printf("%s:%d: ", __FILE__, __LINE__); \ + printf("'" #expr "' type %s: ", expr_name(expr)); \ + expr_print((expr), &octx); \ + printf("\n"); \ +} + #define __fmtstring(x, y) __attribute__((format(printf, x, y))) #define __must_check __attribute__((warn_unused_result)) -- 2.51.0