]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix printing empty Lisp strings.
authorEli Zaretskii <eliz@gnu.org>
Wed, 29 Jan 2014 18:17:20 +0000 (20:17 +0200)
committerEli Zaretskii <eliz@gnu.org>
Wed, 29 Jan 2014 18:17:20 +0000 (20:17 +0200)
 src/.gdbinit (xprintstr, xprintbytestr): Don't use repetition count
 of zero to print strings, GDB doesn't like it.

src/.gdbinit
src/ChangeLog

index 3fdda5a1abf6e69eb0751fe2359c139406c3f2c3..715744bc18eabc5ef227134aed340b8b6b9a795c 100644 (file)
@@ -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.
index 33ffc40d8c1cd362f73ae630cc216d07e2141ee1..86c07c52937877374cdd1274112a2e862c0189ea 100644 (file)
@@ -1,5 +1,8 @@
 2014-01-29  Eli Zaretskii  <eliz@gnu.org>
 
+       * .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)