Fix possible failure in backtrace info
Make sure to ignore static snapshots when sending backtrace information to the debugger.
The `JMEM_SET_NON_NULL_POINTER` macro requires the frame context's `bytecode_header_p` pointer to be a heap pointer, but due to the static snapshot it might not be, causing an assertion failure.
JerryScript-DCO-1.0-Signed-off-by: Daniel Balla
@@ -129,8 +129,11 @@ jerry_debugger_send_backtrace (const uint8_t *recv_buffer_p) /**< pointer to the
vm_frame_ctx_t *iter_frame_ctx_p = JERRY_CONTEXT (vm_top_context_p);
uint32_t frame_count = 0;
while (iter_frame_ctx_p != NULL)
+ {
+ if (!(iter_frame_ctx_p->bytecode_header_p->status_flags & (CBC_CODE_FLAGS_STATIC_FUNCTION)))
{
frame_count++;
+ }
iter_frame_ctx_p = iter_frame_ctx_p->prev_context_p;
}
memcpy (backtrace_total_p->frame_count, &frame_count, sizeof (frame_count));
@@ -160,7 +163,8 @@ jerry_debugger_send_backtrace (const uint8_t *recv_buffer_p) /**< pointer to the
while (frame_ctx_p != NULL && min_depth_offset++ < max_depth)
{
- if (frame_ctx_p->bytecode_header_p->status_flags & CBC_CODE_FLAGS_DEBUGGER_IGNORE)
+ if (frame_ctx_p->bytecode_header_p->status_flags
+ & (CBC_CODE_FLAGS_DEBUGGER_IGNORE | CBC_CODE_FLAGS_STATIC_FUNCTION))
{
frame_ctx_p = frame_ctx_p->prev_context_p;
continue;
