src/.gdbinit (xprintstr, xprintbytestr): Don't use repetition count
of zero to print strings, GDB doesn't like it.
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
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.
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)