>From 2154060e21c6d74d46cf274abaa716bec8fd2ac5 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 | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/comp.c b/src/comp.c index d3bff1e4cf..179e97a551 100644 --- a/src/comp.c +++ b/src/comp.c @@ -2392,8 +2392,12 @@ 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); + 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.17.1