From: Eli Zaretskii Date: Wed, 29 Jan 2014 18:17:20 +0000 (+0200) Subject: Fix printing empty Lisp strings. X-Git-Tag: emacs-24.3.90~173^2^2~42^2~45^2~238 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=824a51e6a51e5065a24c918c4aab736ba075c5fc;p=emacs.git Fix printing empty Lisp strings. src/.gdbinit (xprintstr, xprintbytestr): Don't use repetition count of zero to print strings, GDB doesn't like it. --- 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)