From 824a51e6a51e5065a24c918c4aab736ba075c5fc Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Wed, 29 Jan 2014 20:17:20 +0200 Subject: [PATCH] Fix printing empty Lisp strings. src/.gdbinit (xprintstr, xprintbytestr): Don't use repetition count of zero to print strings, GDB doesn't like it. --- src/.gdbinit | 15 +++++++++++++-- src/ChangeLog | 3 +++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/.gdbinit b/src/.gdbinit index 3fdda5a1abf..715744bc18e 100644 --- a/src/.gdbinit +++ b/src/.gdbinit @@ -1072,7 +1072,13 @@ end define xprintstr set $data = (char *) $arg0->data - output ($arg0->size > 1000) ? 0 : ($data[0])@($arg0->size_byte < 0 ? $arg0->size & ~ARRAY_MARK_FLAG : $arg0->size_byte) + set $strsize = ($arg0->size_byte < 0) ? ($arg0->size & ~ARRAY_MARK_FLAG) : $arg0->size_byte + # GDB doesn't like zero repetition counts + if $strsize == 0 + output "" + else + output ($arg0->size > 1000) ? 0 : ($data[0])@($strsize) + end end define xprintsym @@ -1184,8 +1190,13 @@ end define xprintbytestr set $data = (char *) $arg0->data + set $bstrsize = ($arg0->size_byte < 0) ? ($arg0->size & ~ARRAY_MARK_FLAG) : $arg0->size_byte printf "Bytecode: " - output/u ($arg0->size > 1000) ? 0 : ($data[0])@($arg0->size_byte < 0 ? $arg0->size & ~ARRAY_MARK_FLAG : $arg0->size_byte) + if $bstrsize > 0 + output/u ($arg0->size > 1000) ? 0 : ($data[0])@($bvsize) + else + printf "" + end end document xprintbytestr Print a string of byte code. diff --git a/src/ChangeLog b/src/ChangeLog index 33ffc40d8c1..86c07c52937 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,8 @@ 2014-01-29 Eli Zaretskii + * .gdbinit (xprintstr, xprintbytestr): Don't use repetition count + of zero to print strings, GDB doesn't like it. + * print.c (print_object): Use FETCH_STRING_CHAR_ADVANCE, not STRING_CHAR_AND_LENGTH, so that if the string is relocated by GC, we still use correct addresses. (Bug#16576) -- 2.39.2