Skip to content

Commit

Permalink
Improve decode block error logging
Browse files Browse the repository at this point in the history
When a decode block error occurs, indicate which frame and block
are responsible.  This should help at least diagnose if a block
is at the begining or end of a trace.
  • Loading branch information
MarkY-LunarG committed Nov 15, 2023
1 parent 2e86074 commit 900aac0
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions framework/decode/file_processor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,10 @@ bool FileProcessor::ProcessBlocks()
else
{
// Unrecognized block type.
GFXRECON_LOG_WARNING("Skipping unrecognized file block with type %u", block_header.type);
GFXRECON_LOG_WARNING("Skipping unrecognized file block with type %u (frame %lu block %lu)",
block_header.type,
current_frame_number_,
block_index_);
GFXRECON_CHECK_CONVERSION_DATA_LOSS(size_t, block_header.size);
success = SkipBytes(static_cast<size_t>(block_header.size));
}
Expand All @@ -413,7 +416,8 @@ bool FileProcessor::ProcessBlocks()
// end of file warning when the file is at EOF without an error. For this case (the normal EOF case)
// we print nothing at EOF, or print an error message and set the error code directly when not at
// EOF.
GFXRECON_LOG_ERROR("Failed to read block header");
GFXRECON_LOG_ERROR(
"Failed to read block header (frame %lu block %lu)", current_frame_number_, block_index_);
error_state_ = kErrorReadingBlockHeader;
}
}
Expand Down Expand Up @@ -507,7 +511,7 @@ void FileProcessor::HandleBlockReadError(Error error_code, const char* error_mes
}
else
{
GFXRECON_LOG_ERROR("%s", error_message);
GFXRECON_LOG_ERROR("%s (frame %lu block %lu)", error_message, current_frame_number_, block_index_);
error_state_ = error_code;
}
}
Expand Down

0 comments on commit 900aac0

Please sign in to comment.