This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug pascal/11492] Patch to print (pascal) arrays of integer right


------- Additional Comments From muller at ics dot u-strasbg dot fr  2010-04-13 09:24 -------
I agree with your bug report but not with the proposed patch,
instead I propose this:

  The main difference is the the use of /s print format
modifier will force the printing as a string, regardless of the
element type.
 
  Please tell me if this patch is OK for you also.

Pierre Muller
Pascal language maintainer of GDB.

Index: p-valprint.c
===================================================================
RCS file: /cvs/src/src/gdb/p-valprint.c,v
retrieving revision 1.68
diff -u -p -r1.68 p-valprint.c
--- p-valprint.c        9 Mar 2010 08:30:54 -0000       1.68
+++ p-valprint.c        13 Apr 2010 09:19:55 -0000
@@ -80,12 +80,13 @@ pascal_val_print (struct type *type, con
            {
              print_spaces_filtered (2 + 2 * recurse, stream);
            }
-         /* For an array of chars, print with string syntax.  */
-         if ((eltlen == 1 || eltlen == 2 || eltlen == 4)
-             && ((TYPE_CODE (elttype) == TYPE_CODE_INT)
-              || ((current_language->la_language == language_pascal)
-                  && (TYPE_CODE (elttype) == TYPE_CODE_CHAR)))
-             && (options->format == 0 || options->format == 's'))
+         /* If 's' format is used, try to print out as string.
+            If no format is given, print as string if element type
+            is of TYPE_CODE_CHAR and element size is 1,2 or 4.  */
+         if (options->format == 's'
+             || ((eltlen == 1 || eltlen == 2 || eltlen == 4)
+                 && TYPE_CODE (elttype) == TYPE_CODE_CHAR
+                 && options->format == 0))
            {
              /* If requested, look for the first null char and only print
                 elements up to it.  */

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|7.1                         |7.2


http://sourceware.org/bugzilla/show_bug.cgi?id=11492

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]