|
|
@ -154,20 +154,20 @@ void duk_debug_dump_hobject(duk_hobject *obj) { |
|
|
|
DUK_D(DUK_DPRINT(" %sspecial_stringobj", DUK_HOBJECT_HAS_SPECIAL_STRINGOBJ(obj) ? str_empty : str_excl)); |
|
|
|
DUK_D(DUK_DPRINT(" %sspecial_arguments", DUK_HOBJECT_HAS_SPECIAL_ARGUMENTS(obj) ? str_empty : str_excl)); |
|
|
|
|
|
|
|
DUK_DPRINT(" class: number %d -> %s", |
|
|
|
(int) DUK_HOBJECT_GET_CLASS_NUMBER(obj), |
|
|
|
duk__class_names[(DUK_HOBJECT_GET_CLASS_NUMBER(obj)) & ((1 << DUK_HOBJECT_FLAG_CLASS_BITS) - 1)]); |
|
|
|
DUK_D(DUK_DPRINT(" class: number %d -> %s", |
|
|
|
(int) DUK_HOBJECT_GET_CLASS_NUMBER(obj), |
|
|
|
duk__class_names[(DUK_HOBJECT_GET_CLASS_NUMBER(obj)) & ((1 << DUK_HOBJECT_FLAG_CLASS_BITS) - 1)])); |
|
|
|
|
|
|
|
DUK_DPRINT(" prototype: %p -> %!O", |
|
|
|
(void *) obj->prototype, |
|
|
|
(duk_heaphdr *) obj->prototype); |
|
|
|
DUK_D(DUK_DPRINT(" prototype: %p -> %!O", |
|
|
|
(void *) obj->prototype, |
|
|
|
(duk_heaphdr *) obj->prototype)); |
|
|
|
|
|
|
|
DUK_DPRINT(" props: p=%p, e_size=%d, e_used=%d, a_size=%d, h_size=%d", |
|
|
|
(void *) obj->p, |
|
|
|
(int) obj->e_size, |
|
|
|
(int) obj->e_used, |
|
|
|
(int) obj->a_size, |
|
|
|
(int) obj->h_size); |
|
|
|
DUK_D(DUK_DPRINT(" props: p=%p, e_size=%d, e_used=%d, a_size=%d, h_size=%d", |
|
|
|
(void *) obj->p, |
|
|
|
(int) obj->e_size, |
|
|
|
(int) obj->e_used, |
|
|
|
(int) obj->a_size, |
|
|
|
(int) obj->h_size)); |
|
|
|
|
|
|
|
/*
|
|
|
|
* Object (struct layout) specific dumping. Inline code here |
|
|
@ -183,18 +183,18 @@ void duk_debug_dump_hobject(duk_hobject *obj) { |
|
|
|
DUK_D(DUK_DPRINT(" nargs: %d", (int) h->nargs)); |
|
|
|
|
|
|
|
if (h->data && DUK_HBUFFER_HAS_DYNAMIC(h->data) && DUK_HBUFFER_GET_DATA_PTR(h->data)) { |
|
|
|
DUK_DPRINT(" consts: %p (%d, %d bytes)", |
|
|
|
(void *) DUK_HCOMPILEDFUNCTION_GET_CONSTS_BASE(h), |
|
|
|
(int) DUK_HCOMPILEDFUNCTION_GET_CONSTS_COUNT(h), |
|
|
|
(int) DUK_HCOMPILEDFUNCTION_GET_CONSTS_SIZE(h)); |
|
|
|
DUK_DPRINT(" funcs: %p (%d, %d bytes)", |
|
|
|
(void *) DUK_HCOMPILEDFUNCTION_GET_FUNCS_BASE(h), |
|
|
|
(int) DUK_HCOMPILEDFUNCTION_GET_FUNCS_COUNT(h), |
|
|
|
(int) DUK_HCOMPILEDFUNCTION_GET_FUNCS_SIZE(h)); |
|
|
|
DUK_DPRINT(" bytecode: %p (%d, %d bytes)", |
|
|
|
(void *) DUK_HCOMPILEDFUNCTION_GET_CODE_BASE(h), |
|
|
|
(int) DUK_HCOMPILEDFUNCTION_GET_CODE_COUNT(h), |
|
|
|
(int) DUK_HCOMPILEDFUNCTION_GET_CODE_SIZE(h)); |
|
|
|
DUK_D(DUK_DPRINT(" consts: %p (%d, %d bytes)", |
|
|
|
(void *) DUK_HCOMPILEDFUNCTION_GET_CONSTS_BASE(h), |
|
|
|
(int) DUK_HCOMPILEDFUNCTION_GET_CONSTS_COUNT(h), |
|
|
|
(int) DUK_HCOMPILEDFUNCTION_GET_CONSTS_SIZE(h))); |
|
|
|
DUK_D(DUK_DPRINT(" funcs: %p (%d, %d bytes)", |
|
|
|
(void *) DUK_HCOMPILEDFUNCTION_GET_FUNCS_BASE(h), |
|
|
|
(int) DUK_HCOMPILEDFUNCTION_GET_FUNCS_COUNT(h), |
|
|
|
(int) DUK_HCOMPILEDFUNCTION_GET_FUNCS_SIZE(h))); |
|
|
|
DUK_D(DUK_DPRINT(" bytecode: %p (%d, %d bytes)", |
|
|
|
(void *) DUK_HCOMPILEDFUNCTION_GET_CODE_BASE(h), |
|
|
|
(int) DUK_HCOMPILEDFUNCTION_GET_CODE_COUNT(h), |
|
|
|
(int) DUK_HCOMPILEDFUNCTION_GET_CODE_SIZE(h))); |
|
|
|
} else { |
|
|
|
DUK_D(DUK_DPRINT(" consts: ???")); |
|
|
|
DUK_D(DUK_DPRINT(" funcs: ???")); |
|
|
@ -214,18 +214,18 @@ void duk_debug_dump_hobject(duk_hobject *obj) { |
|
|
|
DUK_D(DUK_DPRINT(" strict: %d", (int) thr->strict)); |
|
|
|
DUK_D(DUK_DPRINT(" state: %d", (int) thr->state)); |
|
|
|
|
|
|
|
DUK_DPRINT(" valstack_max: %d, callstack_max:%d, catchstack_max: %d", |
|
|
|
thr->valstack_max, thr->callstack_max, thr->catchstack_max); |
|
|
|
DUK_D(DUK_DPRINT(" valstack_max: %d, callstack_max:%d, catchstack_max: %d", |
|
|
|
thr->valstack_max, thr->callstack_max, thr->catchstack_max)); |
|
|
|
|
|
|
|
DUK_DPRINT(" callstack: ptr %p, size %d, top %d, preventcount %d, used size %d entries (%d bytes), alloc size %d entries (%d bytes)", |
|
|
|
(void *) thr->callstack, |
|
|
|
thr->callstack_size, |
|
|
|
thr->callstack_top, |
|
|
|
thr->callstack_preventcount, |
|
|
|
thr->callstack_top, |
|
|
|
thr->callstack_top * sizeof(duk_activation), |
|
|
|
thr->callstack_size, |
|
|
|
thr->callstack_size * sizeof(duk_activation)); |
|
|
|
DUK_D(DUK_DPRINT(" callstack: ptr %p, size %d, top %d, preventcount %d, used size %d entries (%d bytes), alloc size %d entries (%d bytes)", |
|
|
|
(void *) thr->callstack, |
|
|
|
thr->callstack_size, |
|
|
|
thr->callstack_top, |
|
|
|
thr->callstack_preventcount, |
|
|
|
thr->callstack_top, |
|
|
|
thr->callstack_top * sizeof(duk_activation), |
|
|
|
thr->callstack_size, |
|
|
|
thr->callstack_size * sizeof(duk_activation))); |
|
|
|
|
|
|
|
DUK_DEBUG_SUMMARY_INIT(); |
|
|
|
DUK_DEBUG_SUMMARY_CHAR('['); |
|
|
@ -252,18 +252,18 @@ void duk_debug_dump_hobject(duk_hobject *obj) { |
|
|
|
DUK_DEBUG_SUMMARY_CHAR(']'); |
|
|
|
DUK_DEBUG_SUMMARY_FINISH(); |
|
|
|
|
|
|
|
DUK_DPRINT(" valstack: ptr %p, end %p (%d), bottom %p (%d), top %p (%d), used size %d entries (%d bytes), alloc size %d entries (%d bytes)", |
|
|
|
(void *) thr->valstack, |
|
|
|
(void *) thr->valstack_end, |
|
|
|
(int) (thr->valstack_end - thr->valstack), |
|
|
|
(void *) thr->valstack_bottom, |
|
|
|
(int) (thr->valstack_bottom - thr->valstack), |
|
|
|
(void *) thr->valstack_top, |
|
|
|
(int) (thr->valstack_top - thr->valstack), |
|
|
|
(int) (thr->valstack_top - thr->valstack), |
|
|
|
(int) (thr->valstack_top - thr->valstack) * sizeof(duk_tval), |
|
|
|
(int) (thr->valstack_end - thr->valstack), |
|
|
|
(int) (thr->valstack_end - thr->valstack) * sizeof(duk_tval)); |
|
|
|
DUK_D(DUK_DPRINT(" valstack: ptr %p, end %p (%d), bottom %p (%d), top %p (%d), used size %d entries (%d bytes), alloc size %d entries (%d bytes)", |
|
|
|
(void *) thr->valstack, |
|
|
|
(void *) thr->valstack_end, |
|
|
|
(int) (thr->valstack_end - thr->valstack), |
|
|
|
(void *) thr->valstack_bottom, |
|
|
|
(int) (thr->valstack_bottom - thr->valstack), |
|
|
|
(void *) thr->valstack_top, |
|
|
|
(int) (thr->valstack_top - thr->valstack), |
|
|
|
(int) (thr->valstack_top - thr->valstack), |
|
|
|
(int) (thr->valstack_top - thr->valstack) * sizeof(duk_tval), |
|
|
|
(int) (thr->valstack_end - thr->valstack), |
|
|
|
(int) (thr->valstack_end - thr->valstack) * sizeof(duk_tval))); |
|
|
|
|
|
|
|
DUK_DEBUG_SUMMARY_INIT(); |
|
|
|
DUK_DEBUG_SUMMARY_CHAR('['); |
|
|
@ -294,14 +294,14 @@ void duk_debug_dump_hobject(duk_hobject *obj) { |
|
|
|
DUK_DEBUG_SUMMARY_CHAR(']'); |
|
|
|
DUK_DEBUG_SUMMARY_FINISH(); |
|
|
|
|
|
|
|
DUK_DPRINT(" catchstack: ptr %p, size %d, top %d, used size %d entries (%d bytes), alloc size %d entries (%d bytes)", |
|
|
|
(void *) thr->catchstack, |
|
|
|
thr->catchstack_size, |
|
|
|
thr->catchstack_top, |
|
|
|
thr->catchstack_top, |
|
|
|
thr->catchstack_top * sizeof(duk_catcher), |
|
|
|
thr->catchstack_size, |
|
|
|
thr->catchstack_size * sizeof(duk_catcher)); |
|
|
|
DUK_D(DUK_DPRINT(" catchstack: ptr %p, size %d, top %d, used size %d entries (%d bytes), alloc size %d entries (%d bytes)", |
|
|
|
(void *) thr->catchstack, |
|
|
|
thr->catchstack_size, |
|
|
|
thr->catchstack_top, |
|
|
|
thr->catchstack_top, |
|
|
|
thr->catchstack_top * sizeof(duk_catcher), |
|
|
|
thr->catchstack_size, |
|
|
|
thr->catchstack_size * sizeof(duk_catcher))); |
|
|
|
|
|
|
|
DUK_DEBUG_SUMMARY_INIT(); |
|
|
|
DUK_DEBUG_SUMMARY_CHAR('['); |
|
|
@ -322,8 +322,8 @@ void duk_debug_dump_hobject(duk_hobject *obj) { |
|
|
|
DUK_DEBUG_SUMMARY_CHAR(']'); |
|
|
|
DUK_DEBUG_SUMMARY_FINISH(); |
|
|
|
|
|
|
|
DUK_DPRINT(" resumer: ptr %p", |
|
|
|
(void *) thr->resumer); |
|
|
|
DUK_D(DUK_DPRINT(" resumer: ptr %p", |
|
|
|
(void *) thr->resumer)); |
|
|
|
|
|
|
|
#if 0 /* worth dumping? */
|
|
|
|
for (i = 0; i < DUK_NUM_BUILTINS; i++) { |
|
|
@ -333,8 +333,8 @@ void duk_debug_dump_hobject(duk_hobject *obj) { |
|
|
|
} |
|
|
|
|
|
|
|
if (obj->p) { |
|
|
|
DUK_DPRINT(" props alloc size: %d", |
|
|
|
(int) DUK_HOBJECT_P_COMPUTE_SIZE(obj->e_size, obj->a_size, obj->h_size)); |
|
|
|
DUK_D(DUK_DPRINT(" props alloc size: %d", |
|
|
|
(int) DUK_HOBJECT_P_COMPUTE_SIZE(obj->e_size, obj->a_size, obj->h_size))); |
|
|
|
} else { |
|
|
|
DUK_D(DUK_DPRINT(" props alloc size: n/a")); |
|
|
|
} |
|
|
@ -358,39 +358,39 @@ void duk_debug_dump_hobject(duk_hobject *obj) { |
|
|
|
} |
|
|
|
|
|
|
|
if (DUK_HOBJECT_E_SLOT_IS_ACCESSOR(obj, i)) { |
|
|
|
DUK_DPRINT(" [%d]: [w=%d e=%d c=%d a=%d] %!O -> get:%p set:%p; get %!O; set %!O", |
|
|
|
i, |
|
|
|
DUK_HOBJECT_E_SLOT_IS_WRITABLE(obj, i), |
|
|
|
DUK_HOBJECT_E_SLOT_IS_ENUMERABLE(obj, i), |
|
|
|
DUK_HOBJECT_E_SLOT_IS_CONFIGURABLE(obj, i), |
|
|
|
DUK_HOBJECT_E_SLOT_IS_ACCESSOR(obj, i), |
|
|
|
k, |
|
|
|
(void *) v->a.get, |
|
|
|
(void *) v->a.set, |
|
|
|
(duk_heaphdr *) v->a.get, |
|
|
|
(duk_heaphdr *) v->a.set); |
|
|
|
DUK_D(DUK_DPRINT(" [%d]: [w=%d e=%d c=%d a=%d] %!O -> get:%p set:%p; get %!O; set %!O", |
|
|
|
i, |
|
|
|
DUK_HOBJECT_E_SLOT_IS_WRITABLE(obj, i), |
|
|
|
DUK_HOBJECT_E_SLOT_IS_ENUMERABLE(obj, i), |
|
|
|
DUK_HOBJECT_E_SLOT_IS_CONFIGURABLE(obj, i), |
|
|
|
DUK_HOBJECT_E_SLOT_IS_ACCESSOR(obj, i), |
|
|
|
k, |
|
|
|
(void *) v->a.get, |
|
|
|
(void *) v->a.set, |
|
|
|
(duk_heaphdr *) v->a.get, |
|
|
|
(duk_heaphdr *) v->a.set)); |
|
|
|
} else { |
|
|
|
DUK_DPRINT(" [%d]: [w=%d e=%d c=%d a=%d] %!O -> %!T", |
|
|
|
i, |
|
|
|
DUK_HOBJECT_E_SLOT_IS_WRITABLE(obj, i), |
|
|
|
DUK_HOBJECT_E_SLOT_IS_ENUMERABLE(obj, i), |
|
|
|
DUK_HOBJECT_E_SLOT_IS_CONFIGURABLE(obj, i), |
|
|
|
DUK_HOBJECT_E_SLOT_IS_ACCESSOR(obj, i), |
|
|
|
k, |
|
|
|
&v->v); |
|
|
|
DUK_D(DUK_DPRINT(" [%d]: [w=%d e=%d c=%d a=%d] %!O -> %!T", |
|
|
|
i, |
|
|
|
DUK_HOBJECT_E_SLOT_IS_WRITABLE(obj, i), |
|
|
|
DUK_HOBJECT_E_SLOT_IS_ENUMERABLE(obj, i), |
|
|
|
DUK_HOBJECT_E_SLOT_IS_CONFIGURABLE(obj, i), |
|
|
|
DUK_HOBJECT_E_SLOT_IS_ACCESSOR(obj, i), |
|
|
|
k, |
|
|
|
&v->v)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
DUK_D(DUK_DPRINT(" array entries:")); |
|
|
|
for (i = 0; i < obj->a_size; i++) { |
|
|
|
DUK_DPRINT(" [%d]: [w=%d e=%d c=%d a=%d] %d -> %!T", |
|
|
|
i, |
|
|
|
1, /* implicit attributes */ |
|
|
|
1, |
|
|
|
1, |
|
|
|
0, |
|
|
|
i, |
|
|
|
DUK_HOBJECT_A_GET_VALUE_PTR(obj, i)); |
|
|
|
DUK_D(DUK_DPRINT(" [%d]: [w=%d e=%d c=%d a=%d] %d -> %!T", |
|
|
|
i, |
|
|
|
1, /* implicit attributes */ |
|
|
|
1, |
|
|
|
1, |
|
|
|
0, |
|
|
|
i, |
|
|
|
DUK_HOBJECT_A_GET_VALUE_PTR(obj, i))); |
|
|
|
} |
|
|
|
|
|
|
|
DUK_D(DUK_DPRINT(" hash entries:")); |
|
|
@ -401,9 +401,9 @@ void duk_debug_dump_hobject(duk_hobject *obj) { |
|
|
|
} else if (t == DUK_HOBJECT_HASHIDX_DELETED) { |
|
|
|
DUK_D(DUK_DPRINT(" [%d]: deleted", i)); |
|
|
|
} else { |
|
|
|
DUK_DPRINT(" [%d]: %d", |
|
|
|
i, |
|
|
|
(int) t); |
|
|
|
DUK_D(DUK_DPRINT(" [%d]: %d", |
|
|
|
i, |
|
|
|
(int) t)); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -411,9 +411,9 @@ void duk_debug_dump_hobject(duk_hobject *obj) { |
|
|
|
void duk_debug_dump_callstack(duk_hthread *thr) { |
|
|
|
duk_uint_fast32_t i; |
|
|
|
|
|
|
|
DUK_DPRINT("=== hthread %p callstack: %d entries ===", |
|
|
|
(void *) thr, |
|
|
|
(thr == NULL ? 0 : thr->callstack_top)); |
|
|
|
DUK_D(DUK_DPRINT("=== hthread %p callstack: %d entries ===", |
|
|
|
(void *) thr, |
|
|
|
(thr == NULL ? 0 : thr->callstack_top))); |
|
|
|
if (!thr) { |
|
|
|
return; |
|
|
|
} |
|
|
@ -427,16 +427,16 @@ void duk_debug_dump_callstack(duk_hthread *thr) { |
|
|
|
this_binding = NULL; |
|
|
|
} |
|
|
|
|
|
|
|
DUK_DPRINT(" [%d] -> flags=0x%08x, func=%!O, var_env=%!iO, lex_env=%!iO, pc=%d, idx_bottom=%d, idx_retval=%d, this_binding=%!T", |
|
|
|
i, |
|
|
|
act->flags, |
|
|
|
(duk_heaphdr *) act->func, |
|
|
|
(duk_heaphdr *) act->var_env, |
|
|
|
(duk_heaphdr *) act->lex_env, |
|
|
|
act->pc, |
|
|
|
act->idx_bottom, |
|
|
|
act->idx_retval, |
|
|
|
this_binding); |
|
|
|
DUK_D(DUK_DPRINT(" [%d] -> flags=0x%08x, func=%!O, var_env=%!iO, lex_env=%!iO, pc=%d, idx_bottom=%d, idx_retval=%d, this_binding=%!T", |
|
|
|
i, |
|
|
|
act->flags, |
|
|
|
(duk_heaphdr *) act->func, |
|
|
|
(duk_heaphdr *) act->var_env, |
|
|
|
(duk_heaphdr *) act->lex_env, |
|
|
|
act->pc, |
|
|
|
act->idx_bottom, |
|
|
|
act->idx_retval, |
|
|
|
this_binding)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@ -451,16 +451,16 @@ void duk_debug_dump_activation(duk_hthread *thr, duk_activation *act) { |
|
|
|
this_binding = NULL; |
|
|
|
} |
|
|
|
|
|
|
|
DUK_DPRINT("duk_activation: %p -> flags=0x%08x, func=%!O, var_env=%!O, lex_env=%!O, pc=%d, idx_bottom=%d, idx_retval=%d, this_binding=%!T", |
|
|
|
(void *) act, |
|
|
|
act->flags, |
|
|
|
(duk_heaphdr *) act->func, |
|
|
|
(duk_heaphdr *) act->var_env, |
|
|
|
(duk_heaphdr *) act->lex_env, |
|
|
|
act->pc, |
|
|
|
act->idx_bottom, |
|
|
|
act->idx_retval, |
|
|
|
this_binding); |
|
|
|
DUK_D(DUK_DPRINT("duk_activation: %p -> flags=0x%08x, func=%!O, var_env=%!O, lex_env=%!O, pc=%d, idx_bottom=%d, idx_retval=%d, this_binding=%!T", |
|
|
|
(void *) act, |
|
|
|
act->flags, |
|
|
|
(duk_heaphdr *) act->func, |
|
|
|
(duk_heaphdr *) act->var_env, |
|
|
|
(duk_heaphdr *) act->lex_env, |
|
|
|
act->pc, |
|
|
|
act->idx_bottom, |
|
|
|
act->idx_retval, |
|
|
|
this_binding)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|