add more debugging output for a JIT-buffer-overflow internal error

Show the content of the buffer and the content of the temporary buffer
used to predict the size; then, I should be able to track down the
source of a mismatch.
This commit is contained in:
Matthew Flatt 2014-06-25 07:44:08 +01:00
parent b6e96f0bf0
commit 94a5c6e3fb

View File

@ -369,10 +369,35 @@ void *scheme_generate_one(mz_jit_state *old_jitter,
jitter->limit = (char *)jitter->limit + padding; jitter->limit = (char *)jitter->limit + padding;
if (PAST_LIMIT() || (jitter->retain_start if (PAST_LIMIT() || (jitter->retain_start
&& (jitter->retained > num_retained))) { && (jitter->retained > num_retained))) {
scheme_console_printf("JIT buffer overflow: %p [%p,%p] (%d)!!\n", scheme_console_printf("internal error in JIT;\n"
" ending address %p not in [%p,%p] (%d)\n",
jit_get_ip(), jit_get_ip(),
buffer, jitter->limit, buffer, jitter->limit,
!!jitter->retain_start); !!jitter->retain_start);
if (jitter->retain_start) {
const char *bp = buffer, *tend;
scheme_console_printf(" buffer content: {\n");
while (bp < jitter->limit) {
int d = 16;
while (d-- && (bp < jitter->limit)) {
scheme_console_printf("%d,", *(unsigned char *)(bp++));
}
scheme_console_printf("\n");
}
scheme_console_printf("}\n");
bp = jit_buffer_cache;
tend = jit_buffer_cache + (jitter->limit - (char *)buffer);
scheme_console_printf(" temporary buffer content: {\n");
while (bp < tend) {
int d = 16;
while (d-- && (bp < tend)) {
scheme_console_printf("%d,", *(unsigned char *)(bp++));
}
scheme_console_printf("\n");
}
scheme_console_printf("}\n");
}
scheme_log_abort("internal error: JIT buffer overflow");
abort(); abort();
} }