diff --git a/src/venus/vkr_common.h b/src/venus/vkr_common.h index ce176d5..ab45a90 100644 --- a/src/venus/vkr_common.h +++ b/src/venus/vkr_common.h @@ -10,6 +10,7 @@ #include #include +#include #include #include #include diff --git a/src/venus/vkr_cs.c b/src/venus/vkr_cs.c index bd9b0aa..1eeb268 100644 --- a/src/venus/vkr_cs.c +++ b/src/venus/vkr_cs.c @@ -99,6 +99,7 @@ vkr_cs_encoder_seek_stream(struct vkr_cs_encoder *enc, size_t pos) size_t iov_offset; if (pos > enc->stream.size || !vkr_cs_encoder_translate_stream_offset(enc, offset, &iov_index, &iov_offset)) { + vkr_log("failed to seek the reply stream to %zu", pos); vkr_cs_encoder_set_fatal(enc); return; } @@ -158,6 +159,7 @@ vkr_cs_encoder_write_internal(struct vkr_cs_encoder *enc, size_t ptr_size; uint8_t *ptr = vkr_cs_encoder_get_ptr(enc, val_size, &ptr_size); if (unlikely(!ptr)) { + vkr_log("failed to write value to the reply stream"); vkr_cs_encoder_set_fatal(enc); return; } @@ -171,6 +173,7 @@ vkr_cs_encoder_write_internal(struct vkr_cs_encoder *enc, size_t ptr_size; const void *ptr = vkr_cs_encoder_get_ptr(enc, pad_size, &ptr_size); if (unlikely(!ptr)) { + vkr_log("failed to write padding to the reply stream"); vkr_cs_encoder_set_fatal(enc); return; } diff --git a/src/venus/vkr_cs.h b/src/venus/vkr_cs.h index b6baf57..bf77212 100644 --- a/src/venus/vkr_cs.h +++ b/src/venus/vkr_cs.h @@ -160,6 +160,7 @@ vkr_cs_decoder_peek_internal(const struct vkr_cs_decoder *dec, assert(val_size <= size); if (unlikely(size > (size_t)(dec->end - dec->cur))) { + vkr_log("failed to peek %zu bytes", size); vkr_cs_decoder_set_fatal(dec); memset(val, 0, val_size); return false; @@ -199,8 +200,13 @@ vkr_cs_decoder_lookup_object(const struct vkr_cs_decoder *dec, const struct hash_entry *entry = _mesa_hash_table_search((struct hash_table *)dec->object_table, &id); obj = likely(entry) ? entry->data : NULL; - if (!obj || obj->type != type) + if (unlikely(!obj || obj->type != type)) { + if (obj) + vkr_log("object " PRIu64 " has type %d, not %d", id, obj->type, type); + else + vkr_log("failed to look up object " PRIu64, id); vkr_cs_decoder_set_fatal(dec); + } return obj; } @@ -222,6 +228,7 @@ vkr_cs_decoder_alloc_temp(struct vkr_cs_decoder *dec, size_t size) if (unlikely(size > (size_t)(pool->end - pool->cur))) { if (!vkr_cs_decoder_alloc_temp_internal(dec, size)) { + vkr_log("failed to suballocate %zu bytes from the temp pool", size); vkr_cs_decoder_set_fatal(dec); return NULL; }