From 94a5c6e3fbe9f2c3b94207866bfef1ef6ed30f40 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Wed, 25 Jun 2014 07:44:08 +0100 Subject: [PATCH] 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. --- racket/src/racket/src/jitstate.c | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/racket/src/racket/src/jitstate.c b/racket/src/racket/src/jitstate.c index d2dfd4a08a..84b7352b2b 100644 --- a/racket/src/racket/src/jitstate.c +++ b/racket/src/racket/src/jitstate.c @@ -369,10 +369,35 @@ void *scheme_generate_one(mz_jit_state *old_jitter, jitter->limit = (char *)jitter->limit + padding; if (PAST_LIMIT() || (jitter->retain_start && (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(), buffer, jitter->limit, !!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(); }