From 50e793e869a35875e7ea25d8ad1e9123e89f745f Mon Sep 17 00:00:00 2001 From: Andrzej Janik Date: Wed, 8 Dec 2021 00:29:00 +0100 Subject: Improve logging of dumps --- zluda_dump/src/dark_api.rs | 3 ++- zluda_dump/src/log.rs | 14 ++++++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/zluda_dump/src/dark_api.rs b/zluda_dump/src/dark_api.rs index b9fd9c2..3ae50ed 100644 --- a/zluda_dump/src/dark_api.rs +++ b/zluda_dump/src/dark_api.rs @@ -491,7 +491,8 @@ unsafe fn record_submodules( if fatbin_file_kind == FATBIN_FILE_HEADER_KIND_PTX { let decompressed = decompress_kernel_module(fatbin_file); match decompressed { - Some(decompressed) => { + Some(mut decompressed) => { + decompressed.pop(); // remove trailing zero state.record_new_submodule(module, version, &*decompressed, fn_logger, "ptx") } None => fn_logger.log(log::LogEntry::Lz4DecompressionFailure), diff --git a/zluda_dump/src/log.rs b/zluda_dump/src/log.rs index a7dc399..b7416af 100644 --- a/zluda_dump/src/log.rs +++ b/zluda_dump/src/log.rs @@ -368,7 +368,7 @@ impl Display for LogEntry { observed, } => write!( f, - "Unexected field {}. Expected: [{}], observed: {}", + #"Unexected field {}. Expected one of: {{{}}}, observed: {}"#, field_name, expected .iter() @@ -381,7 +381,17 @@ impl Display for LogEntry { arg_name, expected, observed, - } => write!(f, "Unexected argument"), + } => write!( + f, + "Unexpected argument {}. Expected one of: {{{}}}, observed: {}", + arg_name, + expected + .iter() + .map(|x| x.to_string()) + .collect::>() + .join(", "), + observed + ), LogEntry::MalformedFunctionName(e) => e.fmt(f), LogEntry::FunctionParameter { name, value } => write!(f, "{}: {}", name, value), } -- cgit v1.2.3