* c-exp.y (exp:STRING): Convert C strings into array-of-char
[deliverable/binutils-gdb.git] / gdb / ch-valprint.c
index b53326add914f9d2d16c063d763371dc7f6d1230..c465fc319c51ecb295357a505fb5e61c7a664a5e 100644 (file)
@@ -172,6 +172,26 @@ chill_val_print (type, valaddr, address, stream, format, deref_ref, recurse,
       return (i + (print_max && i != print_max));
       break;
 
+    case TYPE_CODE_STRING:
+      if (format && format != 's')
+       {
+         print_scalar_formatted (valaddr, type, format, 0, stream);
+         break;
+       }
+      addr = unpack_pointer (lookup_pointer_type (builtin_type_char), valaddr);
+      if (addressprint && format != 's')
+       {
+         fprintf_filtered (stream, "0x%x", addr);
+       }
+      if (addr != 0)
+       {
+         i = val_print_string (addr, TYPE_LENGTH (type), stream);
+       }
+      /* Return number of characters printed, plus one for the terminating
+        null if we have "reached the end".  */
+      return (i + (print_max && i != print_max));
+      break;
+
     case TYPE_CODE_MEMBER:
     case TYPE_CODE_REF:
     case TYPE_CODE_UNION:
This page took 0.023405 seconds and 4 git commands to generate.