From 30fc716dbe1cb73b29780b46d59583d9f97ac9bb Mon Sep 17 00:00:00 2001 From: Jeff Olivier Date: Wed, 19 Feb 2025 14:17:50 -0700 Subject: [PATCH] DAOS-623 ddb: Add line numbers to error prints (#15902) Signed-off-by: Jeff Olivier --- src/utils/ddb/ddb_common.h | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/utils/ddb/ddb_common.h b/src/utils/ddb/ddb_common.h index 7f281ebd852..8e9a1b919e8 100644 --- a/src/utils/ddb/ddb_common.h +++ b/src/utils/ddb/ddb_common.h @@ -1,5 +1,6 @@ /** * (C) Copyright 2019-2022 Intel Corporation. + * (C) Copyright 2025 Google LLC * * SPDX-License-Identifier: BSD-2-Clause-Patent */ @@ -35,11 +36,13 @@ else \ printf(str); } while (0) -#define ddb_errorf(ctx, fmt, ...) \ - do { if ((ctx)->dc_io_ft.ddb_print_error) \ - (ctx)->dc_io_ft.ddb_print_error(fmt, __VA_ARGS__); \ - else \ - printf(fmt, __VA_ARGS__); \ +#define ddb_errorf(ctx, fmt, ...) \ + do { \ + if ((ctx)->dc_io_ft.ddb_print_error) \ + (ctx)->dc_io_ft.ddb_print_error("At %s:%d: " fmt, __FILE__, __LINE__, \ + __VA_ARGS__); \ + else \ + printf("At %s:%d: " fmt, __FILE__, __LINE__, __VA_ARGS__); \ } while (0) struct argv_parsed {