예제 #1
0
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;
}
예제 #2
0
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);
}
예제 #3
0
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);
    }
}
예제 #4
0
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);
    }
}
예제 #5
0
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]);
}
예제 #6
0
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]);
    }
}
예제 #7
0
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]);
}
예제 #8
0
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]);
    }
}
예제 #9
0
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);
    }
}
예제 #10
0
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);
    }
}
예제 #11
0
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]);
}
예제 #12
0
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);
}
예제 #13
0
extern "C" CDECL void
debug_tydesc(rust_task *task, type_desc *t)
{
    task->log(rust_log::STDLIB, "debug_tydesc");
    debug_tydesc_helper(task, t);
}