extern "C" CDECL void * debug_ptrcast(type_desc *from_ty, type_desc *to_ty, void *ptr) { rust_task *task = rust_get_current_task(); LOG(task, stdlib, "debug_ptrcast from"); debug_tydesc_helper(from_ty); LOG(task, stdlib, "to"); debug_tydesc_helper(to_ty); return ptr; }
extern "C" CDECL void debug_fn(rust_task *task, type_desc *t, rust_fn *fn) { task->log(rust_log::STDLIB, "debug_fn"); debug_tydesc_helper(task, t); task->log(rust_log::STDLIB, " thunk at 0x%" PRIxPTR, fn->thunk); task->log(rust_log::STDLIB, " closure at 0x%" PRIxPTR, fn->closure); }
extern "C" CDECL void debug_opaque(type_desc *t, uint8_t *front) { rust_task *task = rust_scheduler::get_task(); LOG(task, stdlib, "debug_opaque"); debug_tydesc_helper(t); // FIXME may want to actually account for alignment. `front` may not // indeed be the front byte of the passed-in argument. for (uintptr_t i = 0; i < t->size; ++front, ++i) { LOG(task, stdlib, " byte %" PRIdPTR ": 0x%" PRIx8, i, *front); } }
extern "C" CDECL void debug_fn(type_desc *t, fn_env_pair *fn) { rust_task *task = rust_get_current_task(); LOG(task, stdlib, "debug_fn"); debug_tydesc_helper(t); LOG(task, stdlib, " fn at 0x%" PRIxPTR, fn->f); LOG(task, stdlib, " env at 0x%" PRIxPTR, fn->env); if (fn->env) { LOG(task, stdlib, " refcount %" PRIdPTR, fn->env->ref_count); } }
extern "C" CDECL void debug_tag(type_desc *t, rust_tag *tag) { rust_task *task = rust_get_current_task(); LOG(task, stdlib, "debug_tag"); debug_tydesc_helper(t); LOG(task, stdlib, " discriminant %" PRIdPTR, tag->discriminant); for (uintptr_t i = 0; i < t->size - sizeof(tag->discriminant); ++i) LOG(task, stdlib, " byte %" PRIdPTR ": 0x%" PRIx8, i, tag->variant[i]); }
extern "C" CDECL void debug_box(type_desc *t, rust_opaque_box *box) { rust_task *task = rust_get_current_task(); LOG(task, stdlib, "debug_box(0x%" PRIxPTR ")", box); debug_tydesc_helper(t); LOG(task, stdlib, " refcount %" PRIdPTR, box->ref_count - 1); // -1 because we ref'ed for this call uint8_t *data = (uint8_t *)box_body(box); for (uintptr_t i = 0; i < t->size; ++i) { LOG(task, stdlib, " byte %" PRIdPTR ": 0x%" PRIx8, i, data[i]); } }
extern "C" CDECL void debug_tag(rust_task *task, type_desc *t, rust_tag *tag) { task->log(rust_log::STDLIB, "debug_tag"); debug_tydesc_helper(task, t); task->log(rust_log::STDLIB, " discriminant %" PRIdPTR, tag->discriminant); for (uintptr_t i = 0; i < t->size - sizeof(tag->discriminant); ++i) task->log(rust_log::STDLIB, " byte %" PRIdPTR ": 0x%" PRIx8, i, tag->variant[i]); }
extern "C" CDECL void debug_box(rust_task *task, type_desc *t, rust_box *box) { task->log(rust_log::STDLIB, "debug_box(0x%" PRIxPTR ")", box); debug_tydesc_helper(task, t); task->log(rust_log::STDLIB, " refcount %" PRIdPTR, box->ref_count - 1); // -1 because we ref'ed for this call for (uintptr_t i = 0; i < t->size; ++i) { task->log(rust_log::STDLIB, " byte %" PRIdPTR ": 0x%" PRIx8, i, box->data[i]); } }
extern "C" CDECL void debug_opaque(rust_task *task, type_desc *t, uint8_t *front) { task->log(rust_log::STDLIB, "debug_opaque"); debug_tydesc_helper(task, t); // FIXME may want to actually account for alignment. `front` may not // indeed be the front byte of the passed-in argument. for (uintptr_t i = 0; i < t->size; ++front, ++i) { task->log(rust_log::STDLIB, " byte %" PRIdPTR ": 0x%" PRIx8, i, *front); } }
extern "C" CDECL void debug_opaque(type_desc *t, uint8_t *front) { rust_task *task = rust_get_current_task(); LOG(task, stdlib, "debug_opaque"); debug_tydesc_helper(t); // Account for alignment. `front` may not indeed be the // front byte of the passed-in argument if (((uintptr_t)front % t->align) != 0) { front = (uint8_t *)align_to((uintptr_t)front, (size_t)t->align); } for (uintptr_t i = 0; i < t->size; ++front, ++i) { LOG(task, stdlib, " byte %" PRIdPTR ": 0x%" PRIx8, i, *front); } }
extern "C" CDECL void debug_obj(rust_task *task, type_desc *t, rust_obj *obj, size_t nmethods, size_t nbytes) { task->log(rust_log::STDLIB, "debug_obj with %" PRIdPTR " methods", nmethods); debug_tydesc_helper(task, t); task->log(rust_log::STDLIB, " vtbl at 0x%" PRIxPTR, obj->vtbl); task->log(rust_log::STDLIB, " body at 0x%" PRIxPTR, obj->body); for (uintptr_t *p = obj->vtbl; p < obj->vtbl + nmethods; ++p) task->log(rust_log::STDLIB, " vtbl word: 0x%" PRIxPTR, *p); for (uintptr_t i = 0; i < nbytes; ++i) task->log(rust_log::STDLIB, " body byte %" PRIdPTR ": 0x%" PRIxPTR, i, obj->body->data[i]); }
extern "C" CDECL void debug_tydesc(type_desc *t) { rust_task *task = rust_get_current_task(); LOG(task, stdlib, "debug_tydesc"); debug_tydesc_helper(t); }
extern "C" CDECL void debug_tydesc(rust_task *task, type_desc *t) { task->log(rust_log::STDLIB, "debug_tydesc"); debug_tydesc_helper(task, t); }