From 5cf148cfef23b827629950048dab678f3b9af2d3 Mon Sep 17 00:00:00 2001 From: Andrea Corallo Date: Sun, 31 May 2020 12:22:46 +0100 Subject: [PATCH] * Emit better debug comments in emit_static_object * src/comp.c (emit_static_object): Do not truncate debug comments at the first NULL character. --- src/comp.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/comp.c b/src/comp.c index d3bff1e4cfe..f288fc2551a 100644 --- a/src/comp.c +++ b/src/comp.c @@ -2392,8 +2392,15 @@ emit_static_object (const char *name, Lisp_Object obj) 0, NULL, 0); DECL_BLOCK (block, f); - /* NOTE this truncates if the data has some zero byte before termination. */ - gcc_jit_block_add_comment (block, NULL, p); + if (COMP_DEBUG > 1) + { + char *comment = memcpy (xmalloc (len), p, len); + for (ptrdiff_t i = 0; i < len - 1; i++) + if (!comment[i]) + comment[i] = '\n'; + gcc_jit_block_add_comment (block, NULL, comment); + xfree (comment); + } gcc_jit_lvalue *arr = gcc_jit_lvalue_access_field (data_struct, NULL, fields[1]); -- 2.39.5