]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
* p-lang.c (is_pascal_string_type): Remove unneeded parentheses.
authorPierre Muller <muller@sourceware.org>
Tue, 9 Mar 2010 08:30:54 +0000 (08:30 +0000)
committerPierre Muller <muller@sourceware.org>
Tue, 9 Mar 2010 08:30:54 +0000 (08:30 +0000)
* p-valprint.c (pascal_val_print): Remove undeed block and fix
indentation.

gdb/ChangeLog
gdb/p-lang.c
gdb/p-valprint.c

index 867167ebb6a429ec861118a0e22db18a4076fd23..9c55561510039ac1c51be86c6445561a70b9ba21 100644 (file)
@@ -1,3 +1,10 @@
+2010-03-09  Joel Brobecker <brobecker@adacore.com>
+           Pierre Muller <muller@ics.u-strasbg.fr>
+
+       * p-lang.c (is_pascal_string_type): Remove unneeded parentheses.
+       * p-valprint.c (pascal_val_print): Remove undeed block and fix
+       indentation.
+
 2010-03-08  Tom Tromey  <tromey@redhat.com>
 
        * breakpoint.c (breakpoint_1): Add "QUIT".
index 0db99a4aa92b346a269c7945c0d753f59654c60b..415cd9945667e273dd36753c36a58a7b82080a9a 100644 (file)
@@ -101,7 +101,7 @@ is_pascal_string_type (struct type *type,int *length_pos,
                       struct type **char_type,
                       char **arrayname)
 {
-  if ((type != NULL) && (TYPE_CODE (type) == TYPE_CODE_STRUCT))
+  if (type != NULL && TYPE_CODE (type) == TYPE_CODE_STRUCT)
     {
       /* Old Borland type pascal strings from Free Pascal Compiler.  */
       /* Two fields: length and st.  */
index 260b97d09d0bc8d63b42f46fda72e82155d420f2..3bc9c55eaac99bd77f42403daf5497c8cb7ef307 100644 (file)
@@ -151,105 +151,105 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
          break;
        }
       elttype = check_typedef (TYPE_TARGET_TYPE (type));
-       {
-         addr = unpack_pointer (type, valaddr + embedded_offset);
-       print_unpacked_pointer:
-         elttype = check_typedef (TYPE_TARGET_TYPE (type));
-
-         if (TYPE_CODE (elttype) == TYPE_CODE_FUNC)
-           {
-             /* Try to print what function it points to.  */
-             print_address_demangle (gdbarch, addr, stream, demangle);
-             /* Return value is irrelevant except for string pointers.  */
-             return (0);
-           }
 
-         if (options->addressprint && options->format != 's')
-           {
-             fputs_filtered (paddress (gdbarch, addr), stream);
-           }
+      addr = unpack_pointer (type, valaddr + embedded_offset);
+    print_unpacked_pointer:
+      elttype = check_typedef (TYPE_TARGET_TYPE (type));
 
-         /* For a pointer to char or unsigned char, also print the string
-            pointed to, unless pointer is null.  */
-         if (((TYPE_LENGTH (elttype) == 1
-              && (TYPE_CODE (elttype) == TYPE_CODE_INT
-                 || TYPE_CODE (elttype) == TYPE_CODE_CHAR))
-             || ((TYPE_LENGTH (elttype) == 2 || TYPE_LENGTH (elttype) == 4)
-                 && TYPE_CODE (elttype) == TYPE_CODE_CHAR))
-             && (options->format == 0 || options->format == 's')
-             && addr != 0)
-           {
-             /* no wide string yet */
-             i = val_print_string (elttype, addr, -1, stream, options);
-           }
-         /* also for pointers to pascal strings */
-         /* Note: this is Free Pascal specific:
-            as GDB does not recognize stabs pascal strings
-            Pascal strings are mapped to records
-            with lowercase names PM  */
-          if (is_pascal_string_type (elttype, &length_pos, &length_size,
-                                     &string_pos, &char_type, NULL)
-             && addr != 0)
+      if (TYPE_CODE (elttype) == TYPE_CODE_FUNC)
+       {
+         /* Try to print what function it points to.  */
+         print_address_demangle (gdbarch, addr, stream, demangle);
+         /* Return value is irrelevant except for string pointers.  */
+         return (0);
+       }
+
+      if (options->addressprint && options->format != 's')
+       {
+         fputs_filtered (paddress (gdbarch, addr), stream);
+       }
+
+      /* For a pointer to char or unsigned char, also print the string
+        pointed to, unless pointer is null.  */
+      if (((TYPE_LENGTH (elttype) == 1
+          && (TYPE_CODE (elttype) == TYPE_CODE_INT
+             || TYPE_CODE (elttype) == TYPE_CODE_CHAR))
+         || ((TYPE_LENGTH (elttype) == 2 || TYPE_LENGTH (elttype) == 4)
+             && TYPE_CODE (elttype) == TYPE_CODE_CHAR))
+         && (options->format == 0 || options->format == 's')
+         && addr != 0)
+       {
+         /* no wide string yet */
+         i = val_print_string (elttype, addr, -1, stream, options);
+       }
+      /* also for pointers to pascal strings */
+      /* Note: this is Free Pascal specific:
+        as GDB does not recognize stabs pascal strings
+        Pascal strings are mapped to records
+        with lowercase names PM  */
+      if (is_pascal_string_type (elttype, &length_pos, &length_size,
+                                &string_pos, &char_type, NULL)
+         && addr != 0)
+       {
+         ULONGEST string_length;
+         void *buffer;
+         buffer = xmalloc (length_size);
+         read_memory (addr + length_pos, buffer, length_size);
+         string_length = extract_unsigned_integer (buffer, length_size,
+                                                   byte_order);
+         xfree (buffer);
+         i = val_print_string (char_type ,addr + string_pos, string_length, stream, options);
+       }
+      else if (pascal_object_is_vtbl_member (type))
+       {
+         /* print vtbl's nicely */
+         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)))
            {
-             ULONGEST string_length;
-              void *buffer;
-              buffer = xmalloc (length_size);
-              read_memory (addr + length_pos, buffer, length_size);
-             string_length = extract_unsigned_integer (buffer, length_size,
-                                                       byte_order);
-              xfree (buffer);
-              i = val_print_string (char_type ,addr + string_pos, string_length, stream, options);
+             fputs_filtered (" <", stream);
+             fputs_filtered (SYMBOL_PRINT_NAME (msymbol), stream);
+             fputs_filtered (">", stream);
            }
-         else if (pascal_object_is_vtbl_member (type))
+         if (vt_address && options->vtblprint)
            {
-             /* print vtbl's nicely */
-             CORE_ADDR vt_address = unpack_pointer (type, valaddr + embedded_offset);
+             struct value *vt_val;
+             struct symbol *wsym = (struct symbol *) NULL;
+             struct type *wtype;
+             struct block *block = (struct block *) NULL;
+             int is_this_fld;
+
+             if (msymbol != NULL)
+               wsym = lookup_symbol (SYMBOL_LINKAGE_NAME (msymbol), block,
+                                     VAR_DOMAIN, &is_this_fld);
 
-             struct minimal_symbol *msymbol =
-             lookup_minimal_symbol_by_pc (vt_address);
-             if ((msymbol != NULL)
-                 && (vt_address == SYMBOL_VALUE_ADDRESS (msymbol)))
+             if (wsym)
                {
-                 fputs_filtered (" <", stream);
-                 fputs_filtered (SYMBOL_PRINT_NAME (msymbol), stream);
-                 fputs_filtered (">", stream);
+                 wtype = SYMBOL_TYPE (wsym);
                }
-             if (vt_address && options->vtblprint)
+             else
                {
-                 struct value *vt_val;
-                 struct symbol *wsym = (struct symbol *) NULL;
-                 struct type *wtype;
-                 struct block *block = (struct block *) NULL;
-                 int is_this_fld;
-
-                 if (msymbol != NULL)
-                   wsym = lookup_symbol (SYMBOL_LINKAGE_NAME (msymbol), block,
-                                         VAR_DOMAIN, &is_this_fld);
-
-                 if (wsym)
-                   {
-                     wtype = SYMBOL_TYPE (wsym);
-                   }
-                 else
-                   {
-                     wtype = TYPE_TARGET_TYPE (type);
-                   }
-                 vt_val = value_at (wtype, vt_address);
-                 common_val_print (vt_val, stream, recurse + 1, options,
-                                   current_language);
-                 if (options->pretty)
-                   {
-                     fprintf_filtered (stream, "\n");
-                     print_spaces_filtered (2 + 2 * recurse, stream);
-                   }
+                 wtype = TYPE_TARGET_TYPE (type);
+               }
+             vt_val = value_at (wtype, vt_address);
+             common_val_print (vt_val, stream, recurse + 1, options,
+                               current_language);
+             if (options->pretty)
+               {
+                 fprintf_filtered (stream, "\n");
+                 print_spaces_filtered (2 + 2 * recurse, stream);
                }
            }
-
-         /* Return number of characters printed, including the terminating
-            '\0' if we reached the end.  val_print_string takes care including
-            the terminating '\0' if necessary.  */
-         return i;
        }
+
+      /* Return number of characters printed, including the terminating
+        '\0' if we reached the end.  val_print_string takes care including
+        the terminating '\0' if necessary.  */
+      return i;
+
       break;
 
     case TYPE_CODE_REF: