From c5c00171a20baef8541b9d61df233546e6e4d3bf Mon Sep 17 00:00:00 2001 From: John Gilmore Date: Thu, 18 Feb 1993 12:18:23 +0000 Subject: [PATCH] * c-lang.c (c_printstr): If a C string ends in a null, don't print the null. --- gdb/ChangeLog | 5 +++++ gdb/c-lang.c | 8 +++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 5c98abaa054..b528a9977c9 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +Thu Feb 18 04:10:06 1993 John Gilmore (gnu@cygnus.com) + + * c-lang.c (c_printstr): If a C string ends in a null, don't + print the null. + Thu Feb 18 02:39:21 1993 Stu Grossman (grossman at cygnus.com) * defs.h (STRCMP): Make it work for unsigned chars. diff --git a/gdb/c-lang.c b/gdb/c-lang.c index df882100f1a..bfa03d0a590 100644 --- a/gdb/c-lang.c +++ b/gdb/c-lang.c @@ -1,5 +1,5 @@ /* C language support routines for GDB, the GNU debugger. - Copyright 1992 Free Software Foundation, Inc. + Copyright 1992, 1993 Free Software Foundation, Inc. This file is part of GDB. @@ -108,6 +108,12 @@ c_printstr (stream, string, length, force_ellipses) extern int repeat_count_threshold; extern int print_max; + /* If the string was not truncated due to `set print elements', and + the last byte of it is a null, we don't print that, in traditional C + style. */ + if ((!force_ellipses) && string[length-1] == '\0') + length--; + if (length == 0) { fputs_filtered ("\"\"", stdout);