* symfile.c (reread_symbols): When re-reading symbols, do all the
[binutils-gdb.git] / gdb / c-lang.c
index df882100f1a3df460cac4ced0b738a9325feeeb7..ea0795915f5622685ea893a332728b8f93c6e76d 100644 (file)
@@ -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) && length > 0 && string[length-1] == '\0')
+    length--;
+
   if (length == 0)
     {
       fputs_filtered ("\"\"", stdout);
@@ -402,9 +408,9 @@ const struct language_defn c_language_defn = {
   &BUILTIN_TYPE_UNSIGNED_LONGEST,/* longest unsigned integral type */
   &builtin_type_double,                /* longest floating point type */ /*FIXME*/
   {"",     "",    "",  ""},    /* Binary format info */
-  {"0%o",  "0",   "o", ""},    /* Octal format info */
-  {"%d",   "",    "d", ""},    /* Decimal format info */
-  {"0x%x", "0x",  "x", ""},    /* Hex format info */
+  {"0%lo",  "0",   "o", ""},   /* Octal format info */
+  {"%ld",   "",    "d", ""},   /* Decimal format info */
+  {"0x%lx", "0x",  "x", ""},   /* Hex format info */
   c_op_print_tab,              /* expression operators for printing */
   LANG_MAGIC
 };
@@ -426,9 +432,9 @@ const struct language_defn cplus_language_defn = {
   &BUILTIN_TYPE_UNSIGNED_LONGEST,/* longest unsigned integral type */
   &builtin_type_double,                /* longest floating point type */ /*FIXME*/
   {"",      "",    "",   ""},  /* Binary format info */
-  {"0%o",   "0",   "o",  ""},  /* Octal format info */
-  {"%d",    "",    "d",  ""},  /* Decimal format info */
-  {"0x%x",  "0x",  "x",  ""},  /* Hex format info */
+  {"0%lo",   "0",   "o",  ""}, /* Octal format info */
+  {"%ld",    "",    "d",  ""}, /* Decimal format info */
+  {"0x%lx",  "0x",  "x",  ""}, /* Hex format info */
   c_op_print_tab,              /* expression operators for printing */
   LANG_MAGIC
 };