From fc4368fed53837e00d303600d8b628cb0392b629 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Thu, 23 Jul 2020 20:29:52 -0400 Subject: Improve debug output some Signed-off-by: Peter Jones Upstream: pr#213 --- errlog.c | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) (limited to 'errlog.c') diff --git a/errlog.c b/errlog.c index 6669c800..08f7a82a 100644 --- a/errlog.c +++ b/errlog.c @@ -3,12 +3,28 @@ * Copyright 2017 Peter Jones */ #include "shim.h" +#include "hexdump.h" static CHAR16 **errs = NULL; static UINTN nerrs = 0; EFI_STATUS -VLogError(const char *file, int line, const char *func, CHAR16 *fmt, va_list args) +vdprint_(const CHAR16 *fmt, const char *file, int line, const char *func, va_list args) +{ + va_list args2; + EFI_STATUS efi_status = EFI_SUCCESS; + + if (verbose) { + va_copy(args2, args); + console_print(L"%a:%d:%a() ", file, line, func); + efi_status = VPrint(fmt, args2); + va_end(args2); + } + return efi_status; +} + +EFI_STATUS +VLogError(const char *file, int line, const char *func, const CHAR16 *fmt, va_list args) { va_list args2; CHAR16 **newerrs; @@ -35,7 +51,7 @@ VLogError(const char *file, int line, const char *func, CHAR16 *fmt, va_list arg } EFI_STATUS -LogError_(const char *file, int line, const char *func, CHAR16 *fmt, ...) +LogError_(const char *file, int line, const char *func, const CHAR16 *fmt, ...) { va_list args; EFI_STATUS efi_status; @@ -47,6 +63,12 @@ LogError_(const char *file, int line, const char *func, CHAR16 *fmt, ...) return efi_status; } +VOID +LogHexdump_(const char *file, int line, const char *func, const void *data, size_t sz) +{ + hexdumpat(file, line, func, data, sz, 0); +} + VOID PrintErrors(VOID) { -- cgit v1.2.3