]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
* valprint.c (val_print_string): Don't print leading space.
authorTom Tromey <tromey@redhat.com>
Fri, 18 May 2012 15:29:13 +0000 (15:29 +0000)
committerTom Tromey <tromey@redhat.com>
Fri, 18 May 2012 15:29:13 +0000 (15:29 +0000)
* p-valprint.c (pascal_val_print) <TYPE_CODE_PTR>: Optionally
print space before string or vtbl.
* m2-valprint.c (print_unpacked_pointer): Optionally print space
before string.
* jv-valprint.c (java_value_print): Print space before string.
* go-valprint.c (print_go_string): Print space before string.
* f-valprint.c (f_val_print) <TYPE_CODE_PTR>: Optionally print
space before string.
* c-valprint.c (c_val_print) <TYPE_CODE_PTR>: Optionally print
space before string or vtbl.
* auxv.c (fprint_target_auxv): Print space after address.

gdb/ChangeLog
gdb/auxv.c
gdb/c-valprint.c
gdb/f-valprint.c
gdb/go-valprint.c
gdb/jv-valprint.c
gdb/m2-valprint.c
gdb/p-valprint.c
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.base/charset.exp
gdb/valprint.c

index 73e06c26224a7c48d9d95dceb97670e04dcf1f97..3793661a8678506c339056e5064159ad7786027b 100644 (file)
@@ -1,3 +1,18 @@
+2012-05-18  Tom Tromey  <tromey@redhat.com>
+
+       * valprint.c (val_print_string): Don't print leading space.
+       * p-valprint.c (pascal_val_print) <TYPE_CODE_PTR>: Optionally
+       print space before string or vtbl.
+       * m2-valprint.c (print_unpacked_pointer): Optionally print space
+       before string.
+       * jv-valprint.c (java_value_print): Print space before string.
+       * go-valprint.c (print_go_string): Print space before string.
+       * f-valprint.c (f_val_print) <TYPE_CODE_PTR>: Optionally print
+       space before string.
+       * c-valprint.c (c_val_print) <TYPE_CODE_PTR>: Optionally print
+       space before string or vtbl.
+       * auxv.c (fprint_target_auxv): Print space after address.
+
 2012-05-18  Tom Tromey  <tromey@redhat.com>
 
        * printcmd.c (print_address_demangle): Remove special case for 0.
index 23d1480689e2bca3c0119e52d5d6b9d1e209cc12..50720859e730a2e72916d2270262c220814b4afc 100644 (file)
@@ -483,7 +483,7 @@ fprint_target_auxv (struct ui_file *file, struct target_ops *ops)
 
            get_user_print_options (&opts);
            if (opts.addressprint)
-             fprintf_filtered (file, "%s", paddress (target_gdbarch, val));
+             fprintf_filtered (file, "%s ", paddress (target_gdbarch, val));
            val_print_string (builtin_type (target_gdbarch)->builtin_char,
                              NULL, val, -1, file, &opts);
            fprintf_filtered (file, "\n");
index 4e32973341726ea137e0c0efdf7dec9ac6003e2b..94118905852831b725f63dbe89c32ec18847af18 100644 (file)
@@ -254,9 +254,13 @@ c_val_print (struct type *type, const gdb_byte *valaddr,
       unresolved_elttype = TYPE_TARGET_TYPE (type);
       elttype = check_typedef (unresolved_elttype);
        {
+         int want_space;
+
          addr = unpack_pointer (type, valaddr + embedded_offset);
        print_unpacked_pointer:
 
+         want_space = 0;
+
          if (TYPE_CODE (elttype) == TYPE_CODE_FUNC)
            {
              /* Try to print what function it points to.  */
@@ -265,7 +269,10 @@ c_val_print (struct type *type, const gdb_byte *valaddr,
            }
 
          if (options->addressprint)
-           fputs_filtered (paddress (gdbarch, addr), stream);
+           {
+             fputs_filtered (paddress (gdbarch, addr), stream);
+             want_space = 1;
+           }
 
          /* For a pointer to a textual type, also print the string
             pointed to, unless pointer is null.  */
@@ -274,6 +281,8 @@ c_val_print (struct type *type, const gdb_byte *valaddr,
                                      options->format)
              && addr != 0)
            {
+             if (want_space)
+               fputs_filtered (" ", stream);
              i = val_print_string (unresolved_elttype, NULL,
                                    addr, -1,
                                    stream, options);
@@ -284,16 +293,20 @@ c_val_print (struct type *type, const gdb_byte *valaddr,
              CORE_ADDR vt_address = unpack_pointer (type,
                                                     valaddr
                                                     + embedded_offset);
-
              struct minimal_symbol *msymbol =
              lookup_minimal_symbol_by_pc (vt_address);
+
              if ((msymbol != NULL)
                  && (vt_address == SYMBOL_VALUE_ADDRESS (msymbol)))
                {
+                 if (want_space)
+                   fputs_filtered (" ", stream);
                  fputs_filtered (" <", stream);
                  fputs_filtered (SYMBOL_PRINT_NAME (msymbol), stream);
                  fputs_filtered (">", stream);
+                 want_space = 1;
                }
+
              if (vt_address && options->vtblprint)
                {
                  struct value *vt_val;
@@ -302,6 +315,9 @@ c_val_print (struct type *type, const gdb_byte *valaddr,
                  struct block *block = (struct block *) NULL;
                  int is_this_fld;
 
+                 if (want_space)
+                   fputs_filtered (" ", stream);
+
                  if (msymbol != NULL)
                    wsym = lookup_symbol (SYMBOL_LINKAGE_NAME (msymbol),
                                          block, VAR_DOMAIN,
index 3181356317967ad3de9c7bc53c9eb6419fca23ae..229bfe30ac00761e97c135661c905e2bc43a5269 100644 (file)
@@ -310,6 +310,8 @@ f_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
        }
       else
        {
+         int want_space = 0;
+
          addr = unpack_pointer (type, valaddr + embedded_offset);
          elttype = check_typedef (TYPE_TARGET_TYPE (type));
 
@@ -321,7 +323,10 @@ f_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
            }
 
          if (options->addressprint && options->format != 's')
-           fputs_filtered (paddress (gdbarch, addr), stream);
+           {
+             fputs_filtered (paddress (gdbarch, addr), stream);
+             want_space = 1;
+           }
 
          /* For a pointer to char or unsigned char, also print the string
             pointed to, unless pointer is null.  */
@@ -329,8 +334,12 @@ f_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
              && TYPE_CODE (elttype) == TYPE_CODE_INT
              && (options->format == 0 || options->format == 's')
              && addr != 0)
-           i = val_print_string (TYPE_TARGET_TYPE (type), NULL, addr, -1,
-                                 stream, options);
+           {
+             if (want_space)
+               fputs_filtered (" ", stream);
+             i = val_print_string (TYPE_TARGET_TYPE (type), NULL, addr, -1,
+                                   stream, options);
+           }
          return;
        }
       break;
index 3be4927dcc12c3e17b7c0cb02028fbc262eb1bb1..de52e9b5c026011f42b1f5396602e1a1269a4797 100644 (file)
@@ -64,7 +64,10 @@ print_go_string (struct type *type, const gdb_byte *valaddr,
 
   /* TODO(dje): Print address of struct or actual string?  */
   if (options->addressprint)
-    fputs_filtered (paddress (gdbarch, addr), stream);
+    {
+      fputs_filtered (paddress (gdbarch, addr), stream);
+      fputs_filtered (" ", stream);
+    }
 
   if (length < 0)
     {
index 9c5c245d201d07e28def0d65b0e3c895e4b99a92..d1274dd81a375577ffe7ed84aa4f295dd797a505 100644 (file)
@@ -231,6 +231,8 @@ java_value_print (struct value *val, struct ui_file *stream,
       unsigned long count;
       struct value *mark;
 
+      fputs_filtered (" ", stream);
+
       mark = value_mark ();    /* Remember start of new values.  */
 
       data_val = value_struct_elt (&val, NULL, "data", NULL, NULL);
index 015af3b0aa4273a9aa2df0d2d163d89f3b96be07..ea3f296c3081e82bcb664c90adb7a10fab04aee7 100644 (file)
@@ -195,6 +195,7 @@ print_unpacked_pointer (struct type *type,
 {
   struct gdbarch *gdbarch = get_type_arch (type);
   struct type *elttype = check_typedef (TYPE_TARGET_TYPE (type));
+  int want_space = 0;
 
   if (TYPE_CODE (elttype) == TYPE_CODE_FUNC)
     {
@@ -205,7 +206,10 @@ print_unpacked_pointer (struct type *type,
     }
 
   if (options->addressprint && options->format != 's')
-    fputs_filtered (paddress (gdbarch, address), stream);
+    {
+      fputs_filtered (paddress (gdbarch, address), stream);
+      want_space = 1;
+    }
 
   /* For a pointer to char or unsigned char, also print the string
      pointed to, unless pointer is null.  */
@@ -214,8 +218,12 @@ print_unpacked_pointer (struct type *type,
       && TYPE_CODE (elttype) == TYPE_CODE_INT
       && (options->format == 0 || options->format == 's')
       && addr != 0)
-    return val_print_string (TYPE_TARGET_TYPE (type), NULL, addr, -1,
-                            stream, options);
+    {
+      if (want_space)
+       fputs_filtered (" ", stream);
+      return val_print_string (TYPE_TARGET_TYPE (type), NULL, addr, -1,
+                              stream, options);
+    }
   
   return 0;
 }
index 0a32a22b6072c2ede724f80f5cff6ecdcac48b31..be28f938d1b9b71793d013e53566f23b4ef8aff5 100644 (file)
@@ -74,6 +74,7 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
   struct type *char_type;
   LONGEST val;
   CORE_ADDR addr;
+  int want_space = 0;
 
   CHECK_TYPEDEF (type);
   switch (TYPE_CODE (type))
@@ -176,6 +177,7 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
       if (options->addressprint && options->format != 's')
        {
          fputs_filtered (paddress (gdbarch, addr), stream);
+         want_space = 1;
        }
 
       /* For a pointer to char or unsigned char, also print the string
@@ -188,6 +190,8 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
          && (options->format == 0 || options->format == 's')
          && addr != 0)
        {
+         if (want_space)
+           fputs_filtered (" ", stream);
          /* No wide string yet.  */
          i = val_print_string (elttype, NULL, addr, -1, stream, options);
        }
@@ -203,6 +207,8 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
          ULONGEST string_length;
          void *buffer;
 
+         if (want_space)
+           fputs_filtered (" ", stream);
          buffer = xmalloc (length_size);
          read_memory (addr + length_pos, buffer, length_size);
          string_length = extract_unsigned_integer (buffer, length_size,
@@ -223,9 +229,12 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
          if ((msymbol != NULL)
              && (vt_address == SYMBOL_VALUE_ADDRESS (msymbol)))
            {
-             fputs_filtered (" <", stream);
+             if (want_space)
+               fputs_filtered (" ", stream);
+             fputs_filtered ("<", stream);
              fputs_filtered (SYMBOL_PRINT_NAME (msymbol), stream);
              fputs_filtered (">", stream);
+             want_space = 1;
            }
          if (vt_address && options->vtblprint)
            {
@@ -235,6 +244,9 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
              struct block *block = (struct block *) NULL;
              int is_this_fld;
 
+             if (want_space)
+               fputs_filtered (" ", stream);
+
              if (msymbol != NULL)
                wsym = lookup_symbol (SYMBOL_LINKAGE_NAME (msymbol), block,
                                      VAR_DOMAIN, &is_this_fld);
index 0aeb2f7175af0b146dd1454a7a89d5627bbe429e..9ef55877fdd273fbb6289ab8bf0feec01c14035d 100644 (file)
@@ -1,3 +1,7 @@
+2012-05-18  Tom Tromey  <tromey@redhat.com>
+
+       * gdb.base/charset.exp (string_display): Update.
+
 2012-05-18  Tom Tromey  <tromey@redhat.com>
 
        * gdb.mi/mi2-var-display.exp: Update.
index 47cf9548172115c9563b3282167aa6554afd7f2d..27e36d6dd060910da42556a66d5438eb397e8718 100644 (file)
@@ -604,7 +604,7 @@ gdb_test "print 'a' == 'a' || 'b' == 'b'" \
 
 proc string_display { var_name set_prefix x_size x_type} {
   gdb_test_no_output "set ${var_name} = ${set_prefix}\"Test String\\0with zeroes\"" "Assign ${var_name} with prefix ${set_prefix}"
-  gdb_test "x /2${x_size}s ${var_name}" ".* ${x_type}\"Test String\"\[\r\n\]+.* ${x_type}\"with zeroes\"" "Display String ${var_name} with x/${x_size}s"
+  gdb_test "x /2${x_size}s ${var_name}" ".*\t${x_type}\"Test String\"\[\r\n\]+.*\t${x_type}\"with zeroes\"" "Display String ${var_name} with x/${x_size}s"
 }
 
 if {$ucs2_ok} {
index 507aeb587b8324fc0ca8c3434d7264f2d85989c7..6742fc16ecae4483ab8cf191c0db61d337df92e5 100644 (file)
@@ -2351,10 +2351,6 @@ val_print_string (struct type *elttype, const char *encoding,
      and then the error message.  */
   if (errcode == 0 || bytes_read > 0)
     {
-      if (options->addressprint)
-       {
-         fputs_filtered (" ", stream);
-       }
       LA_PRINT_STRING (stream, elttype, buffer, bytes_read / width,
                       encoding, force_ellipsis, options);
     }
@@ -2363,13 +2359,13 @@ val_print_string (struct type *elttype, const char *encoding,
     {
       if (errcode == EIO)
        {
-         fprintf_filtered (stream, " <Address ");
+         fprintf_filtered (stream, "<Address ");
          fputs_filtered (paddress (gdbarch, addr), stream);
          fprintf_filtered (stream, " out of bounds>");
        }
       else
        {
-         fprintf_filtered (stream, " <Error reading address ");
+         fprintf_filtered (stream, "<Error reading address ");
          fputs_filtered (paddress (gdbarch, addr), stream);
          fprintf_filtered (stream, ": %s>", safe_strerror (errcode));
        }